This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Difference of samtools depth count and samtools tview count

Hi everyone,

There is a question that why samtools depth count is different with samtools tview count.

For example , I use "samtools depth -q 0 -Q 0 my.bam > my.depth" to get the depth of the sites,however the depth is smaller than I see through samtools tview.(I guess this different generated by secondary map.)

Is there a way that can get the same depth with samtools tview?

samtools depth samtools tview

Thanks,we can use pysam to get the same count.

1 answer

samtools depth provides the exact depth for each position considering ALL reads in the bam file. when you don't SEE the same numbers in any particular viewer you have to take into account that those viewers usually apply some read filtering that alter read depth DISPLAYED, which does not necessarily reflect the raw depth. if you want to get the same numbers in both samtools depth and viewer then you'll have to remove any default filtering from the viewer (easier), or either apply the same filters to your bam file before extracting the coverage through samtools depth.

Log in to answer this question.