Skip to content

SAMtools

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 default 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.

Deprecated feature

Note that using samtools mpileup to generate BCF or VCF files has been removed. To output these formats, please use bcftools mpileup instead.

Example job

Serial job

Here is an example job running on 4 cores and 8GB of memory:

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

module load samtools bcftools

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

References