tomodrgn graph_traversal#

Purpose#

Identify particle indices forming the most efficient path through latent space, while connecting specified starting and ending points by way of specified anchor points.

Sample usage#

The examples below are adapted from tomodrgn/testing/commandtest*.py, and rely on other outputs from commandtest.py to execute successfully.

# Warp v1 style inputs
tomodrgn \
    graph_traversal \
    output/vae_both_sim_zdim8_dosetiltweightmask_batchsize8/z.39.train.pkl \
    --anchors 5 10 15 20 \
    -o output/vae_both_sim_zdim8_dosetiltweightmask_batchsize8/graph_traversal \
    --max-neighbors 20 \
    --avg-neighbors 20

# WarpTools style inputs
tomodrgn \
    graph_traversal \
    output/vae_warptools_70S_zdim8_dosetiltweightmask_batchsize8/z.39.train.pkl \
    --anchors 5 10 15 20 \
    -o output/vae_warptools_70S_zdim8_dosetiltweightmask_batchsize8/graph_traversal \
    --max-neighbors 20 \
    --avg-neighbors 20

Arguments#

usage: graph_traversal [-h] --anchors ANCHORS [ANCHORS ...] -o OUTDIR
                       [--max-neighbors MAX_NEIGHBORS]
                       [--avg-neighbors AVG_NEIGHBORS]
                       [--plot-format {png,svgz}]
                       z

Positional Arguments#

z

Input latent embeddings z.pkl file

Core arguments#

--anchors

Indices of anchor points along desired trajectory. At least 2 points must be specified.

-o, --outdir

Directory in which to store output .txt/.pkl files of path indices and latent embeddings

--max-neighbors

The maximum number of neighbors to initially calculate distances for from each latent embedding

Default: 10

--avg-neighbors

Used to set a cutoff distance defining connected neighbors such that each embedding will have this many connected neighbors on average

--plot-format

Possible choices: png, svgz

File format with which to save plots

Default: 'png'

Common next steps#

  • Validate the inferred latent space graph traversal by isolating indices of particles proximal to each neighbor point or anchor point along the path, and performing homogeneous reconstructions with tomodrgn backproject_voxel or external STA software