Membrain-seg on Biowulf

MemBrain-seg is a tool for automatically identifying membranes in cryo-electron tomograms. It uses a pretrained U-Net-based model and includes preprocessing tools to prepare data for better segmentation. Users can download the recommended model, try alternative models for specific data conditions, or train a custom model using their own data.

Documentation
Important Notes

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

Allocate an interactive session and run the program. Sample session:

[user@biowulf]$ sinteractive --cpus-per-task=4 --mem=16g --gres=gpu:a100:1
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 cn4224 are ready for job

[user@cn4224 ~]$ module load membrain-seg
[+] Loading membrain-seg  0.0.5  on cn1102 
[+] Loading bedtools  2.31.1 

[user@cn4224 ~]$ cp /usr/local/apps/membrain-seg/TEST_DATA/* .

[user@cn4224 ~]$ membrain segment \
     --tomogram-path lysosome.mrc \
     --ckpt-path MemBrain_seg_v10_alpha.ckpt \
     --out-folder predictions
100%|████████████████████████████████████████████████████████████████████████████████████████| 72/72 [00:04<00:00, 15.01it/s]
100%|████████████████████████████████████████████████████████████████████████████████████████| 72/72 [00:03<00:00, 20.12it/s]
100%|████████████████████████████████████████████████████████████████████████████████████████| 72/72 [00:03<00:00, 20.11it/s]
100%|████████████████████████████████████████████████████████████████████████████████████████| 72/72 [00:03<00:00, 20.11it/s]
100%|████████████████████████████████████████████████████████████████████████████████████████| 72/72 [00:03<00:00, 20.11it/s]
100%|████████████████████████████████████████████████████████████████████████████████████████| 72/72 [00:03<00:00, 20.10it/s]
100%|████████████████████████████████████████████████████████████████████████████████████████| 72/72 [00:03<00:00, 20.11it/s]
100%|████████████████████████████████████████████████████████████████████████████████████████| 72/72 [00:03<00:00, 20.12it/s]
MemBrain has finished segmenting your tomogram.

														  
[user@biowulf ~]$exit

Batch job
Most jobs should be run as batch jobs.

Create a batch input file (e.g. membrain-seg.sh) similar to the following.

#! /bin/bash

module load membrain-seg

membrain segment \
   --tomogram-path lysosome.mrc \
   --ckpt-path MemBrain_seg_v10_alpha.ckpt \
   --out-folder predictions

Submit these jobs using the Slurm sbatch command.

sbatch --cpus-per-task=4 --mem=16g --gres=gpu:a100:1 membrain-seg.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 for the first step of the pipeline (e.g. membrain-seg.swarm). For example:

membrain-seg segment \
   --tomogram-path lysosome_01.mrc \
   --ckpt-path MemBrain_seg_v10_alpha_01.ckpt \
   --out-folder predictions1
membrain-seg segment \
   --tomogram-path lysosome_01.mrc \
   --ckpt-path MemBrain_seg_v10_alpha_01.ckpt \
   --out-folder predictions1
membrain-seg segment \
   --tomogram-path lysosome_01.mrc \
   --ckpt-path MemBrain_seg_v10_alpha_01.ckpt \
   --out-folder predictions1

Submit this job using the swarm command.

swarm --partition=gpu -g 4 -t 4 --module --gres=gpu:a100:1 membrain-seg membrain-seg.swarm
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 membrain-seg Loads the membrain-seg module for each subjob in the swarm