Dear Jean-Marc,
adding '~' between C and ring number seems to work:

'm1 = Chem.MolFromSmiles('C1CCCC(=C12)CCCC2')
m2 = Chem.MolFromSmiles('C1CCC=C(C12)CCCC2')
pattern = Chem.MolFromSmarts('C~1~C~C~2~C~C~C~C~C~2~C~C~1')
print(m1.HasSubstructMatch(pattern))
print(m2.HasSubstructMatch(pattern))

return True and True

Best regards,
Brice


Le ven. 17 janv. 2020 à 10:55, Jean-Marc Nuzillard <
jm.nuzill...@univ-reims.fr> a écrit :

> Dear all,
>
> I would like to write a SMARTS chain that matches any compound with a
> decalin ring system,
> whatever bond multiplicity.
> I wrote it as 'C1~C~C2~C~C~C~C~C2~C~C1' with ~ standing for "any bond".
> The C1-C1 and C2-C2 bonds have the "default type", which is single or
> aromatic.
> The code
>
> m1 = Chem.MolFromSmiles('C1CCCC(=C12)CCCC2')
> m2 = Chem.MolFromSmiles('C1CCC=C(C12)CCCC2')
> pattern = Chem.MolFromSmarts('C1~C~C2~C~C~C~C~C2~C~C1')
> print(m1.HasSubstructMatch(pattern))
> print(m2.HasSubstructMatch(pattern))
>
> prints False for m1 and True for m2 because the double bond in m1 is
> located
> at the place of one of the ring closure bonds in pattern.
>
> My question is how to write a SMARTS chain that fits in all cases for
> decalin
> or any other ring system and is more related to SMARTS-writing than to
> RDKit, I admit.
>
> Best,
>
> Jean-Marc
>
> --
>
> Dr. Jean-Marc Nuzillard
> Institute of Molecular Chemistry, CNRS UMR 7312
> Faculté des Sciences Exactes et Naturelles, Bâtiment 18
> BP 1039
> 51687 REIMS Cedex 2
> France
>
> Tel : 33 3 26 91 82 10
> Fax : 33 3 26 91 31 
> 66http://www.univ-reims.fr/icmrhttp://eos.univ-reims.fr/LSD/CSNteam.html
>
> ORCID: 
> 0000-0002-5120-2556http://www.univ-reims.fr/LSD/http://www.univ-reims.fr/LSD/JmnSoft/
>
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>


-- 
Brice HOFFMANN
Senior Scientist,
Molecular Modeling & Computational Chemistry
iktos.ai
24 rue chaptal 75009 Paris
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to