Skip to content

A collection of convenient python tools for cryoDRGN.

License

Notifications You must be signed in to change notification settings

kttn8769/cryodrgn_utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cryodrgn_utils

Overview

A collection of convenient python tools for cryoDRGN.

cryoDRGN: http://cb.csail.mit.edu/cb/cryodrgn

Installation

Use poetry

Poetry: https://python-poetry.org

> git clone https://github.com/kttn8769/cryodrgn_utils.git
> cd cryodrgn_utils

# This creates a virtual environment for cryodrgn_utils.
> poetry install

# This launches a new shell session, where cryodrgn_utils' commands are available.
> poetry shell

Use pip

A pip package is in preparation.

Example usages

All the commands (cryodrgn_utils_*) display help messages when invoked with a --help option.

cryodrgn_utils_plot_z

Creates 2D scatter plot figures and (optionally) a combined gif movie of latent variables generated by cryoDRGN train_vae. Check how the latent variables are getting organized during the cryoDRGN model training.

This program internally performs PCA on the last epoch's latent variables, then plot the PC1 and PC2 of the each epoch's latent variables.

# Change directory to a cryoDRGN result directory.
> cd 27_vae128_zdim10_seed1

# Typical contents. z.*.pkl files are the latent variables after each epoch's training.
> ls
config.pkl      weights.11.pkl  weights.16.pkl  weights.3.pkl  weights.8.pkl  z.10.pkl  z.15.pkl  z.2.pkl  z.7.pkl
run.log         weights.12.pkl  weights.17.pkl  weights.4.pkl  weights.9.pkl  z.11.pkl  z.16.pkl  z.3.pkl  z.8.pkl
weights.0.pkl   weights.13.pkl  weights.18.pkl  weights.5.pkl  weights.pkl    z.12.pkl  z.17.pkl  z.4.pkl  z.9.pkl
weights.1.pkl   weights.14.pkl  weights.19.pkl  weights.6.pkl  z.0.pkl        z.13.pkl  z.18.pkl  z.5.pkl  z.pkl
weights.10.pkl  weights.15.pkl  weights.2.pkl   weights.7.pkl  z.1.pkl        z.14.pkl  z.19.pkl  z.6.pkl

# List up z.<epoch number>.pkl files and pass them as --infiles option arguments.
#  The pkl files will be sorted by the epoch numbers internally, so don't care the order of the files.
> cryodrgn_utils_plot_z --infiles z.*.pkl --outdir zplots --generate-movie --figsize 5 --dpi 100

# Result files. *.png are the each epoch's latent variables (PC1/PC2 on the basis of the last epoch's PCA).
#  z_movie.gif is the combined movie file.
> ls zplots/
z_epoch_000.png  z_epoch_003.png  z_epoch_006.png  z_epoch_009.png  z_epoch_012.png  z_epoch_015.png  z_epoch_018.png
z_epoch_001.png  z_epoch_004.png  z_epoch_007.png  z_epoch_010.png  z_epoch_013.png  z_epoch_016.png  z_epoch_019.png
z_epoch_002.png  z_epoch_005.png  z_epoch_008.png  z_epoch_011.png  z_epoch_014.png  z_epoch_017.png  z_movie.gif

z_movie.gif

About

A collection of convenient python tools for cryoDRGN.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages