rdkit.Chem.rdSubstructLibrary - Substructure Library

This section provides a quick introduction on rdkit.Chem.rdSubstructLibrary module in RDKit library that provides functionalities to do substructure search with a molecule library.

What Is rdkit.Chem.rdSubstructLibrary Module? rdkit.Chem.rdSubstructLibrary module in RDKit library provides functionalities to do substructure search with a molecule library.

rdkit.Chem.rdSubstructLibrary module contains one main class: rdkit.Chem.rdSubstructLibrary.SubstructLibrary, which has the following main methods:

l = rdSubstructLibrary.SubstructLibrary() - Creates a SubstructLibrary object.

i = 1.AddMol(m) - Adds the given molecule to the library and returns the index of the added molecule.

c = 1.CountMatches(s) - Performs substructure match in the library and returns the number of matched molecules.

i = 1.GetMatches(s) - Performs substructure match in the library and returns a list of matched molecule indexes. The default number of maximum matched molecule indexes is 1000.

m = 1.GetMol(i) - Returns the molecule of a given index.

Here is a short Jupyter Notebook example of using rdkit.Chem.rdSubstructLibrary.SubstructLibrary class for substructure search.

from rdkit import Chem
ms = ["O=C(O)c2cc1ccc(Cl)n1cn2", "O=C(O)c2ccn1c(Cl)ccc1n2"]
ms = list(map(Chem.MolFromSmiles, ms))
i = Chem.Draw.MolsToGridImage(ms)
display(i)

s = Chem.MolFromSmiles('c1nccc2n1ccc2')
i = Chem.Draw.MolToImage(s, size=(120,120))
display("Substructure", i)

from rdkit.Chem import rdSubstructLibrary
l = rdSubstructLibrary.SubstructLibrary()
for m in ms:
  l.AddMol(m)

c = l.CountMatches(s)
print("Number of matches", c)

ms = l.GetMatches(s)
ms = [l.GetMol(m) for m in ms]
i = Chem.Draw.MolsToGridImage(ms)
display(i)
rdkit.Chem.rdSubstructLibrary - Substructure Library
rdkit.Chem.rdSubstructLibrary - Substructure Library

Table of Contents

 About This Book

 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

 Resources and Tools

 Cheminformatics Related Terminologies

 References

 Full Version in PDF/EPUB