RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
RDKit::MultiFPBReader Class Reference

class for reading and searching multiple FPB files More...

#include <MultiFPBReader.h>

Public Types

typedef std::tuple< double, unsigned int, unsigned intResultTuple
 

Public Member Functions

 MultiFPBReader ()
 
 MultiFPBReader (bool initOnSearch)
 
 MultiFPBReader (std::vector< FPBReader * > &readers, bool takeOwnership=false, bool initOnSearch=false)
 
 ~MultiFPBReader ()
 
void init ()
 Read the data from the file and initialize internal data structures.
 
unsigned int length () const
 returns the number of readers
 
unsigned int nBits () const
 
FPBReadergetReader (unsigned int which)
 returns a particular reader
 
unsigned int addReader (FPBReader *rdr)
 adds a new FPBReader to our list
 
std::vector< ResultTuplegetTanimotoNeighbors (const std::uint8_t *bv, double threshold=0.7, int numThreads=1) const
 returns tanimoto neighbors that are within a similarity threshold
 
std::vector< ResultTuplegetTanimotoNeighbors (boost::shared_array< std::uint8_t > bv, double threshold=0.7, int numThreads=1) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
std::vector< ResultTuplegetTanimotoNeighbors (const ExplicitBitVect &ebv, double threshold=0.7, int numThreads=1) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
std::vector< ResultTuplegetTverskyNeighbors (const std::uint8_t *bv, double ca, double cb, double threshold=0.7, int numThreads=1) const
 returns Tversky neighbors that are within a similarity threshold
 
std::vector< ResultTuplegetTverskyNeighbors (boost::shared_array< std::uint8_t > bv, double ca, double cb, double threshold=0.7, int numThreads=1) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
std::vector< ResultTuplegetTverskyNeighbors (const ExplicitBitVect &ebv, double ca, double cb, double threshold=0.7, int numThreads=1) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
std::vector< std::pair< unsigned int, unsigned int > > getContainingNeighbors (const std::uint8_t *bv, int numThreads=1) const
 returns indices of all fingerprints that completely contain this one
 
std::vector< std::pair< unsigned int, unsigned int > > getContainingNeighbors (boost::shared_array< std::uint8_t > bv, int numThreads=1) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
std::vector< std::pair< unsigned int, unsigned int > > getContainingNeighbors (const ExplicitBitVect &ebv, int numThreads=1) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 

Detailed Description

class for reading and searching multiple FPB files

basic usage:

FPBReader r1("foo1.fpb"),r2("foo2.fpb");
std::vector<FPBReader *> readers;
readers.append(&r1);
readers.append(&r2);
fpbs.init();
boost::shared_ptr<ExplicitBitVect> ebv = fpbs.getReader(0)->getFP(95);
std::vector<std::tuple<double,unsigned int, unsigned int> > nbrs =
fpbs.getTanimotoNeighbors(*ebv.get(), 0.70);
class for reading and searching FPB files
Definition FPBReader.h:58
class for reading and searching multiple FPB files
bool rdvalue_is(const RDValue_cast_t)

Note: this functionality is experimental and the API may change in future releases.

Note on thread safety Operations that involve reading from FPB files are not thread safe. This means that the init() method is not thread safe and none of the search operations are thread safe when an FPBReader is initialized in lazyRead mode.

Definition at line 53 of file MultiFPBReader.h.

Member Typedef Documentation

◆ ResultTuple

Constructor & Destructor Documentation

◆ MultiFPBReader() [1/3]

RDKit::MultiFPBReader::MultiFPBReader ( )
inline

Definition at line 56 of file MultiFPBReader.h.

◆ MultiFPBReader() [2/3]

RDKit::MultiFPBReader::MultiFPBReader ( bool initOnSearch)
inline
Parameters
initOnSearchif this is true, the init() method on child readers will not be called until the first search is done. This is useful with large FPB readers.

Definition at line 63 of file MultiFPBReader.h.

◆ MultiFPBReader() [3/3]

RDKit::MultiFPBReader::MultiFPBReader ( std::vector< FPBReader * > & readers,
bool takeOwnership = false,
bool initOnSearch = false )
Parameters
readersthe set of FPBReader objects to use.
takeOwnershipif true, we own the memory for the FPBReaders
initOnSearchif this is true, the init() method on child readers will not be called until the first search is done. This is useful with large FPB readers.

◆ ~MultiFPBReader()

RDKit::MultiFPBReader::~MultiFPBReader ( )
inline

Definition at line 77 of file MultiFPBReader.h.

Member Function Documentation

◆ addReader()

unsigned int RDKit::MultiFPBReader::addReader ( FPBReader * rdr)
inline

adds a new FPBReader to our list

This does no error checking on the reader, so be careful.

If takeOwnership is true then we will take ownership of the memory.

Parameters
rdrthe reader to add. If we have already been initialized, the reader's init() method will be called
Returns
a count of the current number of readers

Definition at line 121 of file MultiFPBReader.h.

References RDKit::FPBReader::init(), and PRECONDITION.

◆ getContainingNeighbors() [1/3]

std::vector< std::pair< unsigned int, unsigned int > > RDKit::MultiFPBReader::getContainingNeighbors ( boost::shared_array< std::uint8_t > bv,
int numThreads = 1 ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 193 of file MultiFPBReader.h.

◆ getContainingNeighbors() [2/3]

std::vector< std::pair< unsigned int, unsigned int > > RDKit::MultiFPBReader::getContainingNeighbors ( const ExplicitBitVect & ebv,
int numThreads = 1 ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ getContainingNeighbors() [3/3]

std::vector< std::pair< unsigned int, unsigned int > > RDKit::MultiFPBReader::getContainingNeighbors ( const std::uint8_t * bv,
int numThreads = 1 ) const

returns indices of all fingerprints that completely contain this one

(i.e. where all the bits set in the query are also set in the db molecule)

◆ getReader()

FPBReader * RDKit::MultiFPBReader::getReader ( unsigned int which)

returns a particular reader

Parameters
whichthe reader to return

◆ getTanimotoNeighbors() [1/3]

std::vector< ResultTuple > RDKit::MultiFPBReader::getTanimotoNeighbors ( boost::shared_array< std::uint8_t > bv,
double threshold = 0.7,
int numThreads = 1 ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 146 of file MultiFPBReader.h.

◆ getTanimotoNeighbors() [2/3]

std::vector< ResultTuple > RDKit::MultiFPBReader::getTanimotoNeighbors ( const ExplicitBitVect & ebv,
double threshold = 0.7,
int numThreads = 1 ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ getTanimotoNeighbors() [3/3]

std::vector< ResultTuple > RDKit::MultiFPBReader::getTanimotoNeighbors ( const std::uint8_t * bv,
double threshold = 0.7,
int numThreads = 1 ) const

returns tanimoto neighbors that are within a similarity threshold

The result vector of (similarity,index,reader) tuples is sorted in order of decreasing similarity

Parameters
bvthe query fingerprint
thresholdthe minimum similarity to return
numThreadsSets the number of threads to use (more than one thread will only be used if the RDKit was build with multithread support) If set to zero, the max supported by the system will be used.

◆ getTverskyNeighbors() [1/3]

std::vector< ResultTuple > RDKit::MultiFPBReader::getTverskyNeighbors ( boost::shared_array< std::uint8_t > bv,
double ca,
double cb,
double threshold = 0.7,
int numThreads = 1 ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 175 of file MultiFPBReader.h.

◆ getTverskyNeighbors() [2/3]

std::vector< ResultTuple > RDKit::MultiFPBReader::getTverskyNeighbors ( const ExplicitBitVect & ebv,
double ca,
double cb,
double threshold = 0.7,
int numThreads = 1 ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ getTverskyNeighbors() [3/3]

std::vector< ResultTuple > RDKit::MultiFPBReader::getTverskyNeighbors ( const std::uint8_t * bv,
double ca,
double cb,
double threshold = 0.7,
int numThreads = 1 ) const

returns Tversky neighbors that are within a similarity threshold

The result vector of (similarity,index) pairs is sorted in order of decreasing similarity

Parameters
bvthe query fingerprint
cathe Tversky a coefficient
cbthe Tversky a coefficient
thresholdthe minimum similarity to return
numThreadsSets the number of threads to use (more than one thread will only be used if the RDKit was build with multithread support) If set to zero, the max supported by the system will be used.

◆ init()

void RDKit::MultiFPBReader::init ( )

Read the data from the file and initialize internal data structures.

This must be called before most of the other methods of this class. It calls the init() method on each of the child FPBReaders

◆ length()

unsigned int RDKit::MultiFPBReader::length ( ) const
inline

returns the number of readers

Definition at line 96 of file MultiFPBReader.h.

◆ nBits()

unsigned int RDKit::MultiFPBReader::nBits ( ) const

returns the number of bits in our fingerprints (all readers are expected to have the same length)


The documentation for this class was generated from the following file: