SAMtools

Notitle

SAMtools implements various utilities for post-processing alignments in the SAM format, such as indexing, variant caller and alignment viewer, and thus provides universal tools for processing read alignments.

SAMtools is available as a module on Apocrita.

Usage

To run the latest installed version of SAMtools, simply load the samtools module:

module load samtools

then run one of the SAMtools commands such as:

samtools view -b -S -o genome_reads_aligned.bam genome_reads_aligned.sam

Core Usage

To ensure that SAMtools uses the correct number of cores, the -@ ${NSLOTS} option should be used on commands that support it.

Example Jobs

Serial Job

Here is an example job running on 4 cores.

#!/bin/sh
#$ -cwd
#$ -j y
#$ -pe smp 4
#$ -l h_rt=4:0:0
#$ -l h_vmem=2G

module load samtools

samtools view -@ ${NSLOTS} -b -S -o genome_reads_aligned.bam \
    genome_reads_aligned.sam

samtools sort -@ ${NSLOTS} genome_reads_aligned.bam \
    > genome_reads_aligned.sorted.bam

samtools index genome_reads_aligned.sorted.bam

samtools mpileup -g -f ref_genome_1K.fna genome_reads_aligned.sorted.bam \
    > genome_variants.bcf

References