liveBook · Manning

Canonical SMILES

As explained in Build AI Drug Discovery Pipelines

A unique SMILES is a canonicalized SMILES representation selected so that equivalent molecular structures receive the same textual representation.

Canonical SMILES gives one standardized text representation to a chemical structure. This matters when storing, indexing, comparing, or deduplicating molecules: equivalent structures should not appear as separate records merely because their atoms or hydrogens were written differently. section 1.2.1 section 2.2.2

Canonicalization aims to provide:

  • Uniqueness: the same chemical structure produces the same string despite atom-label ordering or explicit hydrogen choices. section 1.2.1
  • Invariance: changes such as atom renumbering do not change the canonical representation. section 1.2.1
  • Compactness: structural information remains available in a concise form suitable for storage and comparison. section 1.2.1
  • Consistent stereochemical handling: retaining isotope and chiral information produces unique isomeric, or absolute, SMILES. section 2.2.2

Equivalent methane representations

Methane can be written as C, [CH4], [H][C]([H])([H])[H], or [#1][#6]([H])([#1])[#1]. Canonicalization selects one standardized representation rather than treating these equivalent forms as different compounds. With RDKit, use Chem.MolToSmiles(mol, canonical=True, isomericSmiles=True) to canonicalize a molecule while retaining stereochemistry. section 1.2.1 section 2.2.2

Table 1.1 Examples of SMILES. A complete reference on SMILES can be found in the Daylight manual.
SMILES
Name
CC
Ethane
O=C=O
Carbon Dioxide
C#N
Hydrogen Cyanide
CCN(CC)CC
Triethylamine
CC(=O)O
Acetic Acid
C1CCCCC1
Cyclohexane
c1ccccc1
Benzene

Use the SMILES examples to connect compact strings with familiar structures such as ethane, acetic acid, cyclohexane, and benzene. section 1.2.1

How Build AI Drug Discovery Pipelines covers it

How deep it goes
Defines canonicalization and its goals, then shows an RDKit call without detailing the underlying canonicalization algorithms.
Examples
Uses alternative methane strings and familiar SMILES examples for ethane, acetic acid, cyclohexane, benzene, and other molecules.
What it assumes
Starts with basic SMILES notation, including atoms, bonds, brackets, charges, and implicit hydrogens, before applying canonicalization.
What you can do after
Operate RDKit to generate canonical isomeric SMILES and recognize why equivalent molecular strings should be consolidated.
How it connects
Connects canonical SMILES to molecular standardization, stereochemistry, isotopes, RDKit sanitization, and duplicate structures.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build AI Drug Discovery Pipelines. The section links point to the parts of the book it draws on.