ml-struct-bio/cryodrgn

TypeError in Jupyter Notebook for Load CTF after high-res training

Closed this issue · 1 comments

Describe the bug
Post high-resolution training on a large dataset, the cryoDRGN_viz.ipynb Jupyter notebook is giving a TypeError at the Load CTF step.

`TypeError Traceback (most recent call last)
Cell In [15], line 4
1 # Load CTF
2 #import os
3 #os.path.abspath('/scratch/user/soney1/CS-suc/J231')
----> 4 ctf_params = utils.load_pkl(config['dataset_args']['ctf'])
5 if ind_orig is not None:
6 print(f'Filtering ctf parameters from {len(ctf_params)} to {len(ind_orig)}')

File /sw/eb/sw/cryoDRGN/2.3.0-foss-2022a-CUDA-11.7.0/lib/python3.10/site-packages/cryodrgn/utils.py:45, in load_pkl(pkl)
44 def load_pkl(pkl: str):
---> 45 with open(pkl, "rb") as f:
46 x = pickle.load(f)
47 return x

TypeError: expected str, bytes or os.PathLike object, not NoneType`

To Reproduce

ctf_params = utils.load_pkl(config['dataset_args']['ctf']) if ind_orig is not None: print(f'Filtering ctf parameters from {len(ctf_params)} to {len(ind_orig)}') ctf_params = ctf_params[ind_orig] ctf.print_ctf_params(ctf_params[0])

Expected behavior
CTF parameters from initial training input should be propagated through training and load when this command is executed.

Additional context
I have been following the guide set up for the tutorial dataset and noticed that a ctf file is not defined for the high resolution training command. Since this was not included in the tutorial prompt for high-res training, I was under the impression that the ctf parameters would carry over with the selected particles from initial training and filtering and proceeded without it. Now I am wondering if the TypeError is related to this.

Hi, can you share the command and the arguments that you used for training, e.g. cryodrgn train_vae ...? I'm having trouble finding the training command you are referencing within the guide, and we generally do list the CTF file as a required argument. See for example, from the section 4) CryoDRGN training:

Screenshot 2024-04-05 at 11 41 30 AM

But yes, in general you have to specify the --ctf argument during the training stage! We may expand the Jupyter notebook analyses to support experiments that omit the CTF but for now the CTF is a requirement.