Hi, I experimented a little bit with CanonicalRankAtoms and observed some unexpected results.
I have two mols (actually sets of fragments): C[*].n[*].C[*].N[*] CC[*].CC[*].cn([*])c.CN([*])C In the first case, pairs of carbons and nitrogens are recognized as symmetrical [0, 2, 0, 2] However, nitrogens are aliphatic and aromatic and I expected they will be different. In the second case, nitrogen already different, while carbons are still identical. That is expected. [0, 0, 3, 2] Is it a bug or a feature? Is there a way to solve this issue by RDKit machinery and how? Below is a reproducible example: b1 = b'\xef\xbe\xad\xde\x00\x00\x00\x00\x07\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x04\x00\x00\x00\x80\x01\x06\x00`\x00\x00\x00\x01\x03\x00$(\x00\x00\x00\x00\x01,\x01\x00\x00\x00*\x07@h\x00\x00\x00\x03\x01\x02\x00$(\x00\x00\x00\x00\x01,\x01\x00\x00\x00*\x06\x00`\x00\x00\x00\x01\x03\x00$(\x00\x00\x00\x00\x01,\x01\x00\x00\x00*\x07\x00`\x00\x00\x00\x01\x02\x00$(\x00\x00\x00\x00\x01,\x01\x00\x00\x00*\x0b\x00\x01\x00\x02\x03\x00\x04\x05\x00\x06\x07\x00\x14\x00\x17\x00\x00\x00\x00\x16' q1 = Chem.Mol(b1) b2 = b'\xef\xbe\xad\xde\x00\x00\x00\x00\x07\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x00\x00\n\x00\x00\x00\x80\x01\x06\x00`\x00\x00\x00\x01\x03\x06\x00`\x00\x00\x00\x02\x02\x00$(\x00\x00\x00\x00\x01,\x01\x00\x00\x00*\x06\x00`\x00\x00\x00\x01\x03\x06\x00`\x00\x00\x00\x02\x02\x00$(\x00\x00\x00\x00\x01,\x01\x00\x00\x00*\x06@h\x00\x00\x00\x03\x02\x02\x07@(\x00\x00\x00\x03\x03\x00$(\x00\x00\x00\x00\x01,\x01\x00\x00\x00*\x06\x00`\x00\x00\x00\x01\x03\x07\x00 \x00\x00\x00\x03\x00$(\x00\x00\x00\x00\x01,\x01\x00\x00\x00*\x06@h\x00\x00\x00\x03\x02\x02\x06\x00`\x00\x00\x00\x01\x03\x0b\x00\x01\x00\x01\x02\x00\x03\x04\x00\x04\x05\x00\x06\x07h\x0c\x07\x08\x00\t\n\x00\n\x0b\x00\x07\x0ch\x0c\n\r\x00\x14\x00\x17\x00\x00\x00\x00\x16' q2 = Chem.Mol(b2) r1 = [r for a, r in zip(q1.GetAtoms(), Chem.CanonicalRankAtoms(q1, False, False, False)) if a.GetSymbol() == "*"] r2 = [r for a, r in zip(q2.GetAtoms(), Chem.CanonicalRankAtoms(q2, False, False, False)) if a.GetSymbol() == "*"] print(Chem.MolToSmiles(q1, canonical=False)) # to preserve the order of atoms and ranks print(r1) print(Chem.MolToSmiles(q2, canonical=False)) print(r2) the output: C[*].n[*].C[*].N[*] [0, 2, 0, 2] CC[*].CC[*].cn([*])c.CN([*])C [0, 0, 3, 2] Kind regards, Pavel. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss