API Reference#

For users simply looking to analyze their datasets with tomoDRGN, we recommend just using the CLI commands. Should you wish to dive deeper into tomoDRGN’s source code, this section details the Python API of each tomoDRGN core module and command script.

TomoDRGN core#

tomodrgn.analysis

Functions for analysis of particle metadata: index, pose, ctf, latent embedding, label, tomogram spatial context, etc.

tomodrgn.beta_schedule

Classes and functions to facilitate sampling beta values per minibatch when training a VAE.

tomodrgn.config

Functions to create, edit, and view tomoDRGN config.pkl files

tomodrgn.convergence

Functions to aid estimation of model training convergence.

tomodrgn.ctf

Functions for Contrast Transfer Function calculation, correction, and display

tomodrgn.dataset

Classes and functions for interfacing with particle image data and associated starfile metadata.

tomodrgn.dose

Functions to model transmission electron microscopy signal degradation as a function of cumulative electron dose and stage tilt

tomodrgn.fft

Fourier and Hartley transform functions for numpy arrays and pytorch tensors

tomodrgn.lattice

Classes and functions for interfacing with 2-D voxel grids representing a lattice of voxel coordinates.

tomodrgn.lie_tools

Tools for dealing with SO(3) group and algebra Adapted from pimdh/lie-vae All functions are pytorch-ified

tomodrgn.losses

Classes and functions for handling model loss calculations

tomodrgn.models

Classes for creating, loading, training, and evaluating pytorch models.

tomodrgn.mrc

Classes and functions for loading and writing .mrc(s) headers and data.

tomodrgn.pose

Classes and functions to retrieve and optionally update image poses (defined as rotations and translations) via neural networks backpropogation.

tomodrgn.set_transformer

Set transformer classes adapted from juho-lee/set_transformer under MIT license

tomodrgn.so3_grid

Implementation of Yershova et al. "Generating uniform incremental grids on SO(3) using the Hopf fribration" See source code implementation: https://lavalle.pl/software/so3/so3.html.

tomodrgn.starfile

Lightweight parsers for starfiles

tomodrgn.utils

Common utility functions pertaining to both data processing and script execution

TomoDRGN commands#

tomodrgn.commands.analyze

Visualize latent space and generate volumes

tomodrgn.commands.analyze_volumes

Analyze a volume ensemble in real space using a combination of masking, PCA, UMAP, and k-means clustering.

tomodrgn.commands.backproject_voxel

Backproject 2-D images to form 3-D reconstruction with optional filtering and weighting

tomodrgn.commands.cleanup

Clean an analyzed train_vae output directory of various types of outputs.

tomodrgn.commands.convergence_nn

Assess convergence of a decoder-only network relative to an external volume by FSC

tomodrgn.commands.convergence_vae

Assess convergence and training dynamics of a heterogeneous VAE network

tomodrgn.commands.downsample

Downsample an image stack or volume by Fourier cropping

tomodrgn.commands.eval_images

Evaluate a trained TiltSeriesHetOnlyVAE model to embed particle images in the learned latent space

tomodrgn.commands.eval_vol

Evaluate a trained FTPositionalDecoder model, optionally conditioned on values of latent embedding z.

tomodrgn.commands.filter_star

Filter a .star file by selected particle or image indices, optionally per-tomogram

tomodrgn.commands.graph_traversal

Sample latent embeddings along the shortest path through the latent space nearest neighbor graph which connects specified anchor points.

tomodrgn.commands.pc_traversal

Sample latent embeddings along latent space principal components at specified points.

tomodrgn.commands.subtomo2chimerax

Create a ChimeraX command script (.cxc) to map particles back to their source positions within a tomogram.

tomodrgn.commands.train_nn

Train a FTPositionalDecoder neural network to reconstruct a 3D density map given 2D images from a tilt series with known pose and CTF parameters

tomodrgn.commands.train_vae

Train a VAE for heterogeneous reconstruction with known pose for tomography data

tomodrgn.commands.view_config

Display config information of a tomoDRGN job