rdkit.Chem.rdSynthonSpaceSearch module

Module containing implementation of SynthonSpace search of Synthon-based chemical libraries such as Enamine REAL. NOTE: This functionality is experimental and the API and/or results may change in future releases.

rdkit.Chem.rdSynthonSpaceSearch.ConvertTextToDBFile((str)inFilename, (str)outFilename[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)fpGen=None[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)py_shapeParams=None]]) → None :

Convert the text file into the binary DB file in our format. Assumes that all synthons from a reaction are contiguous in the input file. This uses a lot less memory than using ReadTextFile() followed by WriteDBFile().- inFilename the name of the text file- outFilename the name of the binary file- optional fingerprint generator

C++ signature :

void ConvertTextToDBFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > [,boost::python::api::object=None [,boost::python::api::object=None]])

rdkit.Chem.rdSynthonSpaceSearch.FormattedIntegerString((int)value) → str :

Format an integer with spaces every 3 digits for ease of reading

C++ signature :

std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > FormattedIntegerString(long)

class rdkit.Chem.rdSynthonSpaceSearch.ShapeBuildParams((object)arg1) → None :

Bases: instance

Parameters for building shape objects for SynthonSpaceSearch.

C++ signature :

void __init__(_object*)

property interimFile

Interim file to write the SynthonSpace to during shape generation. In the event of a failure, a restart from this file will be possible.

property interimWrites

If an interim file has been given, every this many shapes write a new version of the file. Default=1000.

property maxEmbedAttempts

Maximum number of attempts for embedding a single synthon. Default=10.

property maxSynthonAtoms

If >0, sets a maximum number of heavy atoms, excluding dummies, for synthon to have a shape made. Default=0.

property numConfs

Maximum number of conformers per synthon or query. Default=10

property numThreads

The number of threads to use for shape building. If > 0, will use that number. If <= 0, will use the number of hardware threads plus this number.Default=1.

property randomSeed

Seed for random number generator. Default=-1 means use system random seed.

property rmsThreshold

RMS threshold to use when pruning conformations. Default=1.0.

setUserConformerGenerator((ShapeBuildParams)self, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)func) → None :
Allows you to provide a function that will be called instead of the default

conformer generator to generate conformers for the synthons. The function should take a SMILES string and the maximum number of conformers to generated and return a molecule object.

C++ signature :

void setUserConformerGenerator(RDKit::SynthonSpaceSearch::ShapeBuildParams {lvalue},boost::python::api::object)

property shapeSimThreshold

When generating shapes, similarity threshold for pruning. No 2 shapes for each synthon or query will be more similar than this threshold. Default=1.9.

property stereoEnumOpts

Options for stereoisomer enumeration.

property timeOut

Maximum time in seconds to spend on each synthon when generating conformers. Default=600 means no timeout.

property useProgressBar

Makes a progress bar of given width. The number given is the number of ‘*’ characters in a full bar. There will be about another 35 characters or so depending on the size of the job. Default=0 means no bar.

class rdkit.Chem.rdSynthonSpaceSearch.SubstructureResult

Bases: instance

Used to return results of SynthonSpace searches.

Raises an exception This class cannot be instantiated from Python

GetBestHit((SubstructureResult)arg1) → rdkit.Chem.rdchem.Mol :

Returns the best hit found in the similarity search, even when none were under the search threshold. May be empty if not a similarity search or nothing came close to a match.

C++ signature :

boost::shared_ptr<RDKit::ROMol> GetBestHit(RDKit::SynthonSpaceSearch::SearchResults)

GetCancelled((SubstructureResult)arg1) → bool :

Returns whether the search was cancelled or not.

C++ signature :

bool GetCancelled(RDKit::SynthonSpaceSearch::SearchResults {lvalue})

GetHitMolecules((SubstructureResult)self) → list :

A function returning hits from the search

C++ signature :

boost::python::list GetHitMolecules(RDKit::SynthonSpaceSearch::SearchResults)

GetMaxNumResults((SubstructureResult)arg1) → int :

The upper bound on number of results possible. There may be fewer than this in practice for several reasons such as duplicate reagent sets being removed or the final product not matching the query even though the synthons suggested they would.

C++ signature :

unsigned long GetMaxNumResults(RDKit::SynthonSpaceSearch::SearchResults {lvalue})

GetTimedOut((SubstructureResult)arg1) → bool :

Returns whether the search timed out or not.

C++ signature :

bool GetTimedOut(RDKit::SynthonSpaceSearch::SearchResults {lvalue})

class rdkit.Chem.rdSynthonSpaceSearch.SynthonSpace((object)arg1) → None :

Bases: instance

SynthonSpaceSearch object.

C++ signature :

void __init__(_object*)

BuildSynthonFingerprints((SynthonSpace)self, (rdkit.Chem.rdFingerprintGenerator.FingerprintGenerator64)fingerprintGenerator[, (int)progressBarWidth=0]) → None :

Build the synthon fingerprints ready for similarity searching. This is done automatically when the first similarity search is done, but if converting a text file to binary format it might need to be done explicitly. If progressBarWidth is > 0, a progress bar of that width plus about 35 characters is displayed.

C++ signature :

void BuildSynthonFingerprints(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},RDKit::FingerprintGenerator<unsigned long> [,unsigned int=0])

BuildSynthonShapes((SynthonSpace)self[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)py_params=None]) → None :

Build shapes for the synthons. The conformations are generated, pruned with the given threshold, which is passed directly to EmbedMultipleConfs.

C++ signature :

void BuildSynthonShapes(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue} [,boost::python::api::object=None])

FingerprintSearch((SynthonSpace)self, (rdkit.Chem.rdchem.Mol)query, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)fingerprintGenerator[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)params=None]) → SubstructureResult :

Does a fingerprint search in the SynthonSpace using the FingerprintGenerator passed in.

C++ signature :

RDKit::SynthonSpaceSearch::SearchResults FingerprintSearch(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},RDKit::ROMol,boost::python::api::object [,boost::python::api::object=None])

FingerprintSearch( (SynthonSpace)self, (rdkit.Chem.rdchem.Mol)query, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)fingerprintGenerator, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)params, (int)startLine, (int)finishLine) -> SubstructureResult :

Take the contents of params.possibleHitsFile, which is assumed to have been written by an earlier search, and extract those that are indeed hits. It makes sense that params is the same as the one used to generate the possible hits, but this is not essential. You could search at a higher similarity threshold than used to create the possible hits, for example. Duplicate SMILES strings produced by different reactions will be returned.

C++ signature :

RDKit::SynthonSpaceSearch::SearchResults FingerprintSearch(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},RDKit::ROMol,boost::python::api::object,boost::python::api::object,int,int)

FingerprintSearchIncremental((SynthonSpace)self, (rdkit.Chem.rdchem.Mol)query, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)fingerprintGenerator, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)callback[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)params=None]) → None :

Does a fingerprint search in the SynthonSpace using the FingerprintGenerator passed in, returning results the callback.

C++ signature :

void FingerprintSearchIncremental(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},RDKit::ROMol,boost::python::api::object,boost::python::api::object [,boost::python::api::object=None])

GetNumProducts((SynthonSpace)self) → int :

Returns number of products in the SynthonSpace, with multiple counting of any duplicates.

C++ signature :

unsigned long GetNumProducts(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue})

GetNumReactions((SynthonSpace)self) → int :

Returns number of reactions in the SynthonSpace.

C++ signature :

unsigned long GetNumReactions(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue})

GetNumSynthons((SynthonSpace)self) → int :

Returns number of synthons in the SynthonSpace.

C++ signature :

unsigned long GetNumSynthons(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue})

GetNumSynthonsWithShapes((SynthonSpace)self) → int :

Returns the number of synthons in the SynthonSpace that have a shape.

C++ signature :

unsigned long GetNumSynthonsWithShapes(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue})

GetSynthonFingerprintType((SynthonSpace)self) → str :

Returns the information string for the fingerprint generator used to create this space.

C++ signature :

std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > GetSynthonFingerprintType(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue})

RascalSearch((SynthonSpace)self, (rdkit.Chem.rdchem.Mol)query, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)rascalOptions[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)params=None]) → SubstructureResult :

Does a search using the Rascal similarity score. The similarity threshold used is provided by rascalOptions, and the one in params is ignored.

C++ signature :

RDKit::SynthonSpaceSearch::SearchResults RascalSearch(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},RDKit::ROMol,boost::python::api::object [,boost::python::api::object=None])

RascalSearch( (SynthonSpace)self, (rdkit.Chem.rdchem.Mol)query, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)rascalOptions, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)params, (int)startLine, (int)finishLine) -> SubstructureResult :

Take the contents of params.possibleHitsFile, which is assumed to have been written by an earlier search, and extract those that are indeed hits. It makes sense that params is the same as the one used to generate the possible hits, but this is not essential. You could search at a higher similarity threshold than used to create the possible hits, for example. Duplicate SMILES strings produced by different reactions will be returned.

C++ signature :

RDKit::SynthonSpaceSearch::SearchResults RascalSearch(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},RDKit::ROMol,boost::python::api::object,boost::python::api::object,int,int)

RascalSearchIncremental((SynthonSpace)self, (rdkit.Chem.rdchem.Mol)query, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)rascalOptions, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)callback[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)params=None]) → None :

Does a search using the Rascal similarity score. The similarity threshold used is provided by rascalOptions, and the one in params is ignored. Returns results iteratively in the callback.

C++ signature :

void RascalSearchIncremental(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},RDKit::ROMol,boost::python::api::object,boost::python::api::object [,boost::python::api::object=None])

ReadDBFile((SynthonSpace)self, (str)inFile[, (int)numThreads=1]) → None :

Reads binary database file. Takes optional number of threads,default=1.

C++ signature :

void ReadDBFile(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > [,int=1])

ReadTextFile((SynthonSpace)self, (str)inFile) → None :

Reads text file of the sort used by ChemSpace/Enamine.

C++ signature :

void ReadTextFile(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)

ReportSynthonUsage((SynthonSpace)self) → None :

Writes a summary of the synthon usage in the SynthonSpace to stdout.

C++ signature :

void ReportSynthonUsage(RDKit::SynthonSpaceSearch::SynthonSpace)

ShapeSearch((SynthonSpace)self, (rdkit.Chem.rdchem.Mol)query[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)params=None]) → SubstructureResult :

Perform a shape similarity search with the given query molecule across the synthonspace library. Duplicate SMILES strings produced by different reactions will be returned. Requires a query with at least 1 3D conformer. Only the first conformer will be used in the search.

C++ signature :

RDKit::SynthonSpaceSearch::SearchResults ShapeSearch(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},RDKit::ROMol [,boost::python::api::object=None])

ShapeSearch( (SynthonSpace)self, (rdkit.Chem.rdchem.Mol)query, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)params, (int)startLine, (int)finishLine) -> SubstructureResult :

Take the contents of params.possibleHitsFile, which is assumed to have been written by an earlier search, and extract those that are indeed hits. It makes sense that params is the same as the one used to generate the possible hits, but this is not essential. You could search at a higher similarity threshold than used to create the possible hits, for example. Duplicate SMILES strings produced by different reactions will be returned. Requires a query with at least 1 3D conformer. Only the first conformer will be used in the search.

C++ signature :

RDKit::SynthonSpaceSearch::SearchResults ShapeSearch(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},RDKit::ROMol,boost::python::api::object,int,int)

SubstructureSearch((SynthonSpace)self, (rdkit.Chem.rdchem.Mol)query[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)substructMatchParams=None[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)params=None]]) → SubstructureResult :

Does a substructure search in the SynthonSpace.

C++ signature :

RDKit::SynthonSpaceSearch::SearchResults SubstructureSearch(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},RDKit::ROMol [,boost::python::api::object=None [,boost::python::api::object=None]])

SubstructureSearch( (SynthonSpace)self, (rdkit.Chem.rdGeneralizedSubstruct.ExtendedQueryMol)query [, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)substructMatchParams=None [, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)params=None]]) -> SubstructureResult :

Does a substructure search in the SynthonSpace using an extended query.

C++ signature :

RDKit::SynthonSpaceSearch::SearchResults SubstructureSearch(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},RDKit::GeneralizedSubstruct::ExtendedQueryMol [,boost::python::api::object=None [,boost::python::api::object=None]])

SubstructureSearch( (SynthonSpace)self, (rdkit.Chem.rdchem.Mol)query, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)substructMatchParams=None, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)params=None, (int)startLine, (int)finishLine) -> SubstructureResult :

Take the contents of params.possibleHitsFile, which is assumed to have been written by an earlier search, and extract those that are indeed hits. It makes sense that params is the same as the one used to generate the possible hits, but this is not essential. You could search at a higher similarity threshold than used to create the possible hits, for example.

C++ signature :

RDKit::SynthonSpaceSearch::SearchResults SubstructureSearch(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},RDKit::ROMol,boost::python::api::object=None,boost::python::api::object=None,int,int)

SubstructureSearch( (SynthonSpace)self, (rdkit.Chem.rdGeneralizedSubstruct.ExtendedQueryMol)query, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)substructMatchParams=None, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)params=None, (int)startLine, (int)finishLine) -> SubstructureResult :

Take the contents of params.possibleHitsFile, which is assumed to have been written by an earlier search, and extract those that are indeed hits. It makes sense that params is the same as the one used to generate the possible hits, but this is not essential. You could search at a higher similarity threshold than used to create the possible hits, for example.

C++ signature :

RDKit::SynthonSpaceSearch::SearchResults SubstructureSearch(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},RDKit::GeneralizedSubstruct::ExtendedQueryMol,boost::python::api::object=None,boost::python::api::object=None,int,int)

SubstructureSearchIncremental((SynthonSpace)self, (rdkit.Chem.rdchem.Mol)query, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)callback[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)substructMatchParams=None[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)params=None]]) → None :

Does a substructure search in the SynthonSpace returning results in the callback.

C++ signature :

void SubstructureSearchIncremental(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},RDKit::ROMol,boost::python::api::object [,boost::python::api::object=None [,boost::python::api::object=None]])

Summarise((SynthonSpace)self) → None :

Writes a summary of the SynthonSpace to stdout.

C++ signature :

void Summarise(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue})

WriteDBFile((SynthonSpace)self, (str)outFile) → None :

Writes binary database file.

C++ signature :

void WriteDBFile(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)

WriteEnumeratedFile((SynthonSpace)self, (str)outFile) → None :

Writes enumerated library to file.

C++ signature :

void WriteEnumeratedFile(RDKit::SynthonSpaceSearch::SynthonSpace {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)

class rdkit.Chem.rdSynthonSpaceSearch.SynthonSpaceSearchParams((object)arg1) → None :

Bases: instance

SynthonSpaceSearch parameters.

C++ signature :

void __init__(_object*)

property approxSimilarityAdjuster

The fingerprint search uses an approximate similarity method before building a product and doing a final check. The similarityCutoff is reduced by this value for the approximate check. A lower value will give faster run times at the risk of missing some hits. The value you use should have a positive correlation with your FOMO. The default of 0.1 is appropriate for Morgan fingerprints. With RDKit fingerprints, 0.05 is adequate, and higher than that has been seen to produce long run times.

property bestHit

If True, when doing a shape search it will return the hit conformer with the best shape match to the query conformer. If False, it just returns the first hit conformer that exceeds the similarity cutoff. The latter will be faster but the returned hit conformations are likely to be less relevant.

property buildHits

If false, reports the maximum number of hits that the search could produce, but doesn’t return them.

property confRMSThreshold

When doing a shape search, the RMS threshold to use when pruning conformers. Default=1.0.

property enumerateUnspecifiedStereo

When doing a shape search, if there is unspecified stereochemistry in either the query or potential hit, enumerate test all possibilities. Default=False.

property excludedVolume

Add an excluded volume to use in the shape search. The volume overlap and mean overlap over clashing atoms will be reported.

property fragSimilarityAdjuster

Similarities of fragments are generally low due to low bit densities. For the fragment matching, reduce the similarity cutoff off by this amount. Default=0.1.

property hitStart

The sequence number of the hit to start from. So that you can return the next N hits of a search having already obtained N-1. Default=0

property maxExcludedVolume

Maximum allowed excluded volume for a hit to be accepted. Default -1.0 means no maximum.

property maxHitChiralAtoms

Maximum number of chiral atoms in a hit. Default=-1 means no maximum.

property maxHitHeavyAtoms

Maximum number of heavy atoms in a hit. Default=-1 means no maximum.

property maxHitMolWt

Maximum molecular weight for a hit. Default=0.0 mean no maximum.

property maxHits

The maximum number of hits to return. Default=1000.Use -1 for no maximum.

property maxMeanExcludedVolume

Maximum mean excluded volume for a hit to be accepted. The mean is the total excluded volume divided by the number of clashing atoms (within 2 CARBON_RAD of an excluded volume atom). To try and distinguish between a mild clash over the whole hit and a few atoms having a really bad clash.

property maxNumFrags

The maximum number of fragments the query can be broken into. Big molecules will create huge numbers of fragments that may cause excessive memory use. If the number of fragments hits this number, fragmentation stops and the search results will likely be incomplete. Default=100000.

property maxPossibleHitsToWrite

Maximum number of lines to write to possibleHitsFile. When dealing with huge synthon spaces it’s very easy to fill a disk. Default=10M.

property minHitChiralAtoms

Minimum number of chiral atoms in a hit. Default=0.

property minHitHeavyAtoms

Minimum number of heavy atoms in a hit. Default=0.

property minHitMolWt

Minimum molecular weight for a hit. Default=0.0.

property numConformers

When doing a shape search, the number of conformers to generate for molecules. Default=100.

property numThreads

The number of threads to use for search. If > 0, will use that number. If <= 0, will use the number of hardware threads plus this number. So if the number of hardware threads is 8, and numThreads is -1, it will use 7 threads. Default=1.

property possibleHitsFile

Name of a file to save the possible hits to. These are the combinations of synthons that might match the query but need building and final checking. Each line has a space-separated list of the synthons and the hit’s name. The file will be emptied and re-filled if it already exists.

property randomSample

If True, returns a random sample of the hits, up to maxHits in number. Default=False.

property randomSeed

If using randomSample, this seeds the random number generator so as to give reproducible results. Default=-1 means use a random seed.

setUserConformerGenerator((SynthonSpaceSearchParams)self, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)func) → None :
Allows you to provide a function that will be called instead of the default

conformer generator to generate conformers for the synthons. The function should take a SMILES string and the maximum number of conformers to generated and return a molecule object.

C++ signature :

void setUserConformerGenerator(RDKit::SynthonSpaceSearch::SynthonSpaceSearchParams {lvalue},boost::python::api::object)

property shapeOverlayOptions

Options for the shape overlays.

property similarityCutoff

Similarity cutoff for returning hits by fingerprint similarity. At present the fp is hard-coded to be Morgan, bits, radius=2. Default=0.5.

property stereoEnumOpts

Options for stereoisomer enumeration.

property timeOut

Time limit for search, in seconds. Default is 600s, 0 means no timeout. Requires an integer

property toTryChunkSize

Process possible hits using the given chunk size

property useProgressBar

Makes a progress bar of given width. The number given is the number of ‘*’ characters in a full bar. There will be about another 35 characters or so depending on the size of the job. Default=0 means no bar.

property writePossibleHitsAndStop

If True, creates the possibleHitsFile and stops without doing the final building and checking. Default is False.