I am trying to read bam file using a command: samfile = pysam.AlignmentFile(os.path.join(path,bam),'rb') but I keep on getting an error:
Traceback (most recent call last): File "<stdin>", line 3, in <module> File "pysam/libcalignmentfile.pyx", line 741, in pysam.libcalignmentfile.AlignmentFile.__cinit__ File "pysam/libcalignmentfile.pyx", line 990, in pysam.libcalignmentfile.AlignmentFile._open ValueError: file has no sequences defined (mode='rb') - is it SAM/BAM format? Consider opening with check_sq=False
I checked my bam files and they look fine. All of my bam files have headers too. Could anyone provide any suggestion?