Hi! I'm kind of new to python and have some trouble using Pysam.
I'm using Python 2.7 on Debian 8.
I have a sample.bam file (90Mb) and a sample.bam.bai (created with samtools). I wan't to use it in order to experiment with pysam, but can't get it to work.
This is the code, as written in pysam intro:
samfile = pysam.AlignmentFile('sample.bam', 'rb') for read in samfile.fetch('chr1', 100, 120): print read
When I run this code, I get absolutely no output. No errors of anykind. I tried putting
print 'helo' instead, of
print 'read', but still no output. So i tried this instead:
samfile = pysam.AlignmentFile('sample.bam', 'rb') for read in samfile.fetch('chr1'): print read
That is, without a given range, and all of the sudden I get an "endless" output of chr1.
So basically, it's the range part that doesn't work with the code. I've tried googling wihtout any luck. Does anyone know what's going on?