This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Samtools Read Coverage At Bp And Call % At Each Base

Hi,

I've spent the last two days reading material on samstools, but I can't seem to figure out a way to get the calls (% of each base) at each base position. When I use mpileup I am able to get the position, reference base, and the number of times a read covers that position, but not %base calls at each position. The only way I can figure to do this would be to write a perl script for the sam file, which has all the read sequences and their positions and use this information to figure the percentage on my own. Before I get started doing this, I wanted to be sure I wasn't missing a method/option in samstools that would make my live easier.

Thanks!

samtools read coverage

1 answer

In the VCF generated with SAMTOOLS there is an INFO tag named 'DP4'

DP4 Number of 1) forward ref alleles; 2) reverse ref; 3) forward non-ref; 4) reverse non-ref alleles, used in variant calling. Sum can be smaller than DP because low-quality bases are not counted.

see http://samtools.sourceforge.net/mpileup.shtml

Furtheremore the pileup format ( http://samtools.sourceforge.net/pileup.shtml ) contains a column named 'read bases'.

The pileup format would help me, but I which option would give me that output?

Here http://samtools.sourceforge.net/samtools.shtml it says "In the pileup format (without -uor-g)". I'm not using -u or -g option. I'm only using -f.

Command.

samtools mpileup -f $reference $sorted_bam > $mpileup

Log in to answer this question.