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?
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.
See here: Does Samtools Tview Hide Pcr And Optical Duplicates?
And not to my knowledge, no - use another genome browser :(
Thanks,we can use pysam to get the same count.