samplot on HPC

samplot is a command line tool for rapid, multi-sample structural variant visualization. samplot takes SV coordinates and bam files and produces high-quality images that highlight any alignment and depth signals that substantiate the SV.

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@biowulf]$ sinteractive --gres=lscratch:10
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 samplot

[user@cn3144 ~]$ cd /lscratch/$SLURM_JOB_ID

[user@cn3144 ~]$ cp -r $SAMPLOT_TEST_DATA .

[user@cn3144 ~]$ samplot plot \
    -n NA12878 NA12889 NA12890 \
    -b TEST_DATA/data/NA12878_restricted.bam \
      TEST_DATA/data/NA12889_restricted.bam \
      TEST_DATA/data/NA12890_restricted.bam \
    -o 4_115928726_115931880.png \
    -c chr4 \
    -s 115928726 \
    -e 115931880 \
    -t DEL
[W::hts_idx_load3] The index file is older than the data file: TEST_DATA/data/NA12878_restricted.bam.bai
[W::hts_idx_load3] The index file is older than the data file: TEST_DATA/data/NA12878_restricted.bam.ba

[user@cn3144 ~]$ ls 4_115928726_115931880.png
4_115928726_115931880.png

[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. batch.sh). For example:

#!/bin/bash
set -e
module load samplot
cd /lscratch/$SLURM_JOB_ID
cp -r /usr/local/apps/${APP}/TEST_DATA .
samplot plot \
    -n NA12878 NA12889 NA12890 \
    -b TEST_DATA/data/NA12878_restricted.bam \
      TEST_DATA/data/NA12889_restricted.bam \
      TEST_DATA/data/NA12890_restricted.bam \
    -o 4_115928726_115931880.png \
    -c chr4 \
    -s 115928726 \
    -e 115931880 \
    -t DEL

Submit this job using the Slurm sbatch command.

sbatch batch.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. job.swarm). For example:

cd dir1; samplot plot -n NAME1 -b BAM1 -o IMAGE1.png
cd dir2; samplot plot -n NAME2 -b BAM2 -o IMAGE2.png
cd dir3; samplot plot -n NAME3 -b BAM3 -o IMAGE3.png

Submit this job using the swarm command.

swarm -f job.swarm --module samplot
where
--module Loads the module for each subjob in the swarm