I am struggling with samtools index.
I already did the alignment using "bwa mem reference.fa seq.fastq > alg.sam"
.
The resulting sam file was converted to bam format using "samtools view -S -h -b alg.sam > alg.bam"
.
Next, the files were sorted by using "sort -h alg.bam >sorted.bam"
.
And now we come to the problem: "samtools index -b sorted.bam"
always returns the following error:
“failed to open file “sorted.bam” : Exec format error samtools index:
failed to open “sorted.bam”: Exec format error”
I read that the samtools version 1.9 returns this error quite often. However, I have samtools version 1.10 installed and still could not find a way to solve this issue.
Read more here: Source link