Thank you this is exactly what I wanted. The output is now similar to the samtools function depth
output differents value between samtools depth and pysam
Hello
I use some pysam function to calculate the depth of sequencing and I check the result with samtools depth. Most of the time the result is identical but sometimes there is a shift in the between the samtools result and the pysam result.
I put my code in a zip file with the example and a readme that contains the command to execute and the result files
• 4,164 views
•
link
1 answer
You'll want to use bamfile.pileup(chr_name, stepper='nofilter'): rather than the default filtering function to get more similar results.
• 1 views
•
link
• 1 views
•
link
If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted.

• 1 views
•
link
Log in to answer this question.
A better place to share code would be a GitHub Gist. I'm not going to download and extract a zip :-)
My first guess is that you see this difference because samtools has a default maximum depth of 8000. I believe if you set
-d 0you disable the maximum (if you have a reasonable recent version of samtools).please use http://gist.github.com or paste the code here, instead of this temporary link.
I made the gist but I was unable to join the bam file that provokes the error
Hello,
some more general problems that might came up if one try to compare programs which calculate read depths.
fin swimmer