Making long trajectories with cryoDRGN graph_traversal

using cryoDRGN's tool for creating nearest-neighbor paths in the latent z-space

CryoDRGN's graph traversal algorithm builds a nearest neighbor graph between all the latent embeddings, and then performs Dijkstra's algorithm to find the shortest path on the graph between the anchors nodes. The idea is to define a trajectory in latent space while remaining on the data manifold since we don't want to generate structures from unoccupied regions of the latent space.

The two commands to run are cryodrgn graph_traversal to create a latent space trajectory and cryodrgn eval_vol to generate volumes.

1) Create latent space trajectory

First, run cryodrgn graph_traversal to create a trajectory of z values. As a default, we recommend using the kmeans20 cluster centers as the anchor points:

(cryodrgn) $ cd analyze.49 # assuming you've already run cryodrgn analyze on epoch 49
(cryodrgn) $ cryodrgn graph_traversal ../z.49.pkl --anchors $(cat kmeans20/centers_ind.txt) -o graph_traversal/z-path.txt --outind graph_traversal/ind-path.txt

Replace z.49.pkl with z.N.pkl where N is the epoch number you are analyzing.

Note that you can specify the indices of arbitrary particles as the anchor points of the trajectory. These indices can be retrieved from the interactive visualization sections of the jupyter notebook, or by using the annotation features of the interactive tool employed by the cryodrgn filter command.

2) Generate volumes

cryodrgn graph_traversal will by default produce a text file containing a list of z values (z-path.txt). This may be converted to .mrc files with cryodrgn eval_vol:

(cryodrgn) $ cd graph_traversal
(cryodrgn) $ cryodrgn eval_vol ../../weights.49.pkl -c ../../config.yaml --zfile z-path.txt -o .

Replace weights.49.pkl with the epoch number you are analyzing.

This may generate a few hundred density maps. To save disk space, you can generate downsampled volumes with -d 128.

3) Create ChimeraX movie

In ChimeraX:

vol all level XYZ
vol all color cornflowerblue
mov record
mseries all
mov encode graph_traversal.isoXYZ.mp4 framerate 15

4) Create latent space movie

Scripts to help create a latent space movie of the associated trajectory (e.g. video, right) coming soon.

Last updated