DHVI workshop (day 2)

Session 1: Geometry-based picking

In this session, we will show how to automate the picking of HIV-1 Gag from the surface of immature virions. We will also extract the normal orientation at the location of each particle to facilitate 3D refinement.

Before we start, we will measure the diameter of the virions using the measure tool in the Pre-processing block.

Step 1: Virion selection
  • Click on Tomograms (output of the Pre-processing block) and select Particle picking

  • Go to the Particle detection tab:

    • Set Detection method to virions

    • Set Virion radius (A) to 500 (value obtained using measure tool)

  • Click Save

Step 2: Virion segmentation
  • Click on Particles (output of the Particle picking block) and select Segmentation (closed surfaces)

  • We will leave all default settings here

  • Click Save

Step 3: Gag protein detection
  • Click on Segmentation (closed) (output of the Segmentation (closed surfaces) block) and select Particle picking (closed surfaces)

  • Go to the Particle detection tab:

    • Set Particle radius (A) to 50

    • Set Detection method to uniform

    • Set Size of equatorial band to restrict spike picking (A) to 800

  • Open the Run tab and click Start Run for 3 blocks. Follow the status of the run on the Jobs tab

This will produce a total of approximately 12k particles.

nextPYP supports many other methods for 3D particle picking, including size-based, 3D template-matching, etc.

Session 2: Molecular pattern mining

In this session, we will demonstrate how to use MiLoPYP-2, a new membrane-aware framework designed to facilitate particle picking from irregular and more challenging samples. The basic workflow is composed of two stages:

  1. an exploration phase to identify particles of interest

  2. a refinement phase to accurately pick all instances of the identified target

Part 1: MiLoPYP-2 exploration

In the exploration phase, we use the segmentations we calculated yesterday to automatically filter out the candidate particle locations that are too close or too distant to any surface. We also orient the patches so that they are normal to the surface, making all the spike proteins aligned.

We also use a feature called iterative exploration, which is one of the main strengths of this pipeline. Even after the initial filtering, it can still initially be difficult to cluster all the good patches we want since their numbers are usually quite low compared to bad patches. Luckily, it is usually much easier to cluster bad patches. We use this to our advantage by doing multiple iterations of exploration, where each iteration removes clusters with bad patches rather than trying to find clusters with only good patches.

Iteration 1
  • Click on Tomograms (output of the Denoising (eval) block) and select MiLoPYP (train)

  • On the Pattern Mining tab:

    • Set Input type to 3D only

    • Set Epochs to 50

    • Set Bounding box (binned voxels) to 72

    • Set Interval to perform validation to 5

    • Set Gaussian filter to 0

    • Set DoG sizes to 2,5

    • Set DoG cutoff (std multiplier) to 2

    • Set DoG diameter (binned voxels) to 20

    • Set DoG boundary margin (binned voxels) to 0

    • Enable Surface constrained

      • Set Segmentation directory to the location of the mrc folder in the segmentation block. You can get the path to the segmentation block by clicking Show filesystem location from the block menu

      • Set Use DoG to DoG

        • Set Min distance to 5

    • Enable Save patches

  • Click Run

  • Click on MiLoPYP model (output of the first MiLoPYP (train) block) and select MiLoPYP (eval)

  • On the Pattern mining tab:

    • Set Trained model (*.pth) to the location of the model you want to evaluate, for example, YYYYMMDD_HHMMSS/model_50.pth where YYYYMMDD_HHMMSS is the date and time of training.

    • Set Clusters to 30

    • Set Read patches to the location of the train/3d_patch_info_train.npz file in the first training block.

  • Click Run

Iteration 2
  • Click on MiLoPYP particles (output of the first MiLoPYP (eval) block) and select MiLoPYP (train)

  • On the Pattern mining tab:

    • Set Epochs to 100

    • Set Bounding box (binned voxels) to 36

    • Set Interval to perform validation to 10

    • Enable Surface constrained

      • Set Segmentation directory to the location of the mrc folder in the segmentation block. You can get the path to the segmentation block by clicking Show filesystem location from the block menu

      • Set Use DoG to DoG

        • Set Min distance to 5

    • Disable Remove segmentation

    • Enable Iterate

    • Set Patch coordinate location to the location of the train/interactive_info_parquet.gzip file in the first evaluation block.

    • Set Class labels to a comma separated list of classes that contain spike protein

    • Enable Save patches

    • Clear Read patches

  • Click Run

  • Click on MiLoPYP Model (output of the second MiLoPYP (train) block) and select MiLoPYP (eval)

  • On the Pattern mining tab:

    • Set Trained model (*.pth) to the location of the model you want to evaluate

    • Set Clusters to 30

    • Set Read patches to the location of the train/3d_patch_info_train.npz file in the second training block.

We did 2 iterations for the exploration phase in this tutorial. However, the strategy can be changed depending on the preferred trade off between time and accuracy. In some cases, it may be necessary to change parameters such as min/max distance, DoG sizes, or DoG cutoff to start with more candidate locations.

Part 2: MiLoPYP-2 refinement

Refinement phase also uses the segmentations to constrain particle picking to surfaces. This is done by creating a binary mask based on the distance from the segmentation. This binary mask is then used to filter input and output coordinates, in the loss function, or to modify the input tomograms to directly remove any signal outside the mask.

Refinement

Step 1: Training

  • Click on MiLoPYP particles (output of the last MiLoPYP (eval) block) and select Particle picking (train)

  • On the Training/Evaluation tab:

    • Set Coordinates for training to class labels from MiLoPYP

      • Set Class IDs to a comma separated list of classes that contain spike protein

    • Set Epochs to 10

    • Set Max number of particles to 600

    • Set Validation interval (epochs) to 10

    • Enable Use masking

      • Set Segmentation directory to the location of the mrc folder in the segmentation block

    • Set Patch size downscaling to 3

  • Click Run

Step 2: Evaluation

  • Click on Particles model (output of the Particle picking (train) block) and select Particle picking (eval)

  • On the Training/Evaluation tab:

    • Set Trained model (*.pth) to the location of the model you want to evaluate, for example, YYYYMMDD_HHMMSS/model_25.pth where YYYYMMDD_HHMMSS is the date and time of training.

    • Set Particle radius (A) to 80

  • Click Run

  • Click on Particles model (output of the Particle picking (train) block) and select Particle picking (eval)

  • On the Training/Evaluation tab:

    • Set Trained model (*.pth) to “/nfs/bartesaghilab/nextpyp/workshop_dhvi/10453/model_20.pth”

    • Set Particle radius (A) to 80

  • Click Run

Day 2 summary

What we learned today
  • How to apply geometry-based picking to detect Gag protein from HIV-1 virions

  • Other particle picking methods available in nextPYP

  • How to use MiLoPYP-2 to pick spike proteins from SARS-CoV-2 virions

On day 3 we will demonstrate nextPYP’s functionality for 3D refinement.