Tilt-Series Preprocessing
Launching the TOMOMAN Standalone Executable
Rather than using MATLAB in this tutorial, we will be using the TOMOMAN standalone executable. This is a compiled executable that provides all the functionalities of running TOMOMAN in MATLAB without the need for a license.
Open a dedicated terminal window to run the TOMOMAN standalone executable.
Ensure you are in your tomo/ directory.
Start TOMOMAN by running:
tomoman_standalone.sh
This will return a console window in which we will run various TOMOMAN tasks and functions. It may take a minute to start up the first time you run it.
NOTE: If you want to run a system command (i.e. a terminal command not a MATLAB command) in the standalone, prepend an
!.
Initializing TOMOMAN Parameter Files
In this step, we will copy a set of TOMOMAN parameter files to the tomogram folder. These parameter files are plain-text files that tell TOMOMAN which processing step you wish to run and the parameters for that step.
Copy empty parameter files for all TOMOMAN tasks to the current directory, using default TOMOMAN filenames, by running the below command in the TOMOMAN console.
tomoman_copy_paramfiles(pwd);
Parameter files for all TOMOMAN tasks are now copied into the root_dir, in this case, tomo/.
You can view the contents of tomo/ by running ls.
While files for all tasks are copied, they won’t all be used for this tutorial, and you may delete unused ones.
For the rest of the preprocessing tasks, we will be editing parameter files and running them in the TOMOMAN console. To facilitate this, we suggest you now open a new terminal window and go to the tomo folder.
cd ~/HIV_dataset/tomo/
Importing New Stacks
The first step in TOMOMAN processing is sorting new data into directories, one for each tilt series.
During this step, TOMOMAN scans a raw_stack_dir for .mdoc files.
For each one it finds, it generates a new folder to contain all the preprocessing data, links the .mdoc file, creates a frames/ subdirectory, parses frame names from the .mdoc file, and generates links for all frames from the raw_frame_dir to the frames/ subdirectory.
New data is imported using the tomoman_import.param file.
Open this file in any text editor, for example, you can use gedit:
gedit tomoman_import.param
NOTE: Most scripts and parameter files in this tutorial are formatted with very long lines. As such, they are typically best viewed without text wrapping. To disable text wrapping in gedit, open the preferences and untick the "Enable text wrapping" option.
Parameters specified here will determine how TOMOMAN imports and sorts new data. Types of parameters are typically broken into comment blocks.
-
The directory parameters block contains information about working directories The
root_dirshould already be set from copying. For this tutorial, theraw_stack_dirandraw_frame_dirarerawdata/andframes/, respectively. -
The tomolist block contains filenames for TOMOMAN’s output files. This should already be set during copying.
-
The filename parameters are to provide some inputs on the file naming conventions.
raw_stack_extdefines the extension for the raw tilt series file generated during data collection. For this dataset, we don’t have them so this can be left asnone.For tilt-series with a numerical naming convention, e.g. "Position_1", the
prefixparameter defines the prefix before the number and stores the number as atomo_numin the tomolist. For this dataset, setprefixtoTS_. -
The data collection parameters block contains information specific to the parameters used for data collection and the setup of the microscope. This dataset contains gain-normalized .mrc files, so set the
gainrefparameter tonone. All other defaults are fine. -
The override .mdoc values block allows users to override fields that are normally parsed from the .mdoc file. This may be important when certain settings aren’t properly calibrated in SerialEM. For this dataset, set the
tilt_axis_angleto85.3, thedose_rateto8, and thepixelsizeto1.35.target_defocuswill be parsed from the .mdoc file. When batch acquiring tilt series, it is typically the best choice to settarget_defocusduring data collection and subsequently parse it from the .mdoc during processing. -
The final block is the sorting parameters, which allows you to ignore certain missing files. Here raw stacks refer to tilt series image stacks generated during data collection; these are typically just non-motion corrected summed frame stacks, so they can be safely ignored. TOMOMAN also allows you to ignore missing frames, though this is not recommended.
-
After setting the parameters, save the file. To run the import task, run this command in the TOMOMAN standalone:
tomoman(pwd, 'tomoman_import.param');The
tomomancommand takes two inputs: aroot_dirto search for a param file and theparamfilenameto run. Since we started the standalone fromtomo/we can use our working directory (obtained using thepwdcommand) along with the import parameters filename.NOTE: You may get a warning about a missing
TS_01.mrcfile due to files referenced in the .mdoc but not copied for this tutorial. As long as importing still completes this can be disregarded.
The tilt series folder should now be properly set.
NOTE: the import task can be repeatedly run and only new data will be imported and sorted. This can be useful if you wish to process data during your data acquisition.
Making Motion-Corrected Stacks
The tilt series directory has been set up, but before we can examine it, we must first perform motion correction on the frames and assemble the motion corrected images into a stack. For this dataset, we will be using MotionCor3.
Open the tomoman_motioncor3.param file in a text editor and review its parameters.
-
The tomolist parameters should already be correctly set.
-
The TOMOMAN parameters set parameters for how TOMOMAN runs.
-
Most tasks have some "force" parameter, which tells TOMOMAN to repeat the task on tilt series that have already been processed. If set off, TOMOMAN only runs the task on tilt series that have not yet been processed. For this tutorial, leave
force_realignas 0. -
The
image_sizeparameter sets the output image size. This dataset was collected on a K2 in super-resolution mode but we want a normal resolution output image. Setimage_sizeto3712,3712; this pads a K2 image by 2 pixels in one axis, but results in an image size amenable to binning at factors of 2.
-
-
The MotionCor3 parameters block contains MotionCor3’s parameters. For this dataset, most of the defaults are fine. However, because the data was collected in super-resolution, set the
FtBinparameter to 2 so that the aligned frames are Fourier cropped back to normal size and set theGputo0. -
Since this dataset has .mrc frames, the “EER specific part” block can be ignored.
-
We will not be doing noise2noise training, so odd/even stacks are not needed.
-
Save the param file and run the TOMOMAN in the standalone with the new
paramfilename:tomoman(pwd, 'tomoman_motioncor3.param');
Cleaning Stacks
After generating your motion-corrected tilt series stacks, you now have something you can reasonably look at to assess the quality of the images.
Bad images can include images where something blocks the field of view, such as a grid bar or ice crystal, or bad imaging conditions such as sample charging.
The best way to assess this is by manually looking at the images.
TOMOMAN facilitates the process using the clean_stacks task.
Open tomoman_clean_stacks.param.
-
The tomolist parameters block should be set up already.
-
For the stack cleaning parameters block,
clean_binningrefers to the binning factor for displaying the tilt series,clean_appendis whether to save the cleaned stack with an appended name, andforce_cleaningforces repeating of stacks that have already been cleaned. The default parameters should work fine. -
Save the param file and run stack cleaning.
tomoman(pwd, 'tomoman_clean_stacks.param'); -
Follow the instructions in the console to remove bad images. For this dataset, there is 1 blocked image that should be removed.
There are some issues with running 3dmod in the TOMOMAN standalone On these AWS instanceso You can instead open another terminal from the TOMOMAN standalone (
Ctrl + Shift + T) and open the tilt series manually:3dmod TS_01/TS_01.stNOTE: Remember to close your 3dmod windows; TOMOMAN is unable to close spawned windows from external packages.
Dose Filtering
We find that dose filtering (a.k.a. exposure filtering) greatly improves the contrast, alignment quality, and high-resolution signals of reconstructed tomograms.
TOMOMAN has its own function for doing this based off the empirical values determined by Grant and Grigorieff (doi: 10.7554/eLife.06980).
Open tomoman_dosefilter.param.
-
The tomolist parameter block should already be set correctly.
-
The dose filtering parameter block is usually fine with the default values.
-
Pre-exposure is typically from tasks such as mapping and realigning during data collection, but is generally quite low and can be ignored. TOMOMAN lets you dose filter frames (i.e., not just motion corrected images), if you first generate an aligned frame stack. This can better preserve high resolution signals, but for the practical we will just filter the aligned images. Critical exposure constants can be provided, but these are typically not known a priori, so we generally use the default values determined by Grant and Grigorieff.
-
We are not using odd and even stacks so you can set
check_oddeventofalseto avoid warnings about missing stacks.
-
-
Run dose filtering in the TOMOMAN console.
tomoman(pwd,'tomoman_dosefilter.param'); -
If you would like to see the results of dose filtering, you can open the unfiltered and filtered stacks in 3dmod. Remember to open this in your other terminal; you can open it with:
3dmod TS_01/TS_01.st TS_01/TS_01_dose-filt.st