SAMTools

SAM Tools provide various utilities for manipulating alignments in the SAM format, including sorting, merging, indexing and generating alignments in a per-position format.

Website: http://samtools.sourceforge.net/

Input files

  • short-read alignment in SAM format;
  • reference sequence in FASTA format.

Output files

  • VCF file containing the SNP’s;
  • FASTQ consensus file.

Installation

$sudo apt-get install samtools

SNP call

– Firstly, index the fasta reference.

$samtools faidx file.fasta

– convert SAM file to BAM file (binary format).

$samtools view -bt file.fasta.fai file.sam > file.bam

– sort the alignment by using the BAM file as input.

$samtools sort file.bam file.sorted

– apply the BAQ.

$samtools calmd -Abr file.sorted.bam file.fasta > file.baq.bam

– Do the SNP call.

$samtools mpileup -uf file.fasta file.baq.bam | bcftools view -bvcg -> file.raw.bcf
$samtools view file.raw.bcf | perl vcfutils.pl varFilter -D100 > file.fit.vcf

– Finally, Generate the consensus sequence in FASTQ format.

$samtools mpileup -uf file.fasta file.baq.bam | bcftools view -cg - | perl vcfutils.pl vcf2fq > file.fq
This entry was posted in Local Tools. Bookmark the permalink.

1 Response to SAMTools

  1. Pingback: FreeBayes | rody

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s