Hello, I am trying to extract reads at 1 base pair from many bam files. Each bam file has a bai file with the same name+.bai in the same folder.
When I run
samtools view myfile.bam
I get the output, but when I add coordinates such as
samtools view myfile.bam "chr1:1-100000"
I get the following error:
[bam_index_load] fail to load BAM index. [main_samview] random alignment retrieval only works for indexed BAM files.
My understanding is that the bai file is the index it needs. Am I missing something?
Thanks in advance.