Skip to content

Auto Align (Neural network)

Michael A. Cianfrocco edited this page Jun 9, 2018 · 2 revisions

Home > 2D classification > Auto Align

Running Auto_Align.py

By wrapping the neural network-based algorithm into a python script, TEM | pro offers a single python command that will perform the iterative analysis for you.

  1. Preparing the single particles
  2. Running Auto_Align.py
  3. Input options for Auto_Align.py
  4. Outputs

Preparing the single particles

In general, it is better to go from a wide number of references (~10 particles / class) to (100-200 particles / class) over the course of 8 - 9 iterations. This casts a wide-net to start, but since there are ~10 particles / class, there should be some underlying signal that has been enriched.

To facilitate particle alignment, it helps to perform both low and high pass filters to your particles, in addition to applying a circular mask.

Example command to prepare your particle stack:

$ EM-processing/2D-classification/prep_stack_for_2DAlignment.py -i stack_00_sel.img --num=562 --apix=4 --lp=15 --hp=250 --mask=60
  • stack.img - input imagic stack
  • stack_prep.img - output imagic stack, filtered and masked
  • apix=4 - pixel size of images (4 A/ pix in this example)
  • hp=250 - high pass filter (Angstroms)
  • lp=15 - low pass filter (Angstroms)
  • mask=60 - circular mask applied to particles (pixel radius)

Running Auto_Align.py

To run Auto_Align.py, you can see all of the input options by running it without any commands:

$ EM-processing/2D-classification/Auto_Align.py 
usage: Auto_Align.py -i  -o  --num=[number of particles in stack] --iter=[num. of iterations] --start=[starting class number] --final=[final class number]

options:
  -h, --help    show this help message and exit
  -i FILE       Particle stack (.img)
  -o FILE       Output folder name for iterative alignment & classification
  --num=INT     Number of particles in stack
  --iter=INT    Number of iterations
  --start=INT   Starting number of classes
  --final=INT   Final number of classes
  --imagic      Flag to use Imagic for MRA
  --eman        Flag to use EMAN for MRA
  --spider      Flag to use SPIDER for MRA
  --radius=INT  SPIDER input option: radius for searching (pixels)
  --nomirrors   SPIDER input option: flag to NOT check mirrors  (for RCT)
  --keep        Flag to keep aligned stacks from iterative alignment
  -d            debug

Considering that this program will be calculating inter-particle scores, the more CPUs on your workstation, the faster the program will run.

Input options for Auto_Align

-i input stack Input stack, imagic stack (.img/hed)

-o output folder Folder for alignment outputs. The program will create this folder when you submit the command.

--num=number of particles Number of particles in input stack

--iter=number of iterations Number of iterations for alignment. Usually 8 - 10 will be sufficient.

--start=starting number of classes Number of references calculated in first iteration.

--final=final number of classes Number of references in final iteration.

--imagic / --spider / --eman Specify software for multi-reference alignment.

--keep By default, the program will delete all intermediate particle stacks created during the alignment. If you would like to keep them instead of deleting them, specific this input option.

If --spider is specified, you need to specify the radius you wanted searched:

--raidus=radius for searching Radius (in pixels) searched during alignment

--nomirrors Include this option to NOT check mirrors during alignment. This option is only important during 2D alignment for RCT / OTR volume calculation.

Outputs

Into the output folder specified above (e.g. 'first_align'), this program will output a series of folders named in order up until the final number of iterations specified by the user (e.g. 10):

first_align/auto_iteration_1
first_align/auto_iteration_2
...
first_align/auto_iteration_10

Into each auto_iteration folder, there will be the following outputs.

Class averages

These are 2D stacks of class averages calculated for a given iteration. They are named:

first_align/auto_iteration_1/classsums1_avg.img/hed
...
first_align/auto_iteration_10/classsums10_avg.img/hed
Particle membership per class

To help you determine which particle went to which class for a given iteration, there are text files numbered according to the class average number, and they contain lists of particle numbers to indicate which particle went into which class:

first_align/auto_iteration_1/classsums1_class_0001.spi
...
first_align/auto_iteration_1/classsums1_class_0200.spi
References used for alignment

For each set of class averages, there are also filtered, aligned class averages for each iteration that were used to align all single particles:

first_align/auto_iteration_1/classsums1_center.img
first_align/auto_iteration_1/classsums1_center_prep.img
first_align/auto_iteration_1/classsums1_center_prep_mask.img
first_align/auto_iteration_1/classsums1_center_prep_mask_norm.img

Where the above files are listed accordingly: the original class averages were 1) centered, and then 2) each class average was aligned to all other averages, and then the 3)resulting averages are masked, and 4) normalized.

Clone this wiki locally