What is substructure search?
Learning objectives
After reading this article you will be able to:
- Explain how substructure search differs from similarity search
- Write simple SMARTS patterns
- Understand why generic patterns are slow
A substructure search answers a yes-or-no question for each molecule in a library: does this molecule contain my query fragment? Unlike similarity search, which ranks molecules by overall resemblance, substructure search returns every molecule that contains the pattern, however different the rest of the molecule is.
When to use it
- Finding all compounds that share a hit’s core scaffold, to explore what can change around it.
- Pulling every molecule with a required feature, such as a warhead for covalent drugs.
- Filtering out unwanted groups (reactive or assay-interfering motifs).
Describing the query: SMILES and SMARTS
A simple query can be written as SMILES or drawn in a structure editor. For more control, chemists use SMARTS, a pattern language that extends SMILES with wildcards and logic:
| SMARTS | Matches |
|---|---|
c1ccccc1 | A benzene ring |
[#7] | Any nitrogen atom, aromatic or not |
C(=O)[NX3] | An amide |
[CX3]=[CX3]C(=O)N | An acrylamide |
How it is computed
Checking whether one molecular graph is contained in another is a subgraph isomorphism problem. In the worst case it is expensive, so search engines use two stages:
- Screening. A fingerprint filter quickly discards molecules that cannot contain the query because they lack one of its features.
- Verification. An exact atom-by-atom match runs only on the survivors.
Specific queries — a distinctive ring system — screen out most of the library and return quickly. Very generic queries such as a single carbon chain match almost everything, so screening removes little and verification has to run on millions of molecules. Good search tools say clearly when such a search hit its time budget instead of silently returning partial results.
Last updated October 31, 2026
Put it into practice
Screen, dock and order compounds in one place
Pyxis Discovery combines macrocycle and small-molecule libraries with similarity search, docking and structure prediction in the browser.