Samtools

Software Category
Version
1.13

Samtools

SAM (Sequence Alignment/Map) is a flexible generic format for storing nucleotide sequence alignments. Samtools provides efficient utilities on manipulating alignments in the SAM format.

Using Samtools on RCC Resources

Note that Samtools requires loading the GNU module. This can be done by running: module load gnu. Log in to a Spear or HPC node and run the following commands to create a folder and download the SAM example files into it:

$ module load gnu
$ mkdir ~/SAM-test
$ cd ~/SAM-test
$ wget https://github.com/samtools/samtools/blob/develop/examples/ex1.fa
$ wget https://github.com/samtools/samtools/blob/develop/examples/ex1.sam.gz

Some example commands using the above data are shown below:

Index the reference FASTA

$ samtools faidx ex1.fa

SAM -> BAM

$ samtools import ex1.fa.fai ex1.sam.gz ex1.bam

Index BAM

$ samtools index ex1.bam

View Alignment

$ samtools tview ex1.bam ex1.fa

Pileup and consensus

$ samtools pileup -cf ex1.fa ex1.bam
$ samtools pileup -cf ex1.fa -t ex1.fa.fai ex1.sam.gz

For detailed usage information, refer to the official Samtools documentation.