MotionCor3 on Biowulf

MotionCor3 is an improved implementation of MotionCor2 with addition of CTF estimation, Multi-GPU accelerated software package that enables single-pixel level correction of anisotropic beam induced sample motion for cryoEM and cryET images.

References:

Documentation
[user@cn4172 ~]$ module load motioncor3
[+] Loading motioncor3 1.0.1 on cn4172 
[user@cn4172 ~]$ MotionCor3 --help
Usage: MotionCor3 Tags
-InMrc         
  1. Input MRC file that stores dose fractionated stacks.
  2. It can be a MRC file containing a single stack collected
     in Leginon or multiple stacks collected in UcsfTomo.
  3. It can also be the path of a folder containing multiple
     MRC files when -Serial option is turned on.

-InTiff        
  1. Input TIFF file that stores a dose fractionated stack.
-InEer         
 1. Input EER file that stores a dose fractionated stack.
-InSkips       
  1. Used in combination with -Serial, skip the input files whose
     names contain the strings specied here.
-OutMrc        
  1. Output MRC file that stores the frame sum.
  2. It can be either a MRC file name or the prefix of a series
     MRC files when -Serial option is turned on.

-ArcDir        
 1. Path of the archive folder that holds the archived raw
    stacks with each pixel packed into 4 bits.
 2. The archived stacks are saved in MRC file with the gain
    reference saved in the extended header.
 3. The rotated and/or flipped gain reference will be saved
    if -RotGain and or -FlipGain are enabled.
...
Important Notes

Interactive job
Interactive jobs should be used for debugging, graphics, or applications that cannot be run as batch jobs.

Allocate a gpu interactive session and run the program. Sample session:

[user@biowulf]$ sinteractive --gres=lscratch:100,gpu:1 --mem=100g
salloc.exe: Pending job allocation 46116226
salloc.exe: job 46116226 queued and waiting for resources
salloc.exe: job 46116226 has been allocated resources
salloc.exe: Granted job allocation 46116226
salloc.exe: Waiting for resource configuration
salloc.exe: Nodes cn3144 are ready for job

[user@cn3144 ~]$ module load motioncor3
[user@cn3144 ~]$ motioncor3 -InMrc mymovie.mrcs -OutMrc mymicrograph.mrc -LogFile output.log -Bft 150 -PixSize 3.49 -OutStack 1 -Patch 1 1 -Trunc 1 -Gpu 0

[user@cn3144 ~]$ exit
salloc.exe: Relinquishing job allocation 46116226
[user@biowulf ~]$

Batch job
Most jobs should be run as batch jobs.

Create a batch input file (e.g. motioncor3.sh). For example:

#!/bin/bash
module load motioncor3
MotionCor3 -InMrc /path/to/raw/data/12345.mrcs -OutMrc Micrographs/12345.mrc -LogFile output.log -Bft 150 -PixSize 3.49 -OutStack 1 -Patch 1 1 -Trunc 1 -Gpu 0

Submit this job using the Slurm sbatch command.

sbatch [--cpus-per-task=#] [--mem=#] --partition=gpu --gres=gpu:p100:1 motioncor3.sh
Swarm of Jobs
A swarm of jobs is an easy way to submit a set of independent commands requiring identical resources.

Create a swarmfile (e.g. motioncor3.swarm). For example:

MotionCor3 -InMrc /path/to/raw/data/0001.mrcs -OutMrc Micrographs/0001.mrc -LogFile output.log -Bft 150 -PixSize 3.49 -OutStack 1 -Patch 1 1 -Trunc 1 -Gpu 0
MotionCor3 -InMrc /path/to/raw/data/0002.mrcs -OutMrc Micrographs/0002.mrc -LogFile output.log -Bft 150 -PixSize 3.49 -OutStack 1 -Patch 1 1 -Trunc 1 -Gpu 0
MotionCor3 -InMrc /path/to/raw/data/0003.mrcs -OutMrc Micrographs/0003.mrc -LogFile output.log -Bft 150 -PixSize 3.49 -OutStack 1 -Patch 1 1 -Trunc 1 -Gpu 0
MotionCor3 -InMrc /path/to/raw/data/0004.mrcs -OutMrc Micrographs/0004.mrc -LogFile output.log -Bft 150 -PixSize 3.49 -OutStack 1 -Patch 1 1 -Trunc 1 -Gpu 0

Submit this job using the swarm command.

swarm -f motioncor3.swarm [-g #] [-t #] --partition=gpu --gres=gpu:p100:1 --module motioncor3
where
-g # Number of Gigabytes of memory required for each process (1 line in the swarm command file)
-t # Number of threads/CPUs required for each process (1 line in the swarm command file).
--module motioncor3 Loads the motioncor3 module for each subjob in the swarm