pckroon / pysmiles

A lightweight python-only library for reading and writing SMILES strings
Apache License 2.0
147 stars 21 forks source link

Bug!In the conversion process of smiles and graph, the number of hydrogen atoms is converted incorrectly #22

Closed Vencent-Won closed 2 years ago

Vencent-Won commented 2 years ago

code: smiles = 'CCc1cn2c3c(cc(C(=O)NC(Cc4ccccc4)C(O)C[NH2+]Cc4cccc(OC)c4)cc13)N(C)S(=O)(=O)CC2' graph = pysmiles.read_smiles(smiles) pysmiles.write_smiles(graph) Out:'O=C(NC(C(C[NH2+]Cc:1:c:c:c:c(:c1)OC)O)Cc:1:c:c:c:c:c1)c:1:c:c2:c:3NH[CH]CCC'

pckroon commented 2 years ago

Thanks for reporting this. I'm aware the hydrogen count is wrong for (some) annulated aromatic systems, this is mentioned in the readme. I'm tracking this problem in issue #19, so I'll close this one as a duplicate. If you think this is incorrect, feel free to reopen it with your reasoning.