RDKit
Open-source cheminformatics and machine learning.
RDKit::MultiFPBReader Class Reference

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

#include <MultiFPBReader.h>

Public Types

typedef boost::tuple< double, unsigned int, unsigned int > ResultTuple
 

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. More...
 
unsigned int length () const
 returns the number of readers More...
 
unsigned int nBits () const
 
FPBReadergetReader (unsigned int which)
 returns a particular reader More...
 
unsigned int addReader (FPBReader *rdr)
 adds a new FPBReader to our list More...
 
std::vector< ResultTuplegetTanimotoNeighbors (const boost::uint8_t *bv, double threshold=0.7, int numThreads=1) const
 returns tanimoto neighbors that are within a similarity threshold More...
 
std::vector< ResultTuplegetTanimotoNeighbors (boost::shared_array< boost::uint8_t > bv, double threshold=0.7, int numThreads=1) const
 
std::vector< ResultTuplegetTanimotoNeighbors (const ExplicitBitVect &ebv, double threshold=0.7, int numThreads=1) const
 
std::vector< ResultTuplegetTverskyNeighbors (const boost::uint8_t *bv, double ca, double cb, double threshold=0.7, int numThreads=1) const
 returns Tversky neighbors that are within a similarity threshold More...
 
std::vector< ResultTuplegetTverskyNeighbors (boost::shared_array< boost::uint8_t > bv, double ca, double cb, double threshold=0.7, int numThreads=1) const
 
std::vector< ResultTuplegetTverskyNeighbors (const ExplicitBitVect &ebv, double ca, double cb, double threshold=0.7, int numThreads=1) const
 
std::vector< std::pair< unsigned int, unsigned int > > getContainingNeighbors (const boost::uint8_t *bv, int numThreads=1) const
 returns indices of all fingerprints that completely contain this one More...
 
std::vector< std::pair< unsigned int, unsigned int > > getContainingNeighbors (boost::shared_array< boost::uint8_t > bv, int numThreads=1) const
 
std::vector< std::pair< unsigned int, unsigned int > > getContainingNeighbors (const ExplicitBitVect &ebv, int numThreads=1) const
 

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);
MultiFPBReader fpbs(readers);
fpbs.init();
boost::shared_ptr<ExplicitBitVect> ebv = fpbs.getReader(0)->getFP(95);
std::vector<boost::tuple<double,unsigned int, unsigned int> > nbrs =
fpbs.getTanimotoNeighbors(*ebv.get(), 0.70);

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

typedef boost::tuple<double, unsigned int, unsigned int> RDKit::MultiFPBReader::ResultTuple

Definition at line 55 of file MultiFPBReader.h.

Constructor & Destructor Documentation

RDKit::MultiFPBReader::MultiFPBReader ( )
inline

Definition at line 56 of file MultiFPBReader.h.

Referenced by getContainingNeighbors(), and MultiFPBReader().

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 64 of file MultiFPBReader.h.

References MultiFPBReader().

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.
RDKit::MultiFPBReader::~MultiFPBReader ( )
inline

Definition at line 78 of file MultiFPBReader.h.

References init().

Member Function Documentation

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 120 of file MultiFPBReader.h.

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

std::vector<std::pair<unsigned int, unsigned int> > RDKit::MultiFPBReader::getContainingNeighbors ( const boost::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)

Referenced by getContainingNeighbors(), and getTverskyNeighbors().

std::vector<std::pair<unsigned int, unsigned int> > RDKit::MultiFPBReader::getContainingNeighbors ( boost::shared_array< boost::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 190 of file MultiFPBReader.h.

References getContainingNeighbors(), and MultiFPBReader().

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.

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

returns a particular reader

Parameters
whichthe reader to return

Referenced by length().

std::vector<ResultTuple> RDKit::MultiFPBReader::getTanimotoNeighbors ( const boost::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.

Referenced by addReader(), and getTanimotoNeighbors().

std::vector<ResultTuple> RDKit::MultiFPBReader::getTanimotoNeighbors ( boost::shared_array< boost::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 143 of file MultiFPBReader.h.

References getTanimotoNeighbors(), and getTverskyNeighbors().

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.

std::vector<ResultTuple> RDKit::MultiFPBReader::getTverskyNeighbors ( const boost::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.

Referenced by getTanimotoNeighbors(), and getTverskyNeighbors().

std::vector<ResultTuple> RDKit::MultiFPBReader::getTverskyNeighbors ( boost::shared_array< boost::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 172 of file MultiFPBReader.h.

References getContainingNeighbors(), and getTverskyNeighbors().

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.

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 clases. It calls the init() method on each of the child FPBReaders

Referenced by ~MultiFPBReader().

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

returns the number of readers

Definition at line 95 of file MultiFPBReader.h.

References getReader(), and nBits().

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

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

Referenced by length().


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