Entering edit mode
5.1 years ago
tuj92050
•
0
This is for a course I am currently taking. I have downloaded an indexed bam file (.bai) of all the exome reads from thr 1000 genomes project. The next step in this assignment is extracting the reads for chromosome 22 of this file. I tried samtools to do this
samtools view -b NA20515.bam.bai chr22 > chr22.bam
But I am met with the error
[E::hts_hopen] Failed to open file NA20515.bam.bai
[E::hts_open_format] Failed to open file NA20515.bam.bai
samtools view: failed to open "NA20515.bam.bai" for reading: Exec format error
Obviously I don't think I can do this with samtools. Is there any other way to do this?
You should do
samtools view
onbam
file, not.bai
file.you want
not the bai file
I just tried that and I got the error "random alignment retrieval only works for indexed BAM or CRAM files"
It's not clear to me; do you have both NA20515.bam and NA20515.bam.bai? Are they together in the same directory?