SMARTS pattern to match rings


I am trying to understand how to write SMARTS patterns to match rings in a structure. I am particularly confused about matching fused vs unfused rings. So for instance, a pattern that would match a pyridine ring in the structure but not a quinoline ring, vs a pattern that will return a hit if the structure had a pyridine or quinoline. Thanks in advance!

By default, the SMARTS atoms will match any number of rings, so a very simple SMARTS matching pyridine would be:


If you want to prevent any ring fusions, then you need to set the β€˜R’ on each atom to 1, e.g.


This is specifying that each atom is in exactly 1 ring - i.e. no fusion is possible.
If you want to allow fusion in a specific position, then you will either have to create separate SMARTS for each fusion position:

n1c[cR1][cR1][cR1][cR1]1  - Allows fusion on the N-C bond (i.e. 1,2- or 'a' or 'f')
[NR1]1cc[cR1][cR1][cR1]1  - Allows fusion on the 2,3- C-C bond ('b' or 'e')
[NR1]1[cR1]cc[cR1][cR1]1  - Allows fusion on the 3,4- C-C bond ('c' or 'd')

If you want to force fusion, then you need to specify β€˜R2’ in those positions:

[nR2]1[cR2][cR1][cR1][cR1][cR1]1  - Forces fusion on the N-C bond (i.e. 1,2- or 'a' or 'f')
[nR1]1[cR2][cR2][cR1][cR1][cR1]1  - Forces fusion on the 2,3- C-C bond ('b' or 'e')
[nR1]1[cR1][cR2][cR2][cR1][cR1]1  - Forcesfusion on the 3,4- C-C bond ('c' or 'd')

If you want a single SMARTS that will give you a pyridine that must be fused somewhere, then you will need to use recursive SMARTS, e.g.


NB the last SMARTS will only match a single atom, the β€˜N’ atom of the pyridine ring - all the others will match the whole pyridine ring.



Thanks so much for the thorough explanation. It’s much clearer to me now.



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.