Open jchodera opened 1 year ago
the input molecule is forcibly recast to
OEMol
... but this should not destroy the SDData
That seems to be the culprit here
ipdb> [*oechem.OEGetSDDataPairs(protomer)][0].GetTag()
'annotation'
ipdb> [*oechem.OEGetSDDataPairs(protomer)][0].GetValue()
'acetic acid'
ipdb> oemol = oechem.OEMol(protomer)
ipdb> [*oechem.OEGetSDDataPairs(oemol)][0].GetTag()
*** IndexError: list index out of range
ipdb> [*oechem.OEGetSDDataPairs(oemol)][0].GetValue()
*** IndexError: list index out of range
This does not happen generally with Molecule.from_openeye
when provided a full oechem.OEMol
:
In [1]: from openff.toolkit import Molecule
In [2]: offmol = Molecule.from_smiles('COOH')
In [3]: offmol.properties['annotation'] = 'acetic acid'
In [4]: Molecule.from_openeye(offmol.to_openeye()).properties
Out[4]: {'annotation': 'acetic acid'}
In [5]: type(offmol.to_openeye())
Out[5]: openeye.oechem.OEMol
so I assume that SD tags are meant to be preserved when interoperating between OEChem and the toolkit
Describe the bug
Molecule.from_openeye(oemol)
correctly preserves SD tags ifoemol
is anOEMol
, but not if it is anOEGraphMol
.I'm not exactly sure why this is happening. Note that the input molecule is forcibly recast to
OEMol
in this line, but this should not destroy the SDData. Something in these intervening lines must somehow clear this data.It's possible that the SDData could simply be pulled from the original molecule in these lines without issue.
To Reproduce
Output See above.
Computing environment (please complete the following information):
linux
x86_64
conda list
Additional context This was discovered in preparing the bug report for #1710