Skip to content

Commit

Permalink
Update sdf writing to accept propertymol
Browse files Browse the repository at this point in the history
  • Loading branch information
jessbade committed Apr 16, 2024
1 parent 94004ca commit e3f7242
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions isicle/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from io import StringIO

import isicle
from isicle.utils import TypedList
import pandas as pd
from rdkit import Chem
from openbabel import pybel
Expand Down Expand Up @@ -710,6 +711,21 @@ def save_sdf(path, geom):
w.write(m.mol)
w = None

elif isinstance(
TypedList(Chem.PropertyMol.PropertyMol, geom),
TypedList,
):
w = Chem.SDWriter(path)
for m in TypedList(Chem.PropertyMol.PropertyMol, geom):
w.write(m)
w = None
else:
raise TypeError(
"Must be of type `isicle.geometry.Geometry`, \
`isicle.conformers.ConformationalEnsemble`, or \
`rdkit.Chem.PropertyMol.PropertyMol` to save in sdf format."
)


def save(path, data):
"""
Expand Down

0 comments on commit e3f7242

Please sign in to comment.