awslabs / dgl-lifesci

Python package for graph neural networks in chemistry and biology
Apache License 2.0
730 stars 151 forks source link

Loading preprocessed datasets fails due to missing attribute 'valid_ids' #102

Closed sooheon closed 4 years ago

sooheon commented 4 years ago
   ...: ds = Lipophilicity(partial(smiles_to_bigraph, add_self_loop=True, num_virtual_nodes=1),
   ...:                    CanonicalAtomFeaturizer(),
   ...:                    CanonicalBondFeaturizer(self_loop=True),
   ...:                    load=True)
   ...: 
Loading previously saved dgl graphs...
Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3417, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-32-e4139ee1c1b4>", line 17, in <module>
    load=True)
  File "/opt/conda/lib/python3.7/site-packages/dgllife/data/lipophilicity.py", line 120, in __init__
    self.chembl_ids = [self.chembl_ids[i] for i in self.valid_ids]
AttributeError: 'Lipophilicity' object has no attribute 'valid_ids'

Not sure why this fails, because valid_ids is created in _pre_process which is called in init.

mufeili commented 4 years ago

Thank you for the report. I think this is probably a bug that happens with load=True. As you can see here, self.valid_ids is not created when load=True. I will fix it. Before that, setting load=False should be able to solve the issue.

mufeili commented 4 years ago

This should be fixed in #103 and you can install from source to try it. Note that you need to delete the old file lipophilicity_dglgraph.bin.