Degiacomi-Lab/molearn

[JOSS] Examples

Closed this issue · 4 comments

RMeli commented

Running analysis_example.py in the examples/ folder results in the following error:

FileNotFoundError: [Errno 2] No such file or directory: 'xbb_foldingnet_checkpoints\\checkpoint_no_optimizer_state_dict_epoch167_loss0.003259085263643.ckpt'

This happens similarly for the following paths:

data.import_pdb('data\\MurD_closed_selection.pdb')
data.import_pdb('data\\MurD_open_selection.pdb')

I'd suggest to use os.path.join to concatenate paths.


openjournals/joss-reviews#5523

RMeli commented

This is a bonus and not required at all for JOSS, but would it be possible to add a plotting output for the analysis script?

print("> generating error landscape")
# build a 50x50 grid. By default, it will be 10% larger than the region occupied
# by all loaded datasets
MA.setup_grid(50)
landscape_err_latent, landscape_err_3d, xaxis, yaxis = MA.scan_error()
## to visualise the GUI, execute the code above in a Jupyter notebook, then call:
# from molearn.analysis import MolearnGUI
# MolearnGUI(MA)

The "generating error landscape" phase takes some time so the suspense runs high and it's a bit deceiving not to get any output. =)

RMeli commented

When running bb_example_subclassing_trainer.py I get the following error:

Traceback (most recent call last):
  File "/home/rmeli/git/molearn/examples/bb_example_subclassing_trainer.py", line 127, in <module>
    trainer.run(max_epochs = 32+trainer.epoch,**runkwargs)
  File "/home/rmeli/git/molearn/src/molearn/trainers/trainer.py", line 181, in run
    logs.update(self.valid_epoch(epoch))
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rmeli/git/molearn/examples/bb_example_subclassing_trainer.py", line 87, in valid_epoch
    results['valid_DOPE'] = dope[:,0].mean()
                            ~~~~^^^^^
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

Printing the shape of dope I get (8,).

I apologise for the delayed reply.

commit ceff082 should add os.sep to file names in analysis_example.py. This was simply a mistake on our part.

commit 9ccea59 should add some simple plots. I agree it's a bit disappointing to run the script and get nothing at the end.

commit 68f788c should fix bb_example_subclassing_trainer.py this is a simple bug due to the default behaviour of refine=True changing and this script not being updated to reflect that change. Previously the returned array would have been of shape [n, 2] where dope[:, 0] would be unrefined dope scores and dope[:, 1] would be refined dope scores. While the new behaviour returns an array of shape [n,] with only the refined structures. I have updated the script to use the old behaviour by passing refine = 'both'.

RMeli commented

Thank you @SCMusson for fixing the few issues and for adding some simple plots, everything seems to work well now.

To avoid this kind of problems in the future (example scripts not following the changes in the code base), it might be worth thinking of testing them in CI (maybe only a few training step with a reduced model and data set).