Attention
This API is currently available in C++ and Python.
OESiteHopperDatabase
class OESiteHopperDatabase : public OEShape::OESiteHopperDatabaseBase
This class allows creation and searching of one or more OESiteHopper patches, built from OEDesignUnits. When adding data to the database, it can be opened in either Create or Append mode. For searching, open in Search (ReadOnly) mode for thread safety and to prevent accidentally changing the data.
Constructors
OESiteHopperDatabase() -> OESiteHopperDatabase
OESiteHopperDatabase(arg2: OESiteHopperDatabase) -> OESiteHopperDatabase
Default constructors.
Open
Open(dbfile: str, mode: int,
opts: OESiteHopperDatabaseOptions = OESiteHopperDatabaseOptions()) -> bool
Open a file as an OESiteHopperDatabase.
To create a new database, use the mode
OESiteHopperDatabaseMode_CREATE. If the file
already exists, it will be overwritten. The options used to create the
database can be changed by passing an new version of OESiteHopperDatabaseOptions.
To append to an existing database, use the mode
OESiteHopperDatabaseMode_APPEND. If the file
does not yet exists, it will be created like the Create mode.
To read or search a file, open using the mode
OESiteHopperDatabaseMode_SEARCH. This opens the
database in read-only mode and will not allow adding new entries.
Note
OESiteHopperDatabaseOptions are only used in CREATE mode. Otherwise, options already stored in the database will be used.
operator bool
IsValid() -> bool
Add
Add(filename: str) -> int
Add(du: OEDesignUnit) -> int
Add a single OEDesignUnit file or object to an open database. This method will fail if the database is not open or if not opened in Create or Append mode.
Returns the index of the newly added OEDesignUnit or UINT_MAX on failure.
AddDirectory
AddDirectory(path: str, ncpu: int = 0,
tracer: OETracerBase = OENoTracer) -> bool
Add a directory of OEDesignUnit files to the database. This call will recurse the entire directory tree, looking for all available .oedu files.
By default, this call will use all available CPUs to process this set of OEDesignUnits. Setting ncpu can be used to reduce the number of CPUs used.
If you want to see a progress bar during the process, use an OEConsoleProgressTracer instead of the default OENoTracer.
Close
Close() -> None
Close the database connection. Any operations (except another call to Open) after this will fail.
GetDesignUnit
GetDesignUnit(du: OEDesignUnit, idx: int) -> bool
Get a specific OEDesignUnit based on the database index.
GetIDByTitle
GetIDByTitle(title: str) -> OEUIntVector
Get a vector of indices based on a substring match of the passed in title to OEDesignUnit titles in the database.
GetMaxMolIdx
GetMaxMolIdx() -> int
Internal use: Get the maximum index in the database. Used by the GPU search.
GetMolecule
GetMolecule(mol: Union[OEGraphMol,OEMol,OEQMol], idx: int) -> bool
Internal use: Get the patch molecule for the given index.
GetOptions
GetOptions() -> OESiteHopperDatabaseOptions
Get the options used to create patches as they are added to the database.
GetSequenceInfo
GetSequenceInfo(seq: OEStringVectorVector, idx: int) -> bool
Internal use: Get the sequence info for the given database index.
GetTitle
GetTitle(idx: int) -> str
Get the OEDesignUnit title for the given index.