Does anyone know about this error? I used pysam to read bamfile, samfile = pysam.AlignmentFile(os.path.join(path,bam),'rb') and wanted to count inside samfile, sum1 = samfile.count(chr,start,stop). I have defined chr, start and stop in my script.
sum1 = samfile.count(chr,start,stop)
File "pysam/libcalignmentfile.pyx", line 1431, in pysam.libcalignmentfile.AlignmentFile.count
File "pysam/libcalignmentfile.pyx", line 1112, in pysam.libcalignmentfile.AlignmentFile.fetch
ValueError: fetching by region is not available for SAM files