Splam on Biowulf

Splam is a tool for checking the quality of splice junctions in RNA sequencing data. It uses a neural network to evaluate DNA sequences around donor and acceptor sites, then identifies and removes likely incorrect spliced alignments. Splam can also score introns in annotation files or assembled transcripts, helping improve transcript assembly and downstream analyses such as gene expression and transcript quantification.

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
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 splam
[+] Loading splam  1.0.10  on cn1102 
[+] Loading bedtools  2.31.1 

[user@cn3144 ~]$ splam extract --rf -P bams/subset_chr17.bam -o splam/tmp_out_chr17_alignment
#[...]
#[INFO] Total number of alignments	:   7285778 
#           paired alignments		:   7285778 
#               spliced alignments	:   1491516 
#                   - uniquely mapped	:   1363950
#                   - multi-mapped	:    127566
#               non-spliced alignments	:   5794262 
#                   - uniquely mapped	:   4450836
#                   - multi-mapped	:   1343426
#
#           unpaired alignments		:         0 
#               spliced alignments	:         0 
#                   - uniquely mapped	:         0
#                   - multi-mapped	:         0
#               non-spliced alignments	:         0 
#                   - uniquely mapped	:         0
#                   - multi-mapped	:         0
#
#
#[INFO] Total number of junctions	:     17318

[user@cn3144 ~]$ splam score -G annotations/hg38.fa \
      -m ${SPLAM_HOME}/model/splam_script.pt \
      -o splam/tmp_out_chr17_alignment splam/tmp_out_chr17_alignment/junction.bed
#[...]
# [Info] Running model in "cpu" mode
# [Info] Loading model ... (/usr/local/apps/splam/1.0.9/model/splam_script.pt)
# model = torch.load(model_path)!!
# [Info] Done loading model
# [Info] Loading data ...
#	 17316  junctions loaded.
# [Info] Done loading data
# [Info] SPLAM!  |################################| 1732/1732

[user@cn3144 ~]$ splam clean -P -o splam/tmp_out_chr17_alignment -t 0.9
#=====================================================================
# An accurate spliced alignment pruner and splice junction predictor. 
#=====================================================================
#
#
#  ��������������� ���      ������ ����   ����
#  �������������������     ������������� �����
#  �������������������     �������������������
#  ��������������� ���     �������������������
#  �����������     �����������  ������ ��� ���
#  �����������     �����������  ������     ���
#    
#threshold: 0.900000
#inbedname: splam/tmp_out_chr17_alignment/junction_score.bed
#[INFO] SPLAM! Filtering spliced unique alignments (paired) 
#[INFO] SPLAM! Filtering spliced multi-mapped alignments (paired) 
#[INFO] SPLAM! Filtering spliced unique alignments (unpaired)
#[INFO] SPLAM! Filtering spliced multi-mapped alignments (unpaired)
#[INFO] SPLAM! Processing multi-mapped spliced alignments (paired)
#[INFO] SPLAM! Processing multi-mapped non-spliced alignments (paired)
#[INFO] SPLAM! Processing multi-mapped spliced alignments (unpaired)
#[INFO] SPLAM! Processing multi-mapped non-spliced alignments (unpaired)
#Outside of merging all files into a clean BAM file!
#Numver of input argument!: 15
#
#[INFO] Total number of spliced alignments	:   1491516 
#           paired spliced alignments		:   1491516 
#               - uniquely mapped		:   1363950   (kept: 1363950 / removed: 0 )
#               - multi-mapped			:    127566   (kept: 127566 / removed: 0 )
#           unpaired spliced alignments		:         0 
#               - uniquely mapped		:         0   (kept: 0 / removed: 0 )
#               - multi-mapped			:         0   (kept: 0 / removed: 0 )
#
#[INFO] Number of junctions			:     17318   (good: 15033 / bad: 2283 / unstranded: 2)
#
#[INFO] Number of removed spliced alignments	:         0 
#[INFO] Number of kept spliced alignments	:   1491516 


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

#!/bin/bash

module load splam

splam extract --rf -P bams/subset_chr17.bam -o splam/tmp_out_chr17_alignment

splam score -G annotations/hg38.fa \
      -m ${SPLAM_HOME}/model/splam_script.pt \
      -o splam/tmp_out_chr17_alignment splam/tmp_out_chr17_alignment/junction.bed

splam clean -P -o splam/tmp_out_chr17_alignment -t 0.9

Submit this job using the Slurm sbatch command.

sbatch [--cpus-per-task=#] [--mem=#] splam.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. splam.swarm). For example:

splam extract --rf -P bams/sample1.bam -o splam/sample1; \
splam score -G annotations/hg38.fa -m ${SPLAM_HOME}/model/splam_script.pt -o splam/sample1 splam/sample1/junction.bed; \
splam clean -P -o splam/sample1 -t 0.9
splam extract --rf -P bams/sample2.bam -o splam/sample2; \
splam score -G annotations/hg38.fa -m ${SPLAM_HOME}/model/splam_script.pt -o splam/sample2 splam/sample2/junction.bed; \
splam clean -P -o splam/sample2 -t 0.9
splam extract --rf -P bams/sample3.bam -o splam/sample3; \
splam score -G annotations/hg38.fa -m ${SPLAM_HOME}/model/splam_script.pt -o splam/sample3 splam/sample3/junction.bed; \
splam clean -P -o splam/sample3 -t 0.9

Submit this job using the swarm command.

swarm [-g #] [-t #] --module splam splam.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 splam Loads the splam module for each subjob in the swarm