Difference between revisions of "Applications/Samtools"

From HPC
Jump to: navigation , search
(Created page with "==Application Details== *Description: The OBITools package is a set of programs specifically designed for analysing NGS data in a DNA meta-barcoding context, taking into accou...")
 
m
Line 9: Line 9:
 
Samtools is a suite of programs for interacting with high-throughput sequencing data. It consists of three separate repositories:
 
Samtools is a suite of programs for interacting with high-throughput sequencing data. It consists of three separate repositories:
  
* Samtools - Reading/writing/editing/indexing/viewing SAM/BAM/CRAM format
+
* '''Samtools''' - Reading/writing/editing/indexing/viewing SAM/BAM/CRAM format
* BCFtools - Reading/writing BCF2/VCF/gVCF files and calling/filtering/summarising SNP and short indel sequence variants
+
* '''BCFtools''' - Reading/writing BCF2/VCF/gVCF files and calling/filtering/summarising SNP and short indel sequence variants
* HTSlib - A C library for reading/writing high-throughput sequencing data  
+
* '''HTSlib''' - A C library for reading/writing high-throughput sequencing data  
  
 +
===Usage Examples===
  
 +
Some usage examples of Samtools are listed below:
  
 +
Index the reference FASTA.
  
 +
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 +
[username@login01 ~]$  samtools faidx ex1.fa
 +
</pre>
 +
 +
Convert the (headerless) SAM file to BAM.  Note if we had used
 +
"samtools view -h" above to create the ex1.sam.gz then we could omit the
 +
"-t ex1.fa.fai" option here.
 +
 +
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 +
[username@login01 ~]$  samtools view -S -b -t ex1.fa.fai -o ex1.bam ex1.sam.gz
 +
 +
Build an index for the BAM file:
 +
 +
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 +
[username@login01 ~]$  samtools index ex1.bam
 +
</pre>
 +
 +
View a portion of the BAM file:
 +
 +
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 +
[username@login01 ~]$  samtools view ex1.bam seq2:450-550
 +
</pre>
 +
 +
Visually inspect the alignments at the same location:
 +
 +
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 +
[username@login01 ~]$  samtools tview -p seq2:450 ex1.bam ex1.fa
 +
</pre>
 +
 +
View the data in pileup format:
 +
 +
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 +
[username@login01 ~]$  samtools mpileup -f ex1.fa ex1.bam
 +
</pre>
  
 +
Generate an uncompressed VCF file of variants:
  
 +
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 +
[username@login01 ~]$  samtools mpileup -vu -f ex1.fa ex1.bam > ex1.vcf
 +
</pre>
  
===Module===
+
Generate a compressed VCF file of variants:
  
 
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
[username@login01 ~]$ module samtools/gcc/1.3.1.
+
[username@login01 ~]$ samtools mpileup -g -f ex1.fa ex1.bam > ex1.bcf
 
</pre>
 
</pre>
  
===Slurm Example===
 
  
<pre style="background-color: #f5f5dc; color: black; font-family: monospace, sans-serif;">
 
  
 +
===Module===
  
 +
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 +
[username@login01 ~]$ module samtools/gcc/1.3.1.
 
</pre>
 
</pre>
  

Revision as of 11:56, 24 March 2017

Application Details

  • Description: The OBITools package is a set of programs specifically designed for analysing NGS data in a DNA meta-barcoding context, taking into account taxonomic information
  • Version: 1.3.1.
  • Module: module samtools/gcc/1.3.1.
  • Licence: BSD License, MIT License

Usage Areas

Samtools is a suite of programs for interacting with high-throughput sequencing data. It consists of three separate repositories:

  • Samtools - Reading/writing/editing/indexing/viewing SAM/BAM/CRAM format
  • BCFtools - Reading/writing BCF2/VCF/gVCF files and calling/filtering/summarising SNP and short indel sequence variants
  • HTSlib - A C library for reading/writing high-throughput sequencing data

Usage Examples

Some usage examples of Samtools are listed below:

Index the reference FASTA.

[username@login01 ~]$  samtools faidx ex1.fa

Convert the (headerless) SAM file to BAM. Note if we had used "samtools view -h" above to create the ex1.sam.gz then we could omit the "-t ex1.fa.fai" option here.

[username@login01 ~]$  samtools view -S -b -t ex1.fa.fai -o ex1.bam ex1.sam.gz

Build an index for the BAM file:

<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
[username@login01 ~]$  samtools index ex1.bam

View a portion of the BAM file:

[username@login01 ~]$  samtools view ex1.bam seq2:450-550

Visually inspect the alignments at the same location:

[username@login01 ~]$  samtools tview -p seq2:450 ex1.bam ex1.fa

View the data in pileup format:

[username@login01 ~]$  samtools mpileup -f ex1.fa ex1.bam

Generate an uncompressed VCF file of variants:

[username@login01 ~]$  samtools mpileup -vu -f ex1.fa ex1.bam > ex1.vcf

Generate a compressed VCF file of variants:

[username@login01 ~]$ samtools mpileup -g -f ex1.fa ex1.bam > ex1.bcf


Module

[username@login01 ~]$ module samtools/gcc/1.3.1.


Further Information

http://www.htslib.org/