MotionCorr & MotionCor2
MotionCorr/MotionCor2
MotionCorr [1] corrects whole frame image motion recorded with dose fractionated image stack. MotionCor2 [2] corrects anisotropic image motion at the single pixel level across the whole frame, suitable for both single particle and tomographic images. Correction of electron beam-induced sample motion is one of the major factors contributing to the recent resolution breakthroughs in cryo-electron microscopy. Iterative, patch-based motion detection is combined with spatial and temporal constraints and dose weighting. The multi-GPU accelerated program, MotionCor2, is sufficiently fast to keep up with automated data collection. The result is an exceptionally robust strategy that can work on a wide range of data sets, including those very close to focus or with very short integration times, obviating the need for particle polishing. Application significantly improves Thon ring quality and 3D reconstruction resolution.
Important Notes
To run your job, you need to request the GPU nodes using gpu queue (-p gpu).
Installed Versions
All the available versions of MotionCorr for use can be viewed by issuing the following command. This applies for other applications as well.
module avail motioncorr
output:
---------------------- /usr/local/share/modulefiles -------------------------
motioncorr2/2.1
The default version is identified by "(default)" behind the module name and can be loaded as:
module load motioncorr2
The other versions of MotionCorr can be loaded as:
module load motioncorr/<version>
Running MotionCor2 in HPC
Interactive Job
Request a GPU P100 Node (you can also request gpuk40)
srun -p gpu -C gpup100 --gres=gpu:1 --pty bash
Load the Module
module load motioncorr2
See the usage
motioncorr2
output:
Usage: MotionCor2 Tags
-InMrc
1. Input MRC file that stores dose fractionated stacks.
-OutMrc
-Gain
MRC file that stores the gain reference. If not
-Iter
Maximum iterations for iterative alignment,
...
Batch Job
Copy the .mrc and job files from /usr/local/doc/MOTIONCORR
cp /usr/local/doc/MOTIONCORR/* .
Single GPU
Run the job
sbatch testcor2.slurm
See the log file slurm-<jobid>.out with the content similar to the excerpt below and the corrected .mrc file "outmystack.mrc"
...
Start to detect bad and hot pixels.
Sum frame 1 to 256 on GPU 0
Calculate statistics.
CC Mean Std: 1.377e-01 1.228e-01
Number of defect patches: 0
CC: >= 0.875
Min Max Mean Std: -231.50 577.42 -0.00 70.31
Num Hot pixels: 204
Hot pixel threshold: 421.86
Start to correct bad and hot pixels.
...... correct bad pixels of frame 1 to 256
Full frame alignment
Fourier transform of entire stack, please wait.
Fourier transform entire stack, done.
Full-frame alignment has been started.
Iteration ( 1) Error 57.693039
Iteration ( 2) Error 57.931076
Iteration ( 3) Error 57.717884
Iteration ( 4) Error 57.905987
Iteration ( 5) Error 56.975033
Iteration ( 6) Error 56.809292
Iteration ( 7) Error 56.568542
Total Iterations: 7 Error: 56.568542
Full-frame alignment shift
...... Frame ( 1) shift: 0.00 0.00
...... Frame ( 2) shift: 58.47 -31.59
...... Frame ( 3) shift: 59.15 -30.37
...
Create aligned sum based upon full frame alignment.
Process thread exits.
Computational time: 8.661084 sec
Total time: 8.733730 sec
Check the GPU usage (use -l flag for looping i.e. -l 1 for every second):
nvidia-smi
output:
Fri Dec 14 12:28:04 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 396.37 Driver Version: 396.37 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Tesla P100-PCIE... On | 00000000:03:00.0 Off | 0 |
| N/A 28C P0 28W / 250W | 0MiB / 12198MiB | 0% E. Process |
+-------------------------------+----------------------+----------------------+
| 1 Tesla P100-PCIE... On | 00000000:82:00.0 Off | 0 |
| N/A 27C P0 59W / 250W | 5069MiB / 12198MiB | 94% E. Process |
+-------------------------------+----------------------+----------------------+
You can also view the UserManual Guide for motioncorr2 (needs visual access)
evince MotionCor2-UserManual.pdf
Multiple GPUs in a Single Node
For multiple GPU, you can just add the flag "-GPU 0 1" in a command line as showed:
MotionCor2 -InMrc mystack.mrc -OutMrc outmystack.mrc -GPU 0 1
Submit the job:
sbatch testcor2MultiGPU.slurm
output:
...
Start to detect bad and hot pixels.
Sum frame 1 to 128 on GPU 0
Sum frame 129 to 256 on GPU 1
...
...... Frame (255) shift: 46.53 -38.08
...... Frame (256) shift: 46.20 -39.02
Create aligned sum based upon full frame alignment.
Process thread exits.
Computational time: 7.685170 sec
Total time: 7.761810 sec
Note: Compare the Computation time with 1 and 2 GPUs.
You can also try another sample example that is located at /usr/local/doc/MOTIONCORR/FalconMovie. See the output in "mocor2.out" output file.
References:
[1] MotionCorr Home
[2] MotionCor2 Home