Chemical Identity, Search and Molecular Features

RDKit Cheminformatics

Identify molecules, search by substructure and similarity, and transform atomic and molecular information into tabular features for data analysis.

Role
Chemical information processing
Typical input
SMILES, SDF, MOL, CSV
Typical output
InChIKey, fingerprints, descriptors, SVG

1. Workflow

A typical cheminformatics workflow is read -> sanitize -> standardize -> identify -> featurize -> search/model. Decide first whether salts, isotopes, stereoisomers, tautomers, and protonation states count as the same compound.

Define chemical identity first

Salt handling, stereochemistry, isotopes, tautomers, protonation states, and mixtures determine duplicate detection and must be fixed before modeling.

2. SMILES, InChI, and InChIKey

RepresentationRole
Canonical SMILESToolkit-canonicalized graph string
Isomeric SMILESSMILES retaining specified isotope and stereochemical information
Standard InChILayered standardized identifier
InChIKeyFixed-length, irreversible hash for lookup
Python
from rdkit import Chem
from rdkit.Chem import inchi

mol = Chem.MolFromSmiles("C[C@H](O)C(=O)O")
smiles = Chem.MolToSmiles(mol, isomericSmiles=True)
inchi_text = inchi.MolToInchi(mol)
inchi_key = inchi.InchiToInchiKey(inchi_text)

Canonical SMILES may depend on toolkit and version. InChIKey is convenient for indexing but is irreversible; retain the standardized structure and full InChI alongside it.

3. Structure standardization

Standardization applies project-specific rules; it does not discover a uniquely correct structure. Cleanup, fragment selection, uncharging, and tautomer canonicalization can remove information relevant to measured salt forms or pH conditions.

Python
from rdkit.Chem.MolStandardize import rdMolStandardize

clean = rdMolStandardize.Cleanup(raw_mol)
parent = rdMolStandardize.FragmentParent(clean)
neutral = rdMolStandardize.Uncharger().uncharge(parent)
Keep the measured form

Fragment removal or uncharging can disconnect the representation from a measurement performed on a salt or at a specified pH. Preserve the source structure and every transformation.

4. Descriptors and Gasteiger charges

Molecular weight, LogP, TPSA, hydrogen-bond counts, rotatable bonds, and rings compress graph information into scalar descriptors. Gasteiger charges are fast empirical partial charges and are not interchangeable with Mulliken, NPA, or Hirshfeld populations.

Python
from rdkit.Chem import AllChem, Descriptors

AllChem.ComputeGasteigerCharges(mol)
charges = [a.GetDoubleProp("_GasteigerCharge") for a in mol.GetAtoms()]
features = {"MolWt": Descriptors.MolWt(mol),
            "LogP": Descriptors.MolLogP(mol),
            "TPSA": Descriptors.TPSA(mol)}

Check for failed charge calculation, nonfinite values, and method-specific parameter limits. Store atom indices when atom-level values will later be mapped onto a drawing or a three-dimensional structure.

5. Fingerprints and similarity

Morgan, RDKit topological, and MACCS fingerprints encode different structural features. For bit vectors, Tanimoto similarity is

T(A,B)=nABnA+nB-nAB
Python
from rdkit import DataStructs
from rdkit.Chem import rdFingerprintGenerator

gen = rdFingerprintGenerator.GetMorganGenerator(radius=2, fpSize=2048)
fps = [gen.GetFingerprint(m) for m in mols]
sim = DataStructs.TanimotoSimilarity(fps[0], fps[1])

Similarity values are meaningful only together with fingerprint type, radius, size, and feature settings.

6. SMARTS substructure searching

SMARTS represents a query rather than one molecule. Specify aromaticity, formal charge, valence, hydrogen, ring, and stereochemical constraints needed by the chemical question.

Python
amide = Chem.MolFromSmarts("[NX3][CX3](=[OX1])")
matches = target.GetSubstructMatches(amide, useChirality=True)

Validate each SMARTS query against positive and negative test structures. Short functional-group patterns often match more chemical environments than their informal name suggests.

7. Depiction and highlighting

Highlight matched atoms and bonds, align a common core across a molecular series, and include the color scale and sign when visualizing atomic contributions such as Gasteiger charges.

from rdkit.Chem.Draw import rdMolDraw2D

hit_atoms = list(target.GetSubstructMatch(amide))
drawer = rdMolDraw2D.MolDraw2DSVG(420, 280)
rdMolDraw2D.PrepareAndDrawMolecule(
    drawer, target, highlightAtoms=hit_atoms
)
drawer.FinishDrawing()

8. Dataset construction

  1. Retain source structures and identifiers.
  2. Record parse failures and mixtures.
  3. Generate standardized SMILES and InChIKeys.
  4. Fix descriptor definitions and RDKit version.
  5. Check missing, infinite, and near-constant features.
  6. Match structures to target units and measurement conditions.
  7. Consider scaffold or series splits in addition to random splits.

Continue to numerical and statistical analysis.

9. References

Last reviewed: August 4, 2026. Check the linked official documentation for syntax specific to the installed software version.