Full CryoLike pipeline from models and images to likelihood matrix

Overview

Below we describe all the steps needed to go from a set of structures and images to obtain a CryoLike likehood matrix.

Before starting, ensure you have a Python environment set up with all the required dependencies, as per the installation section. For the commands in this tutorial, we assume that the python command will invoke the Python interpreter associated with this environment.

Step 1 is only performed once. Steps 2 and 3 are performed when there are new models or particles. Step 4 is the one that actually calculates the likelihood, comparing all converted particles to all templates.

Step 1: Set parameters

Prepare the parameters.

Here we define the image and likelihood parameters and search ranges:

(venv) $ python set_image_parameters_example.py

See Parameter setup: Image Descriptor for details about the parameters, and Parameter-setting example for the example code. The full set of parameters are discussed further in the cryolike.metadata doc.

The optimal choice of parameters depends on the specific system being studied and is often selected empirically, based on an understanding of the structural differences involved and the available computational resources.

For systems where large conformational changes are expected—such as highly flexible molecules that undergo substantial structural rearrangements—it may be appropriate to use lower-resolution settings, especially if the goal is to track broad conformational transitions rather than fine structural details.

The parameters are written to a file in the output folder.

Step 2: Make Templates from maps or PDBs

Example k-centers are distributed with this repository in the example/data/map folder. We can make templates from these models using:

(venv) $ python make_templates_from_inputs_example.py

The resulting Templates objects are saved in the output/templates folder.

See Make templates from cryo-EM maps or atomic models for more information about this example, and Template Creation for details about the template creation functions.

Step 3: Convert images

We have the original particles as MRC files and STAR files. These are distributed with the repository in the example/data/particles directory.

To convert the particles in that folder, run

(venv) $ python convert_particle_stacks_example.py

Converted particles are stored in the output/particles folder.

See Image Conversion for an overview of image conversion, and Converting particles from CryoSPARC file formats and Converting particles from STAR file formats for tutorials on reading different image input file formats.

Step 4: Run likelihood

Now we have all the inputs needed to run the likelihood calculations on a gpu node:

(venv) $ python run_likelihood_example.py

The log-likelihood for each template and image batch is stored in a pytorch file. These outputs are stored in the output/likelihood folder.

Step 4: Collect likelihood matrix from output folders

(venv) $ python get_loglike_example.py

The output is the log likelhood matrix, which is a pytorch tensor with the shape (n_images,n_templates), saved as a text file.

Further Analysis