class OEFastFPDatabase

The OEFastFPDatabase class is designed to perform rapid in-memory or memory-mapped fingerprint searches using the popcount method. Each OEFastFPDatabase object is associated with a fingerprint type (OEFPTypeBase) that is set when the database is initialized from a pre-generated binary fingerprint file.


GraphSim TK currently only supports the popcount search method for fingerprints with the size of multiple of 256. This means that the OEFPType_MACCS166 fingerprint type is currently not supported. When using other custom fingerprint types (see User-defined Fingerprint section) the size of the fingerprint must be a multiple of 256 in order to be able to search it with the popcount method.


OEFastFPDatabase gives identical results to OEFPDatabase. However OEFPDatabase calculates similarity scores in single precision (float) while OEFastFPDatabase uses double precision. As a result small similarity score differences can be observed.

See also


Schematic representation of fast fingerprint search process


OEFastFPDatabase(const std::string &dbfile,
                 unsigned int memtype=OEFastFPDatabaseMemoryType::Default)

Constructs an OEFastFPDatabase object.

The name of the file which contains the fingerprint data. The file has to be generated with the OECreateFastFPDatabaseFile function.
Defines whether the fingerprints are pre-loaded into memory or memory-mapped during the search process. This value has to be from the OEFastFPDatabaseMemoryType namespace.

See also


const OEFPTypeBase *GetFPTypeBase() const

Returns the fingerprint type of the OEFastFPDatabase object. An OEFastFPDatabase object can only store fingerprints with identical type.


OESystem::OEIterBase<OESimScore> *GetSortedScores(const OEChem::OEMolBase &mol,
                                                  const OEFPDatabaseOptions &opts) const
OESystem::OEIterBase<OESimScore> *GetSortedScores(const OEFingerPrint &fp,
                                                  const OEFPDatabaseOptions &opts) const

Performs similarity calculations between a molecule or a fingerprint and the fingerprints stored in the OEFastFPDatabase object. It returns an iterator over the calculated similarity scores (OESimScore) in sorted order. Each OESimScore holds a similarity score and index of the corresponding fingerprint of the database.

If the method is called with an OEMolBase object, then a fingerprint is generated from this molecule before looping over the fingerprints of the database and calculating similarities.
If the method is called with an OEFingerPrint object, then its type has to match with the type of the OEFastFPDatabase.
The OEFPDatabaseOptions object controls all the parameters that determine the sorted search. For example, similarity measure, score cutoff, descending or ascending order etc.

See also


bool IsValid() const

Returns whether the database was initialized correctly.


size_t NumFingerPrints() const

Returns the number of OEFingerPrint objects stored in the database.