Cheminformatics Tutorials - Herong's Tutorial Examples - v2.01, by Herong Yang
RDKit m.HasSubstructMatch(s) - Substructure Match
This section provides a tutorial example on how to perform substructure match with the m.HasSubstructMatch(s) method in RDKit library.
If you want to perform a substructure match on a molecule, you can use the following methods offered in the rdkit.Chem.rdchem.Mol class.
b = m.HasSubstructMatch(s) - Queries whether or not the molecule contains a particular substructure.
i = m.GetSubstructMatch() - Returns the indices of the molecule’s atoms that match a substructure query.
Here is an example of using the HasSubstructMatch() method in a Jupyter Notebook:
from rdkit import Chem s = Chem.MolFromSmiles('c1nccc2n1ccc2') m1 = Chem.MolFromSmiles('O=C(O)c2cc1ccc(Cl)n1cn2') f1 = m1.HasSubstructMatch(s) m2 = Chem.MolFromSmiles('O=C(O)c2ccn1c(Cl)ccc1n2') f2 = m.HasSubstructMatch(s) display(s, f1, m1, f2, m2)
The output shows that:
Table of Contents
SMILES (Simplified Molecular-Input Line-Entry System)
Open Babel: The Open Source Chemistry Toolbox
Using Open Babel Command: "obabel"
Generating SVG Pictures with Open Babel
Substructure Search with Open Babel
Similarity Search with Open Babel
Fingerprint Index for Fastsearch with Open Babel
Stereochemistry with Open Babel
Command Line Tools Provided by Open Babel
RDKit: Open-Source Cheminformatics Software
rdkit.Chem.rdchem - The Core Module
rdkit.Chem.rdmolfiles - Molecular File Module
rdkit.Chem.rdDepictor - Compute 2D Coordinates
rdkit.Chem.Draw - Handle Molecule Images
►Molecule Substructure Search with RDKit
►RDKit m.HasSubstructMatch(s) - Substructure Match
RDKit GenerateDepictionMatching2DStructure(m, s) - Substructure Orientation
RDKit rdMolDraw2D.PrepareAndDrawMolecule - Substructure Highlight
RDKit Substructure Search with SMARTS
rdkit.Chem.rdFMCS - Maximum Common Substructure
rdkit.Chem.rdSubstructLibrary - Substructure Library
Substructure Library in Binary and SMILES Formats
rdkit.Chem.rdmolops - Molecule Operations
Daylight Fingerprint Generator in RDKit
Morgan Fingerprint Generator in RDKit
RDKit Performance on Substructure Search
Introduction to Molecular Fingerprints
OCSR (Optical Chemical Structure Recognition)
AlphaFold - Protein Structure Prediction