vembrane on Biowulf

vembrane uses python expressions to filter variants. From the documentation:

vembrane allows to simultaneously filter variants based on any INFO or FORMAT field, CHROM, POS, ID, REF, ALT, QUAL, FILTER, and the annotation field ANN. When filtering based on ANN, annotation entries are filtered first. If no annotation entry remains, the entire variant is deleted.

References:

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 input in bold):

[user@biowulf]$ sinteractive --gres=lscratch:10 --mem=10g -c2
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 vembrane
[user@cn3144 ~]$ cd /lscratch/$SLURM_JOB_ID
[user@cn3144 ~]$ cp ${VEMBRANE_TEST_DATA:-none}/HG001* .
[user@cn3144 ~]$ ls -lh
-rw-r--r-- 1 user group  89M Jul  1 13:01 AshkenazimTrio_chr1_annot.bcf
-rw-r--r-- 1 user group 131K Jul  1 13:10 AshkenazimTrio_chr1_annot.bcf.csi
-rw-r--r-- 1 user group  17K Jul  1 12:31 AshkenazimTrio_chr1_annot.vcf_summary.html
[user@cn3144 ~]$ bcf=AshkenazimTrio_chr1_annot.bcf
[user@cn3144 ~]$ ## Count the number of variants marked as HIGH impact per gene in the trio
[user@cn3144 ~]$ vembrane filter -O bcf 'ANN["IMPACT"]=="HIGH"]' $bcf 2> /dev/null \
                    | vembrane table 'ANN["SYMBOL"], ANN["IMPACT"]' \
                    | cut -f1 | sort | uniq -c | sort -k1,1nr | head
     28 PPIEL
     17
     11 FLG-AS1
      8 LINC01360
      7 GCSAML
      6 FCGR2A
      6 FCGR2C
      6 GPATCH4
      6 KIAA0040
      6 KLHDC8A

[user@cn3144 ~]$ vembrane filter -O bcf -o ppiel.bcf 'ANN["SYMBOL"] == "PPIEL"' $bcf 2>/dev/null 
[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. vembrane.sh). For example:

#!/bin/bash
set -e
module load vembrane/1.0.5
vembrane filter -O bcf -o output.bcf 'ANN["IMPACT"]=="HIGH"]' input.bcf

Submit this job using the Slurm sbatch command.

sbatch --cpus-per-task=2 --mem=6g vembrane.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. vembrane.swarm). For example:

vembrane filter -O bcf -o output_chr1.bcf 'ANN["IMPACT"]=="HIGH"]' input_chr1.bcf
vembrane filter -O bcf -o output_chr2.bcf 'ANN["IMPACT"]=="HIGH"]' input_chr2.bcf

Submit this job using the swarm command.

swarm -f vembrane.swarm -g 6 -t 2 --module vembrane/1.0.5
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 vembrane Loads the vembrane module for each subjob in the swarm