Greetings!! I hope this email finds you well.
I need a SMARTS pattern that matches this molecule fragment [image: image.png] The first pattern I used was: [*;R2]~1~[*;R2]~[*;R2]~[*;R2]~[*;R2]~[*;R2]~1 However, it also matches this fragment. This is not the expected behavior but it agrees with the pattern, so I tried adding the ring size constrain. [image: image.png] Now the pattern I am using is this: [*;R2r6]~1~[*;R2r6]~[*;R2r6]~[*;R2r6]~[*;R2r6]~[*;R2r6]~1 It worked quite well but now it fail to find matches in this molecule [image: image.png] Does anyone know what I am doing wrong?? Code: ------- m1 = Chem.MolFromSmiles( "c1ccc2cc3c(ccc4c5ccccc5c5cc6c7cc8c(cc7c6cc5c34)c3cccnc38)cc2c1") m2 = Chem.MolFromSmiles( "b1cccc2c1c1c(c3ccc4ccc4c3c3c4c5cc[nH]c5c4c13)c1ncc3ccccc3c21") m3 = Chem.MolFromSmiles( "b1ccbc2c1c1ccoc1c1c2c2ccsc2c2[nH]c3ncc4c(c3c21)=c1ncccc1=4") p = Chem.MolFromSmarts("[*;R2]~1~[*;R2]~[*;R2]~[*;R2]~[*;R2]~[*;R2]~1") for m, expected_value in zip([m1,m2,m3],[1,2,2]): print(len(m.GetSubstructMatches(p)) == expected_value) p = Chem.MolFromSmarts( "[*;R2r6]~1~[*;R2r6]~[*;R2r6]~[*;R2r6]~[*;R2r6]~[*;R2r6]~1") for m, expected_value in zip([m1,m2,m3],[1,2,2]): print(len(m.GetSubstructMatches(p)) == expected_value) All the best, Eduardo
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss