RDKit: RDKit::SubstructLibrary Class Reference

| RDKit Open-source cheminformatics and machine learning.

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
RDKit::SubstructLibrary Class Reference

Substtructure Search a library of molecules. More...

`#include <SubstructLibrary.h>`

## Public Member Functions
| SubstructLibrary ()
| SubstructLibrary (boost::shared_ptr< MolHolderBase > molecules)
| SubstructLibrary (boost::shared_ptr< MolHolderBase > molecules, boost::shared_ptr< FPHolderBase > fingerprints)
MolHolderBase & | getMolHolder ()
| Get the underlying molecule holder implementation. More...
const MolHolderBase & | getMolecules () const
FPHolderBase & | getFingerprints ()
| Get the underlying fingerprint implementation. More...
const FPHolderBase & | getFingerprints () const
unsigned int | addMol (const ROMol &mol)
| Add a molecule to the library. More...
std::vector< unsigned int > | getMatches (const ROMol &query, bool recursionPossible=true, bool useChirality=true, bool useQueryQueryMatches=false, int numThreads=-1, int maxResults=-1)
| Get the matching indices for the query. More...
std::vector< unsigned int > | getMatches (const ROMol &query, unsigned int startIdx, unsigned int endIdx, bool recursionPossible=true, bool useChirality=true, bool useQueryQueryMatches=false, int numThreads=-1, int maxResults=-1)
| Get the matching indices for the query between the given indices. More...
unsigned int | countMatches (const ROMol &query, bool recursionPossible=true, bool useChirality=true, bool useQueryQueryMatches=false, int numThreads=-1)
| Return the number of matches for the query. More...
unsigned int | countMatches (const ROMol &query, unsigned int startIdx, unsigned int endIdx, bool recursionPossible=true, bool useChirality=true, bool useQueryQueryMatches=false, int numThreads=-1)
| Return the number of matches for the query between the given indices. More...
bool | hasMatch (const ROMol &query, bool recursionPossible=true, bool useChirality=true, bool useQueryQueryMatches=false, int numThreads=-1)
| Returns true if any match exists for the query. More...
bool | hasMatch (const ROMol &query, unsigned int startIdx, unsigned int endIdx, bool recursionPossible=true, bool useChirality=true, bool useQueryQueryMatches=false, int numThreads=-1)
| Returns true if any match exists for the query between the specified indices. More...
boost::shared_ptr< ROMol > | getMol (unsigned int idx) const
| Returns the molecule at the given index. More...
boost::shared_ptr< ROMol > | operator[] (unsigned int idx)
| Returns the molecule at the given index. More...
unsigned int | size () const
| return the number of molecules in the library More...

## Detailed Description

Substtructure Search a library of molecules.

This class allows for multithreaded substructure searches os large datasets.

The implementations can use fingerprints to speed up searches and have molecules cached as binary forms to reduce memory usage.

Definition at line 279 of file SubstructLibrary.h.

## Constructor & Destructor Documentation

RDKit::SubstructLibrary::SubstructLibrary | ( |  | ) |
| inline

Definition at line 286 of file SubstructLibrary.h.

RDKit::SubstructLibrary::SubstructLibrary | ( | boost::shared_ptr< MolHolderBase > | molecules | ) |
| inline

Definition at line 292 of file SubstructLibrary.h.

RDKit::SubstructLibrary::SubstructLibrary | ( | boost::shared_ptr< MolHolderBase > | molecules,
|  | boost::shared_ptr< FPHolderBase > | fingerprints
| ) |  |
| inline

Definition at line 295 of file SubstructLibrary.h.

## Member Function Documentation

unsigned int RDKit::SubstructLibrary::addMol | ( | const ROMol & | mol | ) |

Add a molecule to the library.

Parameters

  mol | Molecule to add

returns index for the molecule in the library

unsigned int RDKit::SubstructLibrary::countMatches | ( | const ROMol & | query,
|  | bool | recursionPossible = `true`,
|  | bool | useChirality = `true`,
|  | bool | useQueryQueryMatches = `false`,
|  | int | numThreads = `-1`
| ) |  |

Return the number of matches for the query.

Parameters

  query | Query to match against molecules
  recursionPossible | flags whether or not recursive matches are allowed [ default true ]
  useChirality | use atomic CIP codes as part of the comparison [ default true ]
  useQueryQueryMatches | if set, the contents of atom and bond queries [ default false ] will be used as part of the matching
  numThreads | If -1 use all available processors [default -1]

unsigned int RDKit::SubstructLibrary::countMatches | ( | const ROMol & | query,
|  | unsigned int | startIdx,
|  | unsigned int | endIdx,
|  | bool | recursionPossible = `true`,
|  | bool | useChirality = `true`,
|  | bool | useQueryQueryMatches = `false`,
|  | int | numThreads = `-1`
| ) |  |

Return the number of matches for the query between the given indices.

Parameters

  query | Query to match against molecules
  startIdx | Start index of the search
  endIdx | Ending idx (non-inclusive) of the search.
  recursionPossible | flags whether or not recursive matches are allowed [ default true ]
  useChirality | use atomic CIP codes as part of the comparison [ default true ]
  useQueryQueryMatches | if set, the contents of atom and bond queries [ default false ] will be used as part of the matching
  numThreads | If -1 use all available processors [default -1]

FPHolderBase& RDKit::SubstructLibrary::getFingerprints | ( |  | ) |
| inline

Get the underlying fingerprint implementation.

Throws a value error if no fingerprints have been set

Definition at line 315 of file SubstructLibrary.h.

const FPHolderBase& RDKit::SubstructLibrary::getFingerprints | ( |  | ) | const
| inline

Definition at line 321 of file SubstructLibrary.h.

References RDKit::MolHolderBase::addMol().

std::vector<unsigned int> RDKit::SubstructLibrary::getMatches | ( | const ROMol & | query,
|  | bool | recursionPossible = `true`,
|  | bool | useChirality = `true`,
|  | bool | useQueryQueryMatches = `false`,
|  | int | numThreads = `-1`,
|  | int | maxResults = `-1`
| ) |  |

Get the matching indices for the query.

Parameters

  query | Query to match against molecules
  recursionPossible | flags whether or not recursive matches are allowed [ default true ]
  useChirality | use atomic CIP codes as part of the comparison [ default true ]
  useQueryQueryMatches | if set, the contents of atom and bond queries [ default false ] will be used as part of the matching
  numThreads | If -1 use all available processors [default -1]
  maxResults | Maximum results to return, -1 means return all [default -1]

std::vector<unsigned int> RDKit::SubstructLibrary::getMatches | ( | const ROMol & | query,
|  | unsigned int | startIdx,
|  | unsigned int | endIdx,
|  | bool | recursionPossible = `true`,
|  | bool | useChirality = `true`,
|  | bool | useQueryQueryMatches = `false`,
|  | int | numThreads = `-1`,
|  | int | maxResults = `-1`
| ) |  |

Get the matching indices for the query between the given indices.

Parameters

  query | Query to match against molecules
  startIdx | Start index of the search
  endIdx | Ending idx (non-inclusive) of the search.
  recursionPossible | flags whether or not recursive matches are allowed [ default true ]
  useChirality | use atomic CIP codes as part of the comparison [ default true ]
  useQueryQueryMatches | if set, the contents of atom and bond queries [ default false ] will be used as part of the matching
  numThreads | If -1 use all available processors [default -1]
  maxResults | Maximum results to return, -1 means return all [default -1]

boost::shared_ptr<ROMol> RDKit::SubstructLibrary::getMol | ( | unsigned int | idx | ) | const
| inline

Returns the molecule at the given index.

Parameters

  idx | Index of the molecule in the library

Definition at line 441 of file SubstructLibrary.h.

References RDKit::MolHolderBase::getMol(), and PRECONDITION.

const MolHolderBase& RDKit::SubstructLibrary::getMolecules | ( |  | ) | const
| inline

Definition at line 308 of file SubstructLibrary.h.

References PRECONDITION.

MolHolderBase& RDKit::SubstructLibrary::getMolHolder | ( |  | ) |
| inline

Get the underlying molecule holder implementation.

Definition at line 303 of file SubstructLibrary.h.

References PRECONDITION.

bool RDKit::SubstructLibrary::hasMatch | ( | const ROMol & | query,
|  | bool | recursionPossible = `true`,
|  | bool | useChirality = `true`,
|  | bool | useQueryQueryMatches = `false`,
|  | int | numThreads = `-1`
| ) |  |

Returns true if any match exists for the query.

Parameters

  query | Query to match against molecules
  recursionPossible | flags whether or not recursive matches are allowed [ default true ]
  useChirality | use atomic CIP codes as part of the comparison [ default true ]
  useQueryQueryMatches | if set, the contents of atom and bond queries [ default false ] will be used as part of the matching
  numThreads | If -1 use all available processors [default -1]

bool RDKit::SubstructLibrary::hasMatch | ( | const ROMol & | query,
|  | unsigned int | startIdx,
|  | unsigned int | endIdx,
|  | bool | recursionPossible = `true`,
|  | bool | useChirality = `true`,
|  | bool | useQueryQueryMatches = `false`,
|  | int | numThreads = `-1`
| ) |  |

Returns true if any match exists for the query between the specified indices.

Parameters

  query | Query to match against molecules
  startIdx | Start index of the search
  endIdx | Ending idx (inclusive) of the search.
  recursionPossible | flags whether or not recursive matches are allowed [ default true ]
  useChirality | use atomic CIP codes as part of the comparison [ default true ]
  useQueryQueryMatches | if set, the contents of atom and bond queries [ default false ] will be used as part of the matching
  numThreads | If -1 use all available processors [default -1]

boost::shared_ptr<ROMol> RDKit::SubstructLibrary::operator[] | ( | unsigned int | idx | ) |
| inline

Returns the molecule at the given index.

Parameters

  idx | Index of the molecule in the library

Definition at line 451 of file SubstructLibrary.h.

References RDKit::MolHolderBase::getMol(), and PRECONDITION.

unsigned int RDKit::SubstructLibrary::size | ( |  | ) | const
| inline

return the number of molecules in the library

Definition at line 458 of file SubstructLibrary.h.

References PRECONDITION.

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

- SubstructLibrary.h