Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chem.rdmolfiles.MaeMolSupplier Never Stops Reading #2617

Closed
lilleswing opened this issue Aug 16, 2019 · 1 comment
Closed

Chem.rdmolfiles.MaeMolSupplier Never Stops Reading #2617

lilleswing opened this issue Aug 16, 2019 · 1 comment

Comments

@lilleswing
Copy link
Contributor

Description:

  • RDKit Version: 2019.03.01
  • Platform: Linux

Chem.rdmolfiles.MaeMolSupplier reads more molecules than is actually in the file.
If you try to read until file exhaustion it never stops reading.

################### Schrodinger Suite Reads the File #######################
from schrodinger import structure
from rdkit import Chem
import datetime
 
reader = structure.StructureReader('pm7_1212_0_out.mae')
sts = [x for x in reader]
print("total molecules = %s" % len(sts))
total_mols = len(sts)
# total molecules = 5225
 
 ################### rdkit will just keep reading forever #######################

suppl = Chem.rdmolfiles.MaeMolSupplier('pm7_1212_0_out.mae')
start_time = datetime.datetime.now()
mols = []
for i, m in enumerate(suppl):
  mols.append(m)
  if i > total_mols:
    print("MaeMolSupplier Keeps Reading Molecules after all are gone")
    break
# MaeMolSupplier Keeps Reading Molecules after all are gone

example mae file

@ricrogz
Copy link
Contributor

ricrogz commented Aug 16, 2019

I'm looking into this. It seems caused by #2579, although the MaeMolSupplier should fail once maeparser has trouble reading...

That other issue is already patched in maeparser, although it has not yet made its way into RDKit. I'll see if I can put up a PR to make sure MaeMolSupplier stops reading when there are problems in maeparser, and then try to get a new maeparser release issued and updated into RDKit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants