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.