cicci
cicci

Reputation: 1

indexing sorted alignment file with samtools index gives "Exec format error"

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.

Upvotes: 0

Views: 1722

Answers (1)

cicci
cicci

Reputation: 1

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

Upvotes: 0

Related Questions