pysam pileup doesn't work when contig name is specified?
0
0
Entering edit mode
16 months ago
dp ▴ 40

Hi I'm trying to get the read coverage depth of several contigs in pysam. I'm doing mybam.pileup(contig_name) but no matter what options I try, I do not get any pileups (the number of pileupcolumns seems to be zero).

I've seen this method suggested as a way to get the depth, but none of the examples specify a specific contig. Could that be causing the problem? How can I get around this issue (bug?)

Otherwise, is there another way to do this with pysam?

Note that doing samtools depth -r "contig_name" mybam.bam from the command line outputs non-zero depths all along the contig. Also, mybam.count_coverage(contig_name) in pysam returns non-empty arrays with many non-zero values.

pysam coverage depth pileup • 377 views