UW walk through

Session 1 - Pre-processing, segmentation, and denoising

For this session, we will use a subset of 26 tilt-series from the dataset Imm-ADA-Oct18-dataset.

Import data and pre-processing

Step 1: Import raw tilt-series
  • Click Import Data and select the Tomography tab, then Raw Data

  • On the Sources tab:

    • Set the Location by clicking on the icon and browsing to /nfs/bartesaghilab2/data/KellyLee/Imm-ADA-Oct18-dataset

    • Type Oct18-b4g1-TS-1*.tif into the filter box (lower right) and click the icon. You should see 1048 matches.

    • Click Choose File Pattern to add the path

  • On the Grouping tab:

    • Leave No movie frames unchecked

  • On the Microscope parameters tab:

    • Set Pixel size (A) to 0.6818

    • Set Acceleration voltage (kV) to 300

    • Set Tilt-axis angle (degrees) to 90

  • Click Run on the block status bar.

Step 2: Pre-processing
  • Click on Tilt-series (output of the Tomography (from Raw Data) block) and select Pre-processing

  • On the Frame alignment tab:

    • Set Alignment method to motioncor3

  • On the Tilt-series alignment tab:

    • Set Alignment method to aretomo3

    • Disable Auto binning

    • Set Binning for tilt-series alignment to 2

    • Disable Reshape tilt-images into squares

  • On the CTF determination tab:

    • Set Max resolution (A) to 6

    • Set Min defocus (A) to 15000

    • Set Max defocus (A) to 70000

  • On the Tomogram reconstruction tab:

    • Set Tomogram thickness (unbinned voxels) to 1536

    • Set 2D filtering to none

    • Enable Generate half-tomograms

  • On the Resources tab

    • Set Split, Threads to 11

    • Set Split, Bundle size to 13

  • Click Run. Follow the status of the run in the Jobs panel

Tomogram segmentation

For segmenting tomograms, we will use a pre-trained MemBrain-Seg model that can be directly applied to tomograms produced by the pre-processing block.

Step 3: Segmentation
  • Click on Tomograms (output of the Pre-processing block) and select Segmentation (pre-trained models)

  • On the Tomogram segmentation tab:

    • Enable Pre-process tomograms

      • Set Pixel size rescaling to 11

      • Enable Deconvolution filter

    • Set Pre-trained model (*.ckpt) to /nfs/bartesaghilab/membrain-seg-models/MemBrain_seg_v10_alpha.ckpt

    • Set Filter connected components to by size

      • Set Size threshold (binned voxels) to 15000

    • Enable Test time augmentation

    • Set Sliding window size to 96

  • Click Run. Follow the status of the run in the Jobs panel

Filtering tomograms

To speed up the next step, we will create a filtered dataset that only includes the fist 10 tomograms.

Create filter
  • Click inside the Pre-processing block and go to the Table view.

  • Create a new filter by providing a name and clicking Save.

  • Manually include or exclude individual tomograms using the Exclude column in the table.

  • Once you are satisfied with the results, click Save to store the filter settings.

Tomogram denoising

For denoising tomograms, we will demonstrate the use of IsoNet2. Unlike segmentation models that can generalize well to different types of data, denoising models typically require re-training to achieve the best performance.

Step 1: Training
  • Click on Tomograms (output of the Pre-processing block) and select Denoising (train)

  • Select the filter we created in the previous step from the Filter tomograms dropdown menu.

  • On the Tomogram denoising tab:

    • Set Method to isonet2

    • Enable Use masking

      • Set Epochs for training to 30

      • Set Loss function to Huber

      • Set CTF mode to “None”

      • Set B-factor to 200

    • Set Epochs for training to 30

    • Set Loss function to Huber

    • Set Missing wedge weight in loss to 200

    • Set B-factor to 200

  • Click Run. Follow the status of the run in the Jobs panel

Step 2: Evaluation
  • Click on Tomograms (output of the Pre-processing block) and select Denoising (eval)

  • On the Tomogram denoising tab:

    • Set Method to isonet2

    • Set Trained model to isonet2/isonet_network_isonet2-n2n_unet-medium_96_full.pt (if you skipped the previous step, you can use the model /nfs/bartesaghilab2/data/KellyLee/Imm-ADA-Oct18-dataset/isonet_network_isonet2-n2n_unet-medium_96_full.pt)

  • Click Run. Follow the status of the run in the Jobs panel

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

        • Set Max distance to 10

    • 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

        • Set Max distance to 10

    • 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, for example, YYYYMMDD_HHMMSS/model_10.pth

    • 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 30

    • Set Max number of particles to 600

    • Set Validation interval (epochs) to 1

    • Set Validation debug interval (epochs) to 5

    • Enable Use masking

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

      • Set Mask radius to 10

    • Set Patch size downscaling to 8

  • On the Resources tab:

    • Set Split, Gres to gpu:4

  • 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_30.pth where YYYYMMDD_HHMMSS is the date and time of training.

    • Set Particle radius (A) to 80

    • Set Threshold for soft/hard positives to 0.95

    • Set Initial particle orientation(s) to “from segmentation(s)”

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

  • On the Resources tab:

    • Clear Split, Gres

  • 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/bartesaghilab2/data/KellyLee/Imm-ADA-Oct18-dataset/model_50.pth”

    • Set Particle radius (A) to 80

    • Set Threshold for soft/hard positives to 0.95

    • Set Initial particle orientation(s) to “from segmentation(s)”

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

  • On the Resources tab:

    • Clear Split, Gres

  • Click Run

Session 3: Sub-tomogram averaging

Traditional sub-tomogram averaging is a powerful strategy for de novo structure determination that involves doing iterative 3D classification, alignment, and averaging of sub-tomograms. The results can be used as a starting point for high-resolution refinement using constrained single-particle tomography.

For this session, we will use the particles we obtained yesterday for the SARS-CoV-2 dataset.

Step 1: Sub-volume extraction
  • We first need to generate the sub-tomograms via the Particle picking (eval) block.

  • On the Training/Evaluation tab:

    • Set Initial particle orientation(s) to from segmentations(s)

      • Set Path to segmentation(s) to the location of the mrc folder in the segmentation block

  • On the Particle extraction tab:

    • Set Sub-volume export format to 3davg (do not invert contrast)

    • Set Sub-tomogram size (voxels) to 64

    • Set Sub-tomogram binning to 4

    • Disable Use existing reconstruction settings

      • Set 2D filtering to none

      • Set Radial filtering to fakeSIRT (mimic SIRT reconstruction)

  • Click Run.

After generating the sub-volumes, add the four STA blocks in order (each block is one mode; iteration numbers come from the parent block — you do not type them). See Sub-tomogram averaging.

Iteration 1
  • Click Particles on Particle picking (eval) and choose STA centering

  • Set Alignments from sub-volume averaging (*.txt) by navigating to the frealign directory from the upstream block and selecting the file *_original_volumes.txt

  • Set Apply offset (binned voxels) to 10

  • Set Centering iterations to 1

  • Set Translation tolerance (binned voxels) to 15

  • Set Mask radius (binned voxels) to 16,16,24

  • Set Mask apodization (binned voxels) to 0

  • Set Low-pass filter (cutoff, decay) to 0.2,0.05

  • On the Resources tab

    • Set Launch, Threads to 128

  • Click Run.

  • Review results on View of the STA centering block.

  • Click Particles on STA centering and choose STA classification

  • Click Run.

  • On View, include or exclude classes and pick the reference class.

  • Click Particles on STA classification and choose STA refinement

  • Select Center reference if it appears

  • Click Run.

  • Review aligned class averages on View.

  • Click Particles on STA refinement and choose STA alignment

  • Click Run.

  • Review the aligned reference on View.

Iterations 2–4

Add another STA classification after STA alignment to start the next round (classification → refinement → alignment). Repeat through iteration 4.

  • Iteration 2 classification: set Mask radius (binned voxels) to 20,20,24

  • Iteration 2 refinement: do not center the reference

  • Iteration 3 classification: set Low-pass filter (cutoff, decay) to 0.25,0.05

  • Iteration 4 refinement: set C symmetry order to 3

If everything went well, you should have a good low-resolution model of the spike.

Session 4: Constrained single-particle tomography (CSPT)

In this session, we will use 2D projections extracted from the the raw tilt-series to reconstruct and refine the structure to higher-resolution.

../_images/cspt.webp

Constrained single-particle tomography (CSPT)

Step 1: Calculate reconstruction
  • Click on Particles (output of the STA alignment block) and select Calculate reconstruction

  • On the Sample tab

    • Set Molecular weight (kDa) to 500

    • Set Particle radius (A) to 90

    • Set Symmetry to C3

  • On the Extraction tab

    • Set Box size (pixels/voxels) to 64

    • Set Image binning to 4

  • On the Alignments tab

    • From the Import from dropdown menu, select 3DAVG (.txt)*

    Set Input parameter file (*.bz2) to tomo-sva-gclK6N3haDRIsnzp_iteration_00?_alignments_to_reference_0.txt

  • Go to the Resources tab

    • Set Split, Threads to 16

  • Click Run

Step 2: Particle translation and rotation refinement
  • Click on Particles (output of the Calculate reconstruction block) and select 3D refinement

  • On the Particle scoring function tab

    • Set Max resolution (A) to 16

  • On the Refinement tab

    • Set Input parameter file (*.bz2) to the file _r01_02_clean.bz2 file in the parent block

    • Check Refine particle alignments

    • Set Particle rotation Phi range (degrees) to 0

    • Set Particle rotation Psi range (degrees) to 0

    • Set Particle rotation Theta range (degrees) to 0

    • Set Particle translation range (A) to 50

    • Set Optimizer exhaustive search points to 10000

  • Click Run

Step 3: Particle filtering
  • Click on Particles (output of the 3D refinement block) and select Particle filtering

  • On the Particle filtering tab

    • Set Input parameter file(*.bz2) to the *.bz2 file that appears in the parent directory

    • Set Score threshold to 5.0

    • Set Min distance between particles (unbinned pixels) to 54

    • Enable Permanently remove particles

  • Click Run

Step 4: Masking (optional)
  • Click on Particles (output of the 3D refinement block) and select Masking

  • Go to the Masking tab

    • Set Input map (*.mrc) as the file that you want to use as a reference for masking (for example, _r01_0?.mrc)

    • Set Threshold for binarization to 0.5

  • Click Run

Step 5: Region-based refinement and tilt-geometry refinement (advanced)
  • Click on Particles (output of the Particle filtering block) and select 3D refinement

  • On the Particle extraction tab

    • Set Box size (pixels/voxels) to 256

    • Set Image binning to 1

  • On the Particle scoring function tab

    • Set Last tilt for refinement to 8

    • Set Max resolution (A) to 14:13

    • From the Masking strategy dropdown menu, select from file

    • Click the icon to select the Shape mask (*.mrc), browse to the desired mask file location, and click Choose File

  • On the Refinement tab

    • Set Input parameter file (*.bz2) to the file _r01_02_clean.bz2 file in the parent block

    • Set Last iteration to 3

    • Check Refine tilt-geometry

    • Check Refine particle alignments

    • Set Number of regions to 8,8,2

  • Click Run

    ../_images/regionbased.webp

    Region-based refinement splits tomograms into patches and refines them independently

Step 6: Movie frame refinement (advanced)
  • Click on Particles (output of the 3D refinement block) and select Movie refinement

  • Go to the Particle scoring function tab

    • Set Last tilt for refinement to 4

    • Set Max resolution (A) to 12

  • Go to the Frame refinement tab

    • Next to Input parameter file (*.bz2) click the icon. Select the _r01_03.bz2 file and click Choose File

    • Set Spatial sigma to 400

    • Set Time sigma to 16

  • Click Run

    ../_images/movie_refinement.webp

    Refinement of individual tilt-frames

Step 7: Post-processing
  • Click on Particles (output of any 3D refinement block) and select Post-processing

  • Go to the Post-processing tab

    • Set First half map (*_half1.mrc) to the file _half1.mrc in the parent block

    • Uncheck Estimate local resolution

  • Click Run