I'm new to CRAM format and I am wondering if I can read a CRAM file in pysam or samtools.
Or generally speaking how do I use a CRAM file like a BAM file?
#!/usr/env python
import pysam
CRAM_FH = '/home/admin/data/HG00096.alt_bwamem_GRCh38DH.20150718.GBR.low_coverage.cram'
cram = pysam.AlignmentFile(CRAM_FH,'rb')
for read in cram.fetch(region='chr1:10000000-10000100'):
print read
cram.close()
Returned:
File "src/test_cram.py", line 5, in <module>
for read in cram.fetch(region='chr1:10000000-10000100'):
File "pysam/calignmentfile.pyx", line 874, in pysam.calignmentfile.AlignmentFile.fetch (pysam/calignmentfile.c:10986)
ValueError: fetch called on bamfile without index
If the index is in the same directory why wont the code work then?
What version of pysam are you using?
most recent