0

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.

Masoud Keshavarz
  • 2,166
  • 9
  • 36
  • 48
cicci
  • 1
  • 2

1 Answers1

0

I finally found the mistake. We need to write "samtools sort alg.bam -o sorted.bam" The output can then be used as input for samtools index

cicci
  • 1
  • 2