-
Notifications
You must be signed in to change notification settings - Fork 4
Semi automated tilt pair particle picking
Home > Semi automated tilt pair particle picking
We have combined the graphical user interface of a tilt-pair picking program (ApTiltPicker.py) with the power of automated single particle picking with Signature to create a semi-automated particle picking routine that can be used for RCT and OTR initial model calculations: ApTiltPicker_import.py
In order to use the ApTiltPicker_import.py program, you will need to follow these steps:
- Pick particles automatically using Signature
- Create a text file containing all of the tilt pairs
- Run ApTiltPicker_import.py
- Input options
-
Using the graphical user interface
-
Overall workflow
- Pick 5 - 10 particle matches between tilt mates
- Calculate the tile angle (Theta)
- Refine the tilt angle (theta) as well as shifts and in-plane rotations
- Import particle picks from automatic picking in Signature
- Further optimize transformation matrix
- Save matching particle picks & continue onto next micrograph
- Troubleshooting
-
Overall workflow
First, automatically pick particles from untilted AND tilted micrographs separately. This means that users will run Signature first on the untilted micrographs, THEN the tilted micrographs. The reason to pick untilted and tilted micrographs separately is that the cross-correlation threshold for specifying the 'selected' particle will be different for the untilted and tilted micrographs.
The output from Signature will be .box files that have the same name as the micrograph with the exception that they have a different extension, .box.
Using the python script make_tilt_pair_file.py to create a text file listing each tilt mate from your dataset.
Input options:
$ EM-processing/Picking_Particles/Tiltpicker/make_tilt_pair_file.py
Usage: make_tilt_pair_file.py -p <path/to/images> -o <output> --Uext=[untiltExtension] --Text=[tiltExtension]
Options:
-h, --help show this help message and exit
-p FILE Absolute path to the folder containing tilt-mates
-o FILE Output file to contain tilt mates
--Uext=STRING Untilted micrograph extension (e.g. '00', 'u')
--Text=STRING Tilted micrograph extension (e.g. '01', 't')
--leginon Flag if tilt mates came from leginon
-d debug
Example command:
$ EM-processing/Picking_Particles/Tiltpicker/make_tilt_pair_file.py -p data/ -o data/rct_tiltpair.txt --Uext=049b --Text=048b
This creates a new text:
data/rawu049b.mrc data/rawu048b.mrc
NOTE: If you collected data using leginon, you must run the above command with the --leginon flag.
If you were running an older version of leginon (pre 3.0) to collect your tilt data, then there is a 'v' within the filenames that needs to be dealt with. In order to create the correct text file with tilt pairs, follow these steps:
- Copy make_tilt_pair_file_OldLeginon.py to the directory containing the tilted and untilted .mrc micrographs, which have 00.mrc as the tilted images and 01.mrc as the untitled images.
- Run script and specify output text file:
$ make_tiltpair_file_OldLeginon.py [outputfilename].txt
To loop over all micrographs listed in the newly created text file, you can run the command runApTiltPicker_import.py.
$ EM-processing/Picking_Particles/Tiltpicker/runApTiltPicker_import.py
Usage: runApTiltPicker_import.py -i <input micrograph> -t <template imagic stack> --apixMicro=[pixel size] --apixTemplate=[pixel size] --boxsize=[box] --diam=[particle diameter] --thresh=[threshold] --mirror --bin=<bin> --all='wildcard'
Options:
-h, --help show this help message and exit
--micros=STRING Input file containing tilt pair names
--binning=INT Binning factor for picking (Default=4)
--microdims=INT Micrograph dimensions (Default=4096)
--box=INT Specify output box size for particles in UNbinned
micrograph.
--extract Flag to extract particles into unbinned particle stacks
--output=STRING OPTIONAL: If extracting particles, specify output base name
of stacks (Default=output_stack).
-d debug
Example command:
Output box files with aligned, matched coordinates:
- data/raw049b_tiltPicked.box
- data/raw048b_tiltPicked.box
- data/raw_stack_tiltstack.img/hed
- data/raw_stack_untiltstack.img/hed
Where:
- binning - the user has the option to bin the micrographs for viewing
- microdims - this option is used to in combination with the box size to remove any particles that may be outside of the micrograph
- box - box size used to check if particles are outside of micrograph
- extract - (OPTIONAL) flag option to use batchboxer to extract particles into output stacks
- output - (OPTIONAL) basename for output stacks. The base name will have the suffix _untiltstack.img and _tiltstack.img added
After executing the above command, a GUI will open for each micrograph tilt pair. You will use the GUI to determine the rotation, shift, and tilt angle between the tilt mates. After which point, the program will determine which particles are 'tilt mates' between each image, so that you can have a list of particle-tilt mates exported from the program that are perfectly in register.
NOTES:
- If at any point, you wish to NOT pick particles from a set of tilt mates, click 'Forward' with NO particles selected. And no particles will be saved.
- If you close the loop, you can always return by running the same command. By default, the program will skip all micrographs that already have particles picked from them.
- Pick 5 - 10 of the same particle in the untilted and tilted micrographs.
- Calculate the tile angle (Theta).
- Refine the tilt angle (theta) as well as shifts and in-plane rotations.
- Import particle picks from automatic picking in Signature.
- Further optimize transformation matrix.
- Save matching particle picks & continue onto next micrograph.
In order to calculate the tilt angle, this program requires a starting set of 5 - 10 manually selected particle tilt mates, where IDENTICAL particles from the tilt mates are selected. By comparing the coordinates of these identical tilt mates, the program is able to calculate the tilt angle between the untilted and tilted micrographs.
To do this, first execute the above script runApTiltPicker_import.py. For example:
$ EM-processing/Picking_Particles/Tiltpicker/runApTiltPicker_import.py --micros=data/rct_tiltpair.txt --binning=2 --microdims=1600 --box=80 --extract --output=data/raw_stack
This will open a GUI for each tilt pair of your dataset, one at a time. The GUI will display:
- Both untilted and tilted micrographs side-by-side
- You can adjust the magnification by clicking on the pull down window for each micrograph
To start processing this tilt pair, you first need to pick 5 - 10 particles mates so that the program can calculate an initial transformation matrix to relate the two images together. This means that you need to select identical particles from each micrograph: (show as red and blue circles below)
NOTE: The more particle pairs, and the more widely distributed they are across the micrograph, the better the alignment and particle registration is for the tilt mate.
Now that you have selected 5 - 10 known pairs, the program will calculate an initial tilt angle (theta) between the micrograph. To do this:
- Click the Theta button in the bottom left corner
- In the next window, click 'Run'.
- You will see an angle appear in the window. This should be CLOSE to the actual tilt angle that you applied in the microscope. If it is WIDLY off, then you need to pick more particles more evenly distributed across the micrographs. This means that the program did not find a high-confidence solution to the matrix that relates the two micrographs together.
After calculating an initial tilt angle that is close to what you actually tilted in the microscope, you can now refine the tilt angle, in addition to refining other shifts and rotations.
To do this:
- Click the 'Optimize' button on the lower left
- In the next window, click 'Run' many times (10 +) and you will see the RMSD lower down to around 1 pixel. Ideally, less than 1 pixel RMSD is required, but up to 2 pixels is OK. This metric tells you how good of a transformation matrix is that you calculated between the two images.
- If you CANNOT get an RMSD below 2 pixels - click 'Cancel' and go to select more particles, while ALSO double checking that your original picks correspond to the exact same particle.
- When the RMSD goes below 2 pixels, then click 'Apply'
You will now see crosses appear within each particle. The centering of this cross relative to the circle defines the deviation measured by the RMSD.
At this point, the program has calculated an accurate transformation matrix that relates the untilted and tilted images together. This means that it can took to different particle picks (picked automatically by Signature), compare the particle picks and matrix, and come up with a list of particle tilt mates.
To do this:
- Click 'Import' on the bottom menu of buttons
- It will open a new window asking if it is OK to import X number of tilt pair particles
- Click 'Yes'
Now you SHOULD see all 'real' particles that you wanted to be picked, be displayed by red and blue circles between the untilted and tilted micrographs.
At this point, you can further optimize the transformation matrix that describes the relationship between the untilted and tilted micrographs.
To do this:
- Click 'Auto Optimize' on the lower menu of buttons
- You will see the program redo the 'Theta' and 'Optimize' functions, as well as mask the micrographs so that only the overlapping regions are displayed.
- This should provide better particle centering for later analysis
Now that you have calculated accurate particle tilt mates for your untilted and tilted micrographs, you can save your picks and move forward onto the next micrograph.
To do this:
- Click the 'Forward' button, and the particles will be automatically saved and the next tilt mates will be displayed.
If, during the process of calculating Theta and other tilt parameters, you do not achieve accurate registry, you may need to start over and pick DIFFERENT particles from all over the micrograph. This program will fail if small, tight clusters of particles are picked, which results in an incorrect transformation matrix.
When in doubt - clear picks and start over!