cmiles
cmiles copied to clipboard
cmiles.utils.to_canonical_label failure
The following code raises an exception:
>>> import cmiles
>>> cmiles.utils.to_canonical_label("[H:13][c:1]1[c:3]([n:8][c:5]([n:10][c:6]1[N:12]([H:19])[c:7]2[c:2]([c:4]([n:9][n:11]2[H:18])[H:16])[H:14])[H:17])[H:15]", (9, 5, 11, 5))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/choderaj/miniconda/lib/python3.7/site-packages/cmiles/utils.py", line 193, in to_canonical_label
return toolkit.generate_index(mol, labeled_atoms)
File "/Users/choderaj/miniconda/lib/python3.7/site-packages/cmiles/_cmiles_oe.py", line 203, in generate_index
a.SetMapIdx(i + 1)
AttributeError: 'NoneType' object has no attribute 'SetMapIdx'
@jchodera, the problem here seems to be that the labels you are providing for the atoms have 5 twice. So you are trying to add 2 labels to the same atom.
@jthorton, openeye will throw an error if the same atom is being labeled twice but rdkit will silently return an index ignoring the second occurrence of the same index. RDKit should raise an error so this is something _cmiles_rdkit.py should check.