openforcefield / openff-toolkit

The Open Forcefield Toolkit provides implementations of the SMIRNOFF format, parameterization engine, and other tools. Documentation available at http://open-forcefield-toolkit.readthedocs.io
http://openforcefield.org
MIT License
305 stars 90 forks source link

Molecule.from_file() does not preserve SDTags in read CSV files with OpenEye backend #1710

Open jchodera opened 10 months ago

jchodera commented 10 months ago

Describe the bug When using the OpenEye toolkit backend, writing a Molecule with associated properties correctly stores these as SD tags in an SDF or CSV file, but reading from CSV does not correctly restore the SD tags.

This appears to be due to the use of oechem.OEMol() as the object to read molecules into in this line, rather than an oechem.OEGraphMol() (which correctly reads in the SD tags).

To Reproduce

>>> from openff.toolkit.topology import Molecule
>>> offmol = Molecule.from_smiles('CCO')
>>> offmol.properties['annotation'] = 'ethanol'
>>> offmol.to_file('testmol.csv', file_format='csv')
>>> readmol = Molecule.from_file('testmol.csv')
>>> readmol.properties
{}

Output See above.

Computing environment (please complete the following information):

Additional context