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 pickingGo to the Particle detection tab:
Set
Detection methodto virionsSet
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 50Set
Detection methodto uniformSet
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:
an exploration phase to identify particles of interest
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 typeto 3D onlySet
Epochsto 50Set
Bounding box (binned voxels)to 72Set
Interval to perform validationto 5Set
Gaussian filterto 0Set
DoG sizesto 2,5Set
DoG cutoff (std multiplier)to 2Set
DoG diameter (binned voxels)to 20Set
DoG boundary margin (binned voxels)to 0Enable
Surface constrainedSet
Segmentation directoryto the location of themrcfolder in the segmentation block. You can get the path to the segmentation block by clickingShow filesystem locationfrom the block menuSet
Use DoGto DoGSet
Min distanceto 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.pthwhereYYYYMMDD_HHMMSSis the date and time of training.Set
Clustersto 30Set
Read patchesto the location of thetrain/3d_patch_info_train.npzfile 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
Epochsto 100Set
Bounding box (binned voxels)to 36Set
Interval to perform validationto 10Enable
Surface constrainedSet
Segmentation directoryto the location of themrcfolder in the segmentation block. You can get the path to the segmentation block by clickingShow filesystem locationfrom the block menuSet
Use DoGto DoGSet
Min distanceto 5
Disable
Remove segmentationEnable
IterateSet
Patch coordinate locationto the location of thetrain/interactive_info_parquet.gzipfile in the first evaluation block.Set
Class labelsto a comma separated list of classes that contain spike proteinEnable
Save patchesClear
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 evaluateSet
Clustersto 30Set
Read patchesto the location of thetrain/3d_patch_info_train.npzfile 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 trainingto class labels from MiLoPYPSet
Class IDsto a comma separated list of classes that contain spike protein
Set
Epochsto 10Set
Max number of particlesto 600Set
Validation interval (epochs)to 10Enable
Use maskingSet
Segmentation directoryto the location of themrcfolder in the segmentation block
Set
Patch size downscalingto 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.pthwhereYYYYMMDD_HHMMSSis 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
nextPYPHow 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.