Skip to content

Commit

Permalink
Fix errors interrupted sdf2smi.py script if a wrong molecule was occu…
Browse files Browse the repository at this point in the history
…rred in input
  • Loading branch information
DrrDom committed Aug 25, 2022
1 parent 12b2d04 commit 72dbd73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sdf2smi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def calc(input_fname, output_fname, field_name, extract_fields, sep):
if extract_fields is not None:
f.write('smi\tid\t' + '\t'.join(extract_fields) + '\n')
for m in Chem.SDMolSupplier(input_fname):
if m.GetConformer().Is3D():
Chem.AssignStereochemistryFrom3D(m)
if m:
if m.GetConformer().Is3D():
Chem.AssignStereochemistryFrom3D(m)
smi = Chem.MolToSmiles(m, isomericSmiles=True)
if field_name:
n = m.GetProp(field_name)
Expand Down

0 comments on commit 72dbd73

Please sign in to comment.