rdkit.Chem.rdGaussianShape module¶
Module containing implementation of Gaussian-based shape overlay and scoring.NOTE: This functionality is experimental and the API and/or results may change in future releases.
- rdkit.Chem.rdGaussianShape.AlignMol((rdkit.Chem.rdchem.Mol)ref, (rdkit.Chem.rdchem.Mol)fit[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)refOpts=None[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)fitOpts=None[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)overlayOpts=None[, (int)refConfId=-1[, (int)fitConfId=-1]]]]]) tuple :¶
Aligns a fit molecule onto a reference molecule. The fit is modified.
- ref: RDKit.ROMol
Reference molecule
- fit: RDKit.ROMol
Fit molecule that will be overlaid
- refOpts: ShapeInputOptions, optional
Options for building the ref shape
- fitOpts: ShapeInputOptions, optional
Options for building the fit shape
- overlayOpts: ShapeOverlayOptions, optional
Options for controlling the overlay
- refConfIdint, optional
Reference conformer ID (default is -1)
- fitConfIdint, optional
fit conformer ID (default is -1)
- 3-tuple of floats
The results are (combo_score, shape_score, color_score). The color_score is 0.0 if color features not used, in which case combo_score and shape_score will be the same.
- C++ signature :
boost::python::tuple AlignMol(RDKit::ROMol,RDKit::ROMol {lvalue} [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,int=-1 [,int=-1]]]]])
- AlignMol( (ShapeInput)refShape, (rdkit.Chem.rdchem.Mol)fit [, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)fitOpts=None [, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)overlayOpts=None [, (int)fitConfId=-1]]]) -> tuple :
Aligns a fit molecule onto a reference shape. The fit is modified.
- refShape: ShapeInput
Reference shape
- fit: RDKit.ROMol
Fit molecule that will be overlaid
- fitOpts: ShapeInputOptions, optional
Options for building the fit shape
- overlayOpts: ShapeOverlayOptions, optional
Options for controlling the overlay
- fitConfIdint, optional
Fit conformer ID (default is -1)
- 3-tuple of floats
The results are (combo_score, shape_score, color_score). The color_score is 0.0 if color features not used, in which case combo_score and shape_score will be the same.
- C++ signature :
boost::python::tuple AlignMol(RDKit::GaussianShape::ShapeInput,RDKit::ROMol {lvalue} [,boost::python::api::object=None [,boost::python::api::object=None [,int=-1]]])
- rdkit.Chem.rdGaussianShape.AlignShapes((ShapeInput)refShape, (ShapeInput)fitShape[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)overlayOpts=None]) tuple :¶
Aligns a fit shape to a reference shape. The fit is modified.
- Parameters:
refShape (ShapeInput) – Reference shape
fitShape (ShapeInput) – fit shape
overlayOpts (ShapeOverlayOptions, optional) – Options for controlling the overlay
- Returns:
The results are (combo_score, shape_score, color_score, matrix) The matrix is a 16-float list giving the transformation matrix that overlays the fit onto the reference.
- Return type:
4-tuple of float, float, list of floats
- C++ signature :
boost::python::tuple AlignShapes(RDKit::GaussianShape::ShapeInput,RDKit::GaussianShape::ShapeInput {lvalue} [,boost::python::api::object=None])
- class rdkit.Chem.rdGaussianShape.OptimMode¶
Bases:
enum- SHAPE_ONLY = rdkit.Chem.rdGaussianShape.OptimMode.SHAPE_ONLY¶
- SHAPE_PLUS_COLOR = rdkit.Chem.rdGaussianShape.OptimMode.SHAPE_PLUS_COLOR¶
- SHAPE_PLUS_COLOR_SCORE = rdkit.Chem.rdGaussianShape.OptimMode.SHAPE_PLUS_COLOR_SCORE¶
- names = {'SHAPE_ONLY': rdkit.Chem.rdGaussianShape.OptimMode.SHAPE_ONLY, 'SHAPE_PLUS_COLOR': rdkit.Chem.rdGaussianShape.OptimMode.SHAPE_PLUS_COLOR, 'SHAPE_PLUS_COLOR_SCORE': rdkit.Chem.rdGaussianShape.OptimMode.SHAPE_PLUS_COLOR_SCORE}¶
- values = {0: rdkit.Chem.rdGaussianShape.OptimMode.SHAPE_ONLY, 1: rdkit.Chem.rdGaussianShape.OptimMode.SHAPE_PLUS_COLOR_SCORE, 2: rdkit.Chem.rdGaussianShape.OptimMode.SHAPE_PLUS_COLOR}¶
- rdkit.Chem.rdGaussianShape.ScoreMol((rdkit.Chem.rdchem.Mol)ref, (rdkit.Chem.rdchem.Mol)fit[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)refOpts=None[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)fitOpts=None[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)overlayOpts=None[, (int)refConfId=-1[, (int)fitConfId=-1]]]]]) tuple :¶
- Calculates the scores between a reference molecule and a fit
molecule without overlay.
- ref: RDKit.ROMol
Reference molecule
- fit: RDKit.ROMol
Fit molecule that will be scored
- refOpts: ShapeInputOptions, optional
Options for building the ref shape
- fitOpts: ShapeInputOptions, optional
Options for building the fit shape
- overlayOpts: ShapeOverlayOptions, optional
Options for controlling the volume calculation
- refConfIdint, optional
Reference conformer ID (default is -1)
- fitConfIdint, optional
fit conformer ID (default is -1)
- 3-tuple of floats
The results are (combo_score, shape_score, color_score). The color_score is 0.0 if color features not used, in which case combo_score and shape_score will be the same.
- C++ signature :
boost::python::tuple ScoreMol(RDKit::ROMol,RDKit::ROMol [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,int=-1 [,int=-1]]]]])
- ScoreMol( (ShapeInput)refShape, (rdkit.Chem.rdchem.Mol)fit [, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)fitOpts=None [, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)overlayOpts=None [, (int)fitConfId=-1]]]) -> tuple :
Calculates the scores between a reference shape and a fit molecule without overlay.
- refShape: ShapeInput
Reference shape
- fit: RDKit.ROMol
Fit molecule that will be scored
- fitOpts: ShapeInputOptions, optional
Options for building the fit shape
- overlayOpts: ShapeOverlayOptions, optional
Options for controlling the volume calculation
- fitConfIdint, optional
fit conformer ID (default is -1)
- 3-tuple of floats
The results are (combo_score, shape_score, color_score). The color_score is 0.0 if color features not used, in which case combo_score and shape_score will be the same.
- C++ signature :
boost::python::tuple ScoreMol(RDKit::GaussianShape::ShapeInput,RDKit::ROMol [,boost::python::api::object=None [,boost::python::api::object=None [,int=-1]]])
- rdkit.Chem.rdGaussianShape.ScoreMoleculeAllConformers((rdkit.Chem.rdchem.Mol)ref, (rdkit.Chem.rdchem.Mol)fit[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)refOpts=None[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)fitOpts=None[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)overlayOpts=None]]]) tuple :¶
- Calculate the scores for the alignment of all conformers
of the fit molecule onto the reference. The molecules themselves are not altered.
- Parameters:
ref (RDKit.ROMol) – Reference molecule
fit (RDKit.ROMol) – Fit molecule that will be scored
refOpts (ShapeInputOptions, optional) – Options for building the ref shape
fitOpts (ShapeInputOptions, optional) – Options for building the fit shape
overlayOpts (ShapeOverlayOptions, optional) – Options for controlling the volume calculation
- Returns:
A tuple of tuples containing the scores from aligning the fit conformations onto the reference conformations. scores[0][1] is the score of aligning fit conformation 1 onto ref conformation 0. The ID of the ref conformer from the best-scoring alignment The ID of the fit conformer from the best-scoring alignment The transformation that gives the best-scoring alignment for those conformers as a 16-float tuple.
- Return type:
A complex tuple containing
- C++ signature :
boost::python::tuple ScoreMoleculeAllConformers(RDKit::ROMol,RDKit::ROMol [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None]]])
- rdkit.Chem.rdGaussianShape.ScoreShape((ShapeInput)refShape, (ShapeInput)fitShape[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)overlayOpts=None]) tuple :¶
Calculates the scores between a reference shape and a fit shape without overlay.
- Parameters:
refShape (ShapeInput) – Reference shape
fitShape (ShapeInput) – Fit shape
fitOpts (ShapeInputOptions, optional) – Options for building the fit shape
overlayOpts (ShapeOverlayOptions, optional) – Options for controlling the volume calculation
- Returns:
The results are (combo_score, shape_score, color_score). The color_score is 0.0 if color features not used, in which case combo_score and shape_score will be the same.
- Return type:
3-tuple of floats
- C++ signature :
boost::python::tuple ScoreShape(RDKit::GaussianShape::ShapeInput,RDKit::GaussianShape::ShapeInput [,boost::python::api::object=None])
- class rdkit.Chem.rdGaussianShape.ShapeInput((object)arg1, (rdkit.Chem.rdchem.Mol)self, (int)confId, (ShapeInputOptions)shapeOpt, (ShapeOverlayOptions)overlayOpts) None :¶
Bases:
instanceShapeInput object
- C++ signature :
void __init__(_object*,RDKit::ROMol,int,RDKit::GaussianShape::ShapeInputOptions,RDKit::GaussianShape::ShapeOverlayOptions)
- BestSimilarity((ShapeInput)self, (ShapeInput)fitShape[, (float)threshold=-1.0[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)overlayOpts=None]]) tuple :¶
Find the best similarity score between all shapes in this shape and the other one. Stops as soon as it gets something above the threshold. The score runs between 0.0 and 1.0, so the default threshold of -1.0 means no threshold. Fills in the shape numbers of the two that were responsible if there is something above the threshold, and the transformation that did it. Returns a tuple of the similarity scores ((-1.0, -1.0, -1.0) if there was nothing above the threshold), the number of the shape for this object and the shape number of the fitShape that gave the best similarity and the transformation matrix (as a list of 16 floats) that will reproduce the best overlay. The shapes won’t necessarily be left in the state that gave the best similarity. Note that the shape numbers are not necessarily the same as the original molecule conformation numbers.
- C++ signature :
boost::python::tuple BestSimilarity(RDKit::GaussianShape::ShapeInput {lvalue},RDKit::GaussianShape::ShapeInput [,double=-1.0 [,boost::python::api::object=None]])
- property ColorVolume¶
Get the volume of the shape’s color features for the active shap.
- property GetSmiles¶
Get the SMILES string for the molecule that the shape relates to.
- MaxPossibleSimilarity((ShapeInput)self, (ShapeInput)fitShape[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)overlayOpts=None]) float :¶
Get the maximum possible similarity score between all shapes in this shape and all shapes in the fitShape. The maximum similarity is when one shape is entirely inside the other. This returns the similarity in that case, which is the upper bound on what is achievable between these 2 shapes.
- C++ signature :
double MaxPossibleSimilarity(RDKit::GaussianShape::ShapeInput {lvalue},RDKit::GaussianShape::ShapeInput {lvalue} [,boost::python::api::object=None])
- NormalizeCoords((ShapeInput)arg1) None :¶
Align the principal axes to the cartesian axes and centre on the origin. Doesn’t require that the shape was created from a molecule. Creates the necessary transformation if not already done.
- C++ signature :
void NormalizeCoords(RDKit::GaussianShape::ShapeInput {lvalue})
- property NumAtoms¶
Get the number of atoms defining the shape.
- property NumFeatures¶
Get the number of features in the shape.
- property NumShapes¶
Get the number of shapes. There will be a shape for each conformation of the input molecule, unless shape pruning was carried out in which case there may be fewer.
- ShapeToMol((ShapeInput)self[, (bool)includeColors=False[, (bool)withBonds=True]]) rdkit.Chem.rdchem.Mol :¶
Return a molecule with coordinates of the current active shape. If includeColors is True, (default is False) the color features will be added as xenon atoms. If withBonds is True (the default) a molecule with bonds will be created, if not then just atoms at the appropriate positions will be produced.
- C++ signature :
RDKit::ROMol* ShapeToMol(RDKit::GaussianShape::ShapeInput {lvalue} [,bool=False [,bool=True]])
- property ShapeVolume¶
Get the volume due to the atoms for the active shape.
- property getActiveShape¶
Return the number of the active shape.
- property setActiveShape¶
Set the active shape, the one that will be used for overlays etc.
- class rdkit.Chem.rdGaussianShape.ShapeInputOptions((object)arg1) None :¶
Bases:
instanceShapeInputOptions - options for setting up ShapeInput objects.
- C++ signature :
void __init__(_object*)
- property allCarbonRadii¶
Whether to use the same radius, appropriate for Carbon, for all atoms. There is a slight accuracy penalty but significant speed gain if used. Default=True.
- property atomRadii¶
Non-standard radii to use for the atoms specified by their indices in the molecule. Not all atoms need have a radius specified. A list of tuples of [int, float].
- property atomSubset¶
If not empty, use just these atoms in the molecule to form the ShapeInput object.
- property customFeatures¶
Custom features for the shape. Requires a list of lists of tuples of int (the feature type), Point3D (the coordinates), float (the radius) and optionally a list of indices of the atoms that the feature was derived from.
- property includeDummies¶
Whether to include dummy atoms in the shape or not. Default=True.
- property shapePruneThreshold¶
If there is more than 1 conformer for the input molecule, prune the shapes so that none of them are more similar to each other than the threshold. Default -1.0 means no pruning.
- property sortShapes¶
If True (the default), the shapes are sorted into descending order of total volume.
- property useColors¶
Whether to use color features in overlay. Default=True.
- class rdkit.Chem.rdGaussianShape.ShapeOverlayOptions((object)arg1) None :¶
Bases:
instanceShapeOverlayOptions - options for controlling the shape overlay process.
- C++ signature :
void __init__(_object*)
- property distCutoff¶
If using a distance cutoff, this is the value used. Default=4.5 of whatever units the coordinates are in.
- property nSteps¶
Maximum number of steps for the shape overlay process. Default=100.
- property normalize¶
Whether to normalize the shapes before overlay by putting them into their canonical orientation (centred on the origin, aligned along its principal axes. Default=True.
- property optParam¶
If using colors, the relative weights of the shape and color scores, as a fraction of 1. Default=0.5.
- property optimMode¶
Optimisation mode, controlling what parameters are used to drive the overlay. Default=SHAPE_PLUS_COLOR_SCORE which optimises using just the overlap of shape, but uses the color to decide which is the best overlay. Other options are SHAPE_ONLY and SHAPE_AND_COLOR with the latter using the overlap of color features as well.
- property shapeConvergenceCriterion¶
Optimisation stops when the shape Tversky score changes by less than this amount after an optimisation step. A larger number is faster but gives less precise overlays. Default=0.001.
- property simAlpha¶
When doing a Tversky similarity, the alpha value. If alpha and beta are both the default 1.0, it’s a Tanimoto similarity. A high alpha and low beta emphasize the fit volume in the similarity and vice versa. Tversky is O / (A * (R - O) + B * (F - O) + O) where O is the overlap volume, R is the reference’s volume and F is the fit’s volume. This is different from that used by OpenEye (O / (A * R + B * F)).
- property simBeta¶
When doing a Tversky similarity, the beta value.
- property startMode¶
Start modes for optimisation. Default is A_LA_PUBCHEM - as used by the PubChem code - either ROTATE_180_WIGGLE or ROTATE_45 depending on the shape of the two molecules. ROTATE_180_WIGGLE means 180 rotations about the x, y and z axes, then a small rotation about each axis from that point, using the best scoring one of those. ROTATE_180 uses 180 degree rotations for 4 start points, ROTATE_45 uses 45 degree rotations for 9 start points and ROTATE_0 leaves the relative orientations of the 2 molecules as passed in before optimisation. There are also ROTATE_0_FRAGMENT, ROTATE_45_FRAGMENT and ROTATE_180_FRAGMENT that as well as the above move the fit molecule to the ends of each of the principal axes and then does the appropriate rotations. This is useful when the fit molecule is a lot smaller than the reference molecule, but requires a large number of optimisations so is relatively slow.
- property useDistCutoff¶
Whether to use distance cutoff when calculating the shape volumes. If used, there will be a small penalty in accuracy but a significant increase in speed. Default=True.
- class rdkit.Chem.rdGaussianShape.StartMode¶
Bases:
enum- A_LA_PUBCHEM = rdkit.Chem.rdGaussianShape.StartMode.A_LA_PUBCHEM¶
- ROTATE_0 = rdkit.Chem.rdGaussianShape.StartMode.ROTATE_0¶
- ROTATE_0_FRAGMENT = rdkit.Chem.rdGaussianShape.StartMode.ROTATE_0_FRAGMENT¶
- ROTATE_180 = rdkit.Chem.rdGaussianShape.StartMode.ROTATE_180¶
- ROTATE_180_FRAGMENT = rdkit.Chem.rdGaussianShape.StartMode.ROTATE_180_FRAGMENT¶
- ROTATE_180_WIGGLE = rdkit.Chem.rdGaussianShape.StartMode.ROTATE_180_WIGGLE¶
- ROTATE_45 = rdkit.Chem.rdGaussianShape.StartMode.ROTATE_45¶
- ROTATE_45_FRAGMENT = rdkit.Chem.rdGaussianShape.StartMode.ROTATE_45_FRAGMENT¶
- names = {'A_LA_PUBCHEM': rdkit.Chem.rdGaussianShape.StartMode.A_LA_PUBCHEM, 'ROTATE_0': rdkit.Chem.rdGaussianShape.StartMode.ROTATE_0, 'ROTATE_0_FRAGMENT': rdkit.Chem.rdGaussianShape.StartMode.ROTATE_0_FRAGMENT, 'ROTATE_180': rdkit.Chem.rdGaussianShape.StartMode.ROTATE_180, 'ROTATE_180_FRAGMENT': rdkit.Chem.rdGaussianShape.StartMode.ROTATE_180_FRAGMENT, 'ROTATE_180_WIGGLE': rdkit.Chem.rdGaussianShape.StartMode.ROTATE_180_WIGGLE, 'ROTATE_45': rdkit.Chem.rdGaussianShape.StartMode.ROTATE_45, 'ROTATE_45_FRAGMENT': rdkit.Chem.rdGaussianShape.StartMode.ROTATE_45_FRAGMENT}¶
- values = {0: rdkit.Chem.rdGaussianShape.StartMode.ROTATE_0, 1: rdkit.Chem.rdGaussianShape.StartMode.ROTATE_180, 2: rdkit.Chem.rdGaussianShape.StartMode.ROTATE_180_WIGGLE, 3: rdkit.Chem.rdGaussianShape.StartMode.ROTATE_45, 4: rdkit.Chem.rdGaussianShape.StartMode.ROTATE_0_FRAGMENT, 5: rdkit.Chem.rdGaussianShape.StartMode.ROTATE_180_FRAGMENT, 6: rdkit.Chem.rdGaussianShape.StartMode.ROTATE_45_FRAGMENT, 7: rdkit.Chem.rdGaussianShape.StartMode.A_LA_PUBCHEM}¶