RDKit: RDKit::SynthonSpaceSearch::SynthonSpace Class Reference

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Friends | List of all members
RDKit::SynthonSpaceSearch::SynthonSpace Class Reference

`#include <SynthonSpace.h>`

## Public Member Functions
| SynthonSpace ()=default
| ~SynthonSpace ()=default
| SynthonSpace (const SynthonSpace &other)=delete
SynthonSpace & | operator= (const SynthonSpace &other)=delete
size_t | getNumReactions () const
std::vector< std::string > | getReactionNames () const
const std::shared_ptr< SynthonSet > | getReaction (std::string reactionName)
unsigned int | getPatternFPSize () const
unsigned int | getFPSize () const
std::string | getInputFileName () const
std::uint64_t | getNumProducts () const
std::string | getSynthonFingerprintType () const
SearchResults | substructureSearch (const ROMol &query, const SubstructMatchParameters &matchParams=SubstructMatchParameters(), const SynthonSpaceSearchParams &params=SynthonSpaceSearchParams())
void | substructureSearch (const ROMol &query, const SearchResultCallback &callback, const SubstructMatchParameters &matchParams=SubstructMatchParameters(), const SynthonSpaceSearchParams &params=SynthonSpaceSearchParams())
SearchResults | substructureSearch (const GeneralizedSubstruct::ExtendedQueryMol &query, const SubstructMatchParameters &matchParams=SubstructMatchParameters(), const SynthonSpaceSearchParams &params=SynthonSpaceSearchParams())
SearchResults | fingerprintSearch (const ROMol &query, const FingerprintGenerator< std::uint64_t > &fpGen, const SynthonSpaceSearchParams &params=SynthonSpaceSearchParams())
void | fingerprintSearch (const ROMol &query, const FingerprintGenerator< std::uint64_t > &fpGen, const SearchResultCallback &callback, const SynthonSpaceSearchParams &params=SynthonSpaceSearchParams())
SearchResults | rascalSearch (const ROMol &query, const RascalMCES::RascalOptions &rascalOptions, const SynthonSpaceSearchParams &params=SynthonSpaceSearchParams())
void | rascalSearch (const ROMol &query, const RascalMCES::RascalOptions &rascalOptions, const SearchResultCallback &callback, const SynthonSpaceSearchParams &params=SynthonSpaceSearchParams())
void | readTextFile (const std::string &inFilename, bool &cancelled)
void | readStream (std::istream &is, bool &cancelled)
void | writeDBFile (const std::string &outFilename) const
void | readDBFile (const std::string &inFilename, int numThreads=1)
void | summarise (std::ostream &os)
void | writeEnumeratedFile (const std::string &outFilename) const
void | enumerateToStream (std::ostream &os) const
void | buildSynthonFingerprints (const FingerprintGenerator< std::uint64_t > &fpGen)

## Protected Member Functions
unsigned int | getMaxNumSynthons () const
unsigned int | getMaxNumConnectors () const
bool | hasFingerprints () const
bool | hasAddAndSubstractFingerprints () const
bool | getHasRingFormer () const
Synthon * | addSynthonToPool (const std::string &smiles)
std::shared_ptr< SynthonSet > | addReactionToPool (const std::string &reactionName)
Synthon * | getSynthonFromPool (const std::string &smiles) const

## Friends
class | SynthonSet
class | SynthonSpaceSearcher
class | SynthonSpaceFingerprintSearcher
class | SynthonSpaceRascalSearcher
class | SynthonSpaceSubstructureSearcher

## Detailed Description

Definition at line 134 of file SynthonSpace.h.

## Constructor & Destructor Documentation

## ◆ SynthonSpace() [1/2]

RDKit::SynthonSpaceSearch::SynthonSpace::SynthonSpace | ( |  | ) |
| explicitdefault

Referenced by operator=(), and SynthonSpace().

## ◆ ~SynthonSpace()

RDKit::SynthonSpaceSearch::SynthonSpace::~SynthonSpace | ( |  | ) |
| default

## ◆ SynthonSpace() [2/2]

RDKit::SynthonSpaceSearch::SynthonSpace::SynthonSpace | ( | const SynthonSpace & | other | ) |
| delete

References SynthonSpace().

## Member Function Documentation

## ◆ addReactionToPool()

std::shared_ptr< SynthonSet > RDKit::SynthonSpaceSearch::SynthonSpace::addReactionToPool | ( | const std::string & | reactionName | ) |
| protected

## ◆ addSynthonToPool()

Synthon * RDKit::SynthonSpaceSearch::SynthonSpace::addSynthonToPool | ( | const std::string & | smiles | ) |
| protected

## ◆ buildSynthonFingerprints()

void RDKit::SynthonSpaceSearch::SynthonSpace::buildSynthonFingerprints | ( | const FingerprintGenerator< std::uint64_t > & | fpGen | ) |

Create the fingerprints for the synthons ready for fingerprint searches. Will be done by the fingerprint search if not done ahead of time.

Parameters

  fpGen | a fingerprint generator of the appropriate type

## ◆ enumerateToStream()

void RDKit::SynthonSpaceSearch::SynthonSpace::enumerateToStream | ( | std::ostream & | os | ) | const

## ◆ fingerprintSearch() [1/2]

void RDKit::SynthonSpaceSearch::SynthonSpace::fingerprintSearch | ( | const ROMol & | query,
|  | const FingerprintGenerator< std::uint64_t > & | fpGen,
|  | const SearchResultCallback & | callback,
|  | const SynthonSpaceSearchParams & | params = SynthonSpaceSearchParams() )

Perform a fingerprint similarity search with the given query molecule across the synthonspace library. Duplicate SMILES strings produced by different reactions will be returned. Search results are returned incrementally through the provided callback, which will receive at most `toTryChunkSize` sized lists of ROMols at a time, thereby reducing the amount of memory required to hold search results.

Parameters

  query | : query molecule
  fpGen | a FingerprintGenerator object that will provide the fingerprints for the similarity calculation
  callback | user-provided callback receiving chunks of ROMols.
  params | : (optional) settings for the search

## ◆ fingerprintSearch() [2/2]

SearchResults RDKit::SynthonSpaceSearch::SynthonSpace::fingerprintSearch | ( | const ROMol & | query,
|  | const FingerprintGenerator< std::uint64_t > & | fpGen,
|  | const SynthonSpaceSearchParams & | params = SynthonSpaceSearchParams() )

Perform a fingerprint similarity search with the given query molecule across the synthonspace library. Duplicate SMILES strings produced by different reactions will be returned.

Parameters

  query | : query molecule
  fpGen | a FingerprintGenerator object that will provide the fingerprints for the similarity calculation
  params | : (optional) settings for the search

Returns
  : the hits as a SearchResults object.

## ◆ getFPSize()

unsigned int RDKit::SynthonSpaceSearch::SynthonSpace::getFPSize | ( |  | ) | const

## ◆ getHasRingFormer()

bool RDKit::SynthonSpaceSearch::SynthonSpace::getHasRingFormer | ( |  | ) | const
| inlineprotected

Definition at line 389 of file SynthonSpace.h.

## ◆ getInputFileName()

std::string RDKit::SynthonSpaceSearch::SynthonSpace::getInputFileName | ( |  | ) | const

## ◆ getMaxNumConnectors()

unsigned int RDKit::SynthonSpaceSearch::SynthonSpace::getMaxNumConnectors | ( |  | ) | const
| protected

## ◆ getMaxNumSynthons()

unsigned int RDKit::SynthonSpaceSearch::SynthonSpace::getMaxNumSynthons | ( |  | ) | const
| inlineprotected

Definition at line 383 of file SynthonSpace.h.

## ◆ getNumProducts()

std::uint64_t RDKit::SynthonSpaceSearch::SynthonSpace::getNumProducts | ( |  | ) | const

Get the total number of products that the SynthonSpace could produce.

Returns
  std::int64_t

## ◆ getNumReactions()

size_t RDKit::SynthonSpaceSearch::SynthonSpace::getNumReactions | ( |  | ) | const

Get the number of different reactions in the SynthonSpace.

Returns
  int

## ◆ getPatternFPSize()

unsigned int RDKit::SynthonSpaceSearch::SynthonSpace::getPatternFPSize | ( |  | ) | const

## ◆ getReaction()

const std::shared_ptr< SynthonSet > RDKit::SynthonSpaceSearch::SynthonSpace::getReaction | ( | std::string | reactionName | ) |

## ◆ getReactionNames()

std::vector< std::string > RDKit::SynthonSpaceSearch::SynthonSpace::getReactionNames | ( |  | ) | const

Get a list of the names of all the reactions in the SynthonSpace.

Returns

## ◆ getSynthonFingerprintType()

std::string RDKit::SynthonSpaceSearch::SynthonSpace::getSynthonFingerprintType | ( |  | ) | const
| inline

Get the info string for the fingerprint generator used to generate the stored fingerprints, so the user can query with the same type.

Returns

Definition at line 182 of file SynthonSpace.h.

## ◆ getSynthonFromPool()

Synthon * RDKit::SynthonSpaceSearch::SynthonSpace::getSynthonFromPool | ( | const std::string & | smiles | ) | const
| protected

## ◆ hasAddAndSubstractFingerprints()

bool RDKit::SynthonSpaceSearch::SynthonSpace::hasAddAndSubstractFingerprints | ( |  | ) | const
| protected

## ◆ hasFingerprints()

bool RDKit::SynthonSpaceSearch::SynthonSpace::hasFingerprints | ( |  | ) | const
| protected

## ◆ operator=()

SynthonSpace & RDKit::SynthonSpaceSearch::SynthonSpace::operator= | ( | const SynthonSpace & | other | ) |
| delete

References SynthonSpace().

## ◆ rascalSearch() [1/2]

void RDKit::SynthonSpaceSearch::SynthonSpace::rascalSearch | ( | const ROMol & | query,
|  | const RascalMCES::RascalOptions & | rascalOptions,
|  | const SearchResultCallback & | callback,
|  | const SynthonSpaceSearchParams & | params = SynthonSpaceSearchParams() )

## ◆ rascalSearch() [2/2]

SearchResults RDKit::SynthonSpaceSearch::SynthonSpace::rascalSearch | ( | const ROMol & | query,
|  | const RascalMCES::RascalOptions & | rascalOptions,
|  | const SynthonSpaceSearchParams & | params = SynthonSpaceSearchParams() )

Parameters

  query | : query molecule
  rascalOptions | RASCAL options. The similarityThreshold value in the rascalOptions will be used rather than params.similarityCutoff, but params.fragSimilarityAdjuster will be used to adjust the threshold for the fragment comparisons.
  params | : (optional) settings for the search

Returns
  : the hits as a SearchResults object.

## ◆ readDBFile()

void RDKit::SynthonSpaceSearch::SynthonSpace::readDBFile | ( | const std::string & | inFilename,
|  | int | numThreads = 1 )

Reads from a binary DB File in our format.

Parameters

  inFilename | the name of the file to read.
  numThreads | number of threads to use in reading. If negative, adds the number to the number of hardware threads available.

## ◆ readStream()

void RDKit::SynthonSpaceSearch::SynthonSpace::readStream | ( | std::istream & | is,
|  | bool & | cancelled )

## ◆ readTextFile()

void RDKit::SynthonSpaceSearch::SynthonSpace::readTextFile | ( | const std::string & | inFilename,
|  | bool & | cancelled )

Parameters

  inFilename | name of the file containing the synthon-based library.

The original format is: all lines are tab-separated first line:SMILES synton_id synton# reaction_id Note the spelling "synton" from the original paper/example file. Subsequent lines have a single reagent e.g. OCC([U])=NN=[Np] 1-1 0 triazole-1 C1CCCC1N([Pu])[U] 2-1 1 triazole-1 CC1CCN(C1)C(=[Np])[Pu] 3-1 2 triazole-1

Other acceptable formats are as above, but with a 5th column "release": SMILES synton_id synton# reaction_id release

or a comma-separated equivalent of the first format: SMILES,synton_id,synton_role,reaction_id but with the 3rd column named differently but with the same meaning. The formatting of the first 2 formats has been relaxed such that any whitespace may be used as the field separator, but a tab is tried first so that a tab-separated file may have spaces in the columns.

Attachment points are U, Np, Pu and Am for up to 4 synthons per reaction. A product is created by taking a synthon from each synton# value and combining by replacing matching trans-uranic elements and replacing them with a direct bond of the appropriate type. A more (for RDKit) conventional connection flag of isotope labelled dummy atoms is also accepted ([1*] etc.). Throws a std::runtime_error if it doesn't think the format is correct, which it does by checking that the first line is as above and subsequent lines have appropriate number of fields. If it receives a SIGINT, returns cancelled=true.

## ◆ substructureSearch() [1/3]

SearchResults RDKit::SynthonSpaceSearch::SynthonSpace::substructureSearch | ( | const GeneralizedSubstruct::ExtendedQueryMol & | query,
|  | const SubstructMatchParameters & | matchParams = SubstructMatchParameters(),
|  | const SynthonSpaceSearchParams & | params = SynthonSpaceSearchParams() )

Perform a substructure search with the given generalized query molecule across the synthonspace library. Duplicate SMILES strings produced by different reactions will be returned.

Parameters

  query | : query molecule
  params | : (optional) settings for the search

Returns
  : the hits as a SearchResults object.

## ◆ substructureSearch() [2/3]

void RDKit::SynthonSpaceSearch::SynthonSpace::substructureSearch | ( | const ROMol & | query,
|  | const SearchResultCallback & | callback,
|  | const SubstructMatchParameters & | matchParams = SubstructMatchParameters(),
|  | const SynthonSpaceSearchParams & | params = SynthonSpaceSearchParams() )

Perform a substructure search with the given query molecule across the synthonspace library. Duplicate SMILES strings produced by different reactions will be returned. Search results are returned incrementally through the provided callback, which will receive at most `toTryChunkSize` sized lists of ROMols at a time, thereby reducing the amount of memory required to hold search results.

Parameters

  query | : query molecule
  callback | user-provided callback receiving chunks of ROMols.
  params | : (optional) settings for the search

## ◆ substructureSearch() [3/3]

SearchResults RDKit::SynthonSpaceSearch::SynthonSpace::substructureSearch | ( | const ROMol & | query,
|  | const SubstructMatchParameters & | matchParams = SubstructMatchParameters(),
|  | const SynthonSpaceSearchParams & | params = SynthonSpaceSearchParams() )

Perform a substructure search with the given query molecule across the synthonspace library. Duplicate SMILES strings produced by different reactions will be returned.

Parameters

  query | : query molecule
  params | : (optional) settings for the search

Returns
  : the hits as a SearchResults object.

## ◆ summarise()

void RDKit::SynthonSpaceSearch::SynthonSpace::summarise | ( | std::ostream & | os | ) |

Write a summary of the SynthonSpace to given stream.

Parameters

  os | stream

## ◆ writeDBFile()

void RDKit::SynthonSpaceSearch::SynthonSpace::writeDBFile | ( | const std::string & | outFilename | ) | const

Writes to a binary DB File in our format.

Parameters

  outFilename | the name of the file to write.

## ◆ writeEnumeratedFile()

void RDKit::SynthonSpaceSearch::SynthonSpace::writeEnumeratedFile | ( | const std::string & | outFilename | ) | const

Writes the enumerated library to file in SMILES format (1 compound per line, SMILES name)

Parameters

  outFilename | name of the file to write

## Friends And Related Symbol Documentation

## ◆ SynthonSet

friend class SynthonSet
| friend

Definition at line 135 of file SynthonSpace.h.

References SynthonSet.

Referenced by SynthonSet.

## ◆ SynthonSpaceFingerprintSearcher

friend class SynthonSpaceFingerprintSearcher
| friend

Definition at line 137 of file SynthonSpace.h.

References SynthonSpaceFingerprintSearcher.

Referenced by SynthonSpaceFingerprintSearcher.

## ◆ SynthonSpaceRascalSearcher

friend class SynthonSpaceRascalSearcher
| friend

Definition at line 138 of file SynthonSpace.h.

References SynthonSpaceRascalSearcher.

Referenced by SynthonSpaceRascalSearcher.

## ◆ SynthonSpaceSearcher

friend class SynthonSpaceSearcher
| friend

Definition at line 136 of file SynthonSpace.h.

References SynthonSpaceSearcher.

Referenced by SynthonSpaceSearcher.

## ◆ SynthonSpaceSubstructureSearcher

friend class SynthonSpaceSubstructureSearcher
| friend

Definition at line 139 of file SynthonSpace.h.

References SynthonSpaceSubstructureSearcher.

Referenced by SynthonSpaceSubstructureSearcher.

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

- SynthonSpace.h