RDKit supports range queries in SMARTS strings. They are not necessarily
supported by other cheminformatics toolkits such as OpenEye’s. So Wim’s
query below could be simplified by using [r{3-10}] to mean an atom in a
ring of size 3 to 10 atoms in size.

On Sun, 20 Aug 2023 at 18:38, Wim Dehaen <wimdeh...@gmail.com> wrote:

> Hi,
> i'm not sure if i understand the question perfectly, so apologies if the
> below is behind the point. i think in general, for analysis like this it is
> better to make use of rdkit's SSSR functionality and then use the ring
> information in the way required for your purpose. this tends to be much
> more flexible and natural.
>
> however, here is a smarts pattern that matches both naphthalene and
> azulene, as both of them are aromatic and are are a ten-membered ring plus
> a single additional closure
> ```patt=Chem.MolFromSmarts("c1ccccccccc1")
> n=Chem.MolFromSmiles("c12ccccc1cccc2")
> a=Chem.MolFromSmiles("c12cccc1ccccc2")
> print(n.HasSubstructMatch(patt),a.HasSubstructMatch(patt))```
> this results in True True
>
> another way is to explicitly enumerate the possible ringsizes you are
> willing to consider in the SMARTS:
>
> [r3,r4,r5,r6,r7,r8,r9,r10]1[r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10]1
> as you can see this is much more ugly, but it's able to capture cases such
> as c1cc2c1c3c2c1c3cc1.
>
> best wishes
> wim
>
> On Sun, Aug 20, 2023 at 5:34 PM Eduardo Mayo <eduardomayoya...@gmail.com>
> wrote:
>
>> Hello,
>>
>> I hope you are all doing well. I'm looking for a smart pattern that can
>> match rings of different sizes at the same time. The intention is to match
>> something like naphthalene and azulene with the same pattern. Is that
>> possible?
>>
>> Best,
>> Eduardo
>> _______________________________________________
>> Rdkit-discuss mailing list
>> Rdkit-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
-- 
David Cosgrove
Freelance computational chemistry and chemoinformatics developer
http://cozchemix.co.uk
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to