MolDraw › Chemistry tools › Molecular Similarity and Substructure Search
Molecular Similarity and Substructure Search
In short: Paste or draw two molecules to get their Tanimoto and Dice similarity, a verdict and the largest common substructure. Or search one or many molecules for a SMILES or SMARTS pattern and see the matched atoms highlighted.
Use it to check how close an analogue is to a lead compound, rank a list of molecules against a reference, or find which molecules contain a carboxylic acid, an aromatic halide or a hydrogen bond donor. Scores use a 512-bit substructure-fragment fingerprint, the same one as the Compare molecules plugin in the MolDraw editor.
CC(=O)Oc1ccccc1C(=O)O) and salicylic acid (OC(=O)c1ccccc1O) set 74 and 41 fingerprint bits and share all 41, so Tanimoto = 41 / (74 + 41 − 41) = 0.554 (moderately similar) and Dice = 82 / 115 = 0.713. The SMARTS [CX3](=O)[OX2H1] finds one carboxylic acid in each.Loading editor…
Example pairs:
SMARTS cheat sheet
Loading…
Loading…
Rank a list against Molecule A
Paste one SMILES per line, optionally followed by a name. Every molecule is scored against Molecule A and sorted from most to least similar.
How to use the similarity and substructure tool
- Similarity: type or paste SMILES for Molecule A and Molecule B and press Compare. To draw instead, pick Molecule A or Molecule B above the editor and draw.
- Read the Tanimoto and Dice scores, the verdict and the bar. The shaded atoms in both drawings are the largest common substructure.
- Rank a list: paste many SMILES under Rank a list against Molecule A and press Rank list. Save the table with Download CSV.
- Substructure search: open the Substructure search tab, type a query or pick one from the cheat sheet, paste the targets and press Search. Each match is shaded in its own colour.
How Tanimoto similarity works
A fingerprint is a list of bits. This tool uses a 512-bit fingerprint in which each bit is one small fragment from a fixed dictionary of common substructures, such as a carbonyl next to an oxygen or an aromatic ring carbon next to a nitrogen. A bit is on (1) when the molecule contains that fragment.
Tanimoto T = c / (a + b − c) Dice D = 2c / (a + b) D = 2T / (1 + T)
Here a is the number of bits on in A, b in B, and c in both. T = 1 means identical fingerprints; T = 0 means no shared bit. Tanimoto is symmetric: comparing A with B gives the same number as B with A.
Worked count example
Aspirin sets a = 74 bits and salicylic acid b = 41. All 41 salicylic acid bits are also on in aspirin, so c = 41. T = 41 / (74 + 41 − 41) = 41 / 74 = 0.554. D = 2 × 41 / (74 + 41) = 82 / 115 = 0.713. The score is only moderate because aspirin has many extra bits from its acetyl ester.
Verdict scale used here
| Tanimoto | Verdict | What it usually means |
|---|---|---|
| 0.85 to 1.00 | Very similar | Close analogues, or identical (1.00) |
| 0.70 to 0.85 | Similar | Shared core, one or two different groups |
| 0.50 to 0.70 | Moderately similar | Some shared fragments, different scaffold or substituents |
| 0.30 to 0.50 | Weakly similar | Only a ring or a functional group in common |
| below 0.30 | Dissimilar | Little in common |
Cut-offs depend on the fingerprint. The same pair can score quite differently with a circular fingerprint such as ECFP4. Compare scores from the same method only.
SMARTS basics and cheat sheet
SMARTS is a pattern language built on SMILES. A plain SMILES is already a valid query. Square brackets add conditions to one atom:
#7atomic number 7 (any nitrogen),caromatic carbon,Caliphatic carbon,aany aromatic atom,*any atom.H1exactly one attached hydrogen,!H0at least one hydrogen,X3three connections in total,D2two heavy-atom neighbours.Rin a ring,R0not in a ring,r6in a 6-membered ring,+or-charge.- Logic:
,or,;and,!not. Bonds:-single,=double,#triple,:aromatic,~any.
| Group | SMARTS | Matches | Does not match | |
|---|---|---|---|---|
| Carboxylic acid | [CX3](=O)[OX2H1] | acetic acid, aspirin | methyl acetate, acetate anion | |
| Carboxylate anion | [CX3](=O)[O-] | sodium acetate | acetic acid | |
| Ester | [#6][CX3](=O)[OX2][#6] | ethyl acetate, aspirin | acetic acid | |
| Amide | [NX3][CX3]=O | paracetamol, peptide bonds | acetic acid | |
| Primary amine (alkyl) | [NX3;H2][CX4] | ethylamine, amphetamine | acetamide, aniline | |
| Secondary amine (alkyl) | [NX3;H1]([CX4])[CX4] | diethylamine | ethylamine | |
| Aromatic amine (aniline) | [NX3;H2]c | aniline | ethylamine | |
| Alcohol | [CX4][OX2H] | ethanol | phenol | |
| Phenol | c[OX2H] | phenol, paracetamol | ethanol | |
| Aldehyde | [CX3H1](=O)[#6] | acetaldehyde, vanillin | acetone | |
| Ketone | [#6][CX3](=O)[#6] | acetone | acetaldehyde | |
| Aromatic halide | c[F,Cl,Br,I] | chlorobenzene, diclofenac | chloroethane | |
| Alkyl halide | [CX4][F,Cl,Br,I] | chloroethane | chlorobenzene | |
| Nitro group | [N+](=O)[O-] | nitrobenzene | acetonitrile | |
| Nitrile | [CX2]#[NX1] | acetonitrile | ethylamine | |
| Sulfonamide | [SX4](=O)(=O)[NX3] | sulfanilamide, celecoxib | dimethyl sulfone | |
| Thiol | [SX2H] | ethanethiol, cysteine | dimethyl sulfide | |
| Benzene ring | c1ccccc1 | toluene | pyridine | |
| Any 6-membered aromatic ring | a1aaaaa1 | pyridine, benzene | cyclohexane | |
| Lipinski H-bond donor | [#7,#8;!H0] | each OH and NH (count the matches) | diethyl ether | |
| Lipinski H-bond acceptor | [#7,#8] | every N and O atom | propane | |
| Atom in a 5-membered ring | [r5] | cyclopentane, furan | cyclohexane | |
| Carbon not in a ring | [C;R0] | propane | cyclohexane |
Not supported yet: recursive SMARTS written with $( ) and dot-separated queries. Stereo marks such as @ in a query are ignored.
Worked examples
Paracetamol vs phenacetin
Phenacetin has an ethoxy group where paracetamol has OH. Same acetanilide core.
Tanimoto 0.846, Dice 0.917: similar
Morphine vs codeine
Codeine is morphine with the phenol OH methylated. One extra ether.
Tanimoto 0.944: very similar
Ibuprofen vs naproxen
Both are 2-arylpropionic acids, but naproxen has a methoxynaphthalene instead of an isobutylbenzene.
Tanimoto 0.711: similar
Benzene vs cyclohexane
Both are C6 rings, but aromatic and aliphatic bonds give different fragments.
Tanimoto 0.000: dissimilar
Which NSAIDs are carboxylic acids?
Query [CX3](=O)[OX2H1] on the 9 example drugs.
6 of 9 match: ibuprofen, naproxen, ketoprofen, flurbiprofen, diclofenac, aspirin
Lipinski donors in paracetamol
Query [#7,#8;!H0] finds the amide N–H and the phenol O–H.
2 matches: HBD = 2
Common mistakes
- Comparing scores from different fingerprints. A Tanimoto of 0.6 means different things for different fingerprints. Keep one method for one project.
- Expecting stereoisomers to differ. Enantiomers and E/Z isomers score 1.000 because the fingerprint ignores stereo.
- Reading similarity as activity. Similar structures often, but not always, have similar activity. One changed atom can switch a drug off.
- Forgetting hydrogens in queries.
C(=O)Omatches esters too. Use[OX2H1]for an acid OH. - Using lower case by mistake. In SMARTS,
cis aromatic carbon andCis aliphatic carbon.C1CCCCC1does not match benzene. - Searching a charged form with a neutral query. A carboxylate drawn as
[O-]does not match[OX2H1]. Search both forms when salts are in your list.
Comparing analogues in your own drawings? Open MolDraw, the free online structure editor, and use the Compare molecules plugin to score and align analogues next to your sketch.
Open MolDraw editorFrequently asked questions
What is Tanimoto similarity?
Tanimoto similarity compares two molecular fingerprints. It is c / (a + b − c), where a and b are the bits set in each molecule and c is the bits set in both. It runs from 0 (nothing shared) to 1 (identical fingerprints).
What Tanimoto value means two molecules are similar?
On this tool's 512-bit fragment fingerprint, 0.85 or more is very similar, 0.70 to 0.85 is similar, 0.50 to 0.70 is moderately similar and below 0.30 is dissimilar. Cut-offs depend on the fingerprint, so compare scores from the same method only.
What is the difference between Tanimoto and Dice similarity?
Both use the same bit counts. Dice is 2c / (a + b), so it gives more weight to shared bits and is always equal to or higher than Tanimoto. For a = 74, b = 41 and c = 41, Tanimoto is 0.554 and Dice is 0.713.
Why do two enantiomers get a Tanimoto score of 1?
The fingerprint records which atoms and bonds are connected, not their 3D arrangement. L-alanine and D-alanine have the same fragments, so the score is 1.000. The tool tells you when two inputs differ only in stereochemistry.
What is SMARTS?
SMARTS is a pattern language based on SMILES for describing substructures. For example, [CX3](=O)[OX2H1] means a carbon with three connections, double bonded to O and single bonded to an OH, which is a carboxylic acid.
Can I use a SMILES string as a substructure query?
Yes. A SMILES query matches any molecule that contains those atoms and bonds. Hydrogens are not required, so C(=O)O matches both acids and esters. Use [OH] or [OX2H1] when the hydrogen matters.
How do I count Lipinski hydrogen bond donors with SMARTS?
Search with [#7,#8;!H0]. It matches every nitrogen or oxygen that carries at least one hydrogen, and the number of matches is the donor count. Paracetamol gives 2: the amide NH and the phenol OH.
Is the similarity and substructure search tool free?
Yes. It is free, needs no sign-up and runs in your web browser. Your molecules are not uploaded.
Related chemistry tools
Last updated: