🔭Running Reconstruction Models
Listed here are the commands needed to obtain results that can be used as input for CryoBench analyses using each of our example reconstruction methods.
We use the conformational heterogeneity IgG-1D/ CryoBench dataset available through Zenodo; in addition to being accessed through a web browser, it can also be downloaded and unpacked through a command-line terminal:
$ curl "https://zenodo.org/records/11629428/files/IgG-1D.zip?download=1" --output IgG-1D.zip
$ unzip IgG-1D.zip
All commands are assumed to run from the same directory as IgG-1D/
; also note that the conda environments used are the same ones as described in the installation instructions. We use the cryobench/inputs/
folder to store the output of each method for subsequent analyses:
cryoDRGN with fixed poses
This command took 1h 14min on a single A100 GPU:
$ conda activate cryodrgn_model
(cryodrgn_model)$ cryodrgn train_vae IgG-1D/images/snr0.01/sorted_particles.128.txt -n 20 --zdim 8 --ctf IgG-1D/combined_ctfs.pkl --poses IgG-1D/combined_poses.pkl -o cryobench/inputs/cryodrgn_fixed/
cryoDRGN with ab-initio poses
This command took 4h 24min using four A100 GPUs; ab-initio takes longer, especially now that we are training with 50 epochs intead of 20 as with the fixed poses example above, but using --multigpu
reduces runtimes 2-4x:
$ conda activate cryodrgn_model
(cryodrgn_model)$ cryodrgn abinit_het IgG-1D/images/snr0.005/sorted_particles.128.txt -n 50 --zdim 8 --ctf IgG-1D/combined_ctfs.pkl -o cryobench/inputs/cryodrgn_abinit/ --multigpu
For both this and the cryodrgn train_vae
command you may have to use the --lazy
command for more memory-efficient (but less time-efficient) data loading if running into GPU out-of-memory issues.
DRGN-AI with fixed poses
We use the setup
command to generate the config file drgnai_fixed/configs.yaml
, but it can also be generated manually using a text editor such as vim. This train
command took 3h 10min on a single GPU:
$ conda activate drgnai_model
(drgnai_model)$ drgnai setup cryobench/inputs/drgnai_fixed/ --particles IgG-1D/images/snr0.005/sorted_particles.128.txt --ctf IgG-1D/combined_ctfs.pkl --pose IgG-1D/combined_poses.pkl --reconstruction-type het --pose-estimation fixed --cfgs 'lazy=True'
(drgnai_model)$ drgnai train cryobench/inputs/drgnai_fixed/
DRGN-AI with ab-initio poses
We again use the setup
command, now avoiding using poses and using a smaller number of epochs. This time training took 4h 28min using four A100 GPUs; DRGN-AI detects the number of GPUs available automatically with no need for a --multigpu
flag:
$ conda activate drgnai_model
(drgnai_model)$ drgnai setup cryobench/inputs/drgnai_abinit/ --particles IgG-1D/images/snr0.005/sorted_particles.128.txt --ctf IgG-1D/combined_ctfs.pkl --reconstruction-type het --pose-estimation abinit --cfgs 'lazy=True' 'epochs_sgd=25'
(drgnai_model)$ drgnai train cryobench/inputs/drgnai_abinit/
OPUS-DSD
For this method we first have to create a pose file in the correct format. The train_cv
command took roughly six hours to complete in this case using 4 A100 GPUs:
$ conda activate opusdsd_model
(opusdsd_model)$ dsd parse_pose_star IgG-1D/images/snr0.001/snr0.001.star -o IgG-1D/poses_opusdsd.pkl --Apix 3.0 -D 128 --relion31
(opusdsd_model)$ dsd train_cv IgG-1D/images/snr0.005/sorted_particles.128.txt --ctf IgG-1D/combined_ctfs.pkl --poses IgG-1D/poses_opusdsd.pkl --lazy-single --pe-type vanilla --encode-mode grad --template-type conv -n 20 -b 12 --zdim 12 --lr 1.e-4 --num-gpus 4 --multigpu --beta-control 2. --beta cos -o cryobench/inputs/003_IgG-1D_DSD/ -r IgG-1D/init_mask/backproj_0.005.mrc --downfrac 0.75 --valfrac 0.25 --lamb 2. --split sp-split.pkl --bfactor 4. --templateres 224
RECOVAR
Note that to run the RECOVAR reconstruction pipeline, you will have to use the path to the pipeline submission file from within the git submodule that was checked out during CryoBench installation. This command took 47 minutes to run employing a single A100 GPU:
$ conda activate recovar_model
(recovar_model)$ python ~/dev/CryoBench/metrics/methods/recovar/pipeline.py IgG-1D/images/snr0.005/sorted_particles.128.txt --ctf IgG-1D/combined_ctfs.pkl --poses IgG-1D/combined_poses.pkl --lazy --mask IgG-1D/init_mask/mask.mrc -o cryobench/inputs/004_IgG-1D_recovar/
CryoSPARC
Our GitHub repository contains example scripts for the output of CryoSPARC 3D Classification, Ab-initio Reconstruction, 3D Flex, and 3D Variability models. We refer to the CryoSPARC documentation for how to run these models.
Last updated