Utilities / Create consensus sequence from a BAM file


Given an indexed BAM file and corresponding reference genome (in fasta format), this tool constructs a consensus sequence based on the alignment.




This tool uses SAMtools, bcftools and vcfutils.pl script to create a consensus sequence for the given alignment file. The actual command line executed is:

  samtools mpileup -uf reference.fa aligment.bam | bcftools view -cg - | vcfutils vcf2fq  
Note that the input BAM file must be sorted before it can be used by this tool.


Output is a fasta formatted sequence file.


This tool is based on the SAMtools package. Please cite the article The Sequence alignment/map (SAM) format and SAMtools by Li H., Handsaker B., Wysoker A., Fennell T., Ruan J., Homer N., Marth G., Abecasis G., Durbin R. and 1000 Genome Project Data Processing Subgroup (2009) Bioinformatics, 25, 2078-9. [PMID: 19505943].