This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error while conversion of .sam to sorted.sam using samtools

Hey hi,

I have used BWA for the alignment purpose. The .sam files are obtained after BWA step. I have converted it to .bam

Now I want to sort the .bam file to get .sorted.bam for this I have used command:

~admin1/software/samtools-0.1.19/samtools sort xyz.bam xyz.sorted

But some Error is coming:-->

"[bam_sort_core] truncated file. Continue anyway."

Thanking you for consideration!!!

Mohit R. Navandar

chip-seq

The BWA output (.sam) may not be complete or it might be corrupt file.. Is it the case?

The SAM file is probably fine. The BAM file, on the other hand, is probably where the problem is.

Try

samtools sort

single threaded, that is, without -@

Based on 960 BAMs that failed with this error multithreaded, but succeeded single-threaded, I strongly suspect a bug in the samtools threading code.

(samtools ver. 1.2, on Linux)

1 answer

The original file was corrupt or otherwise incomplete. Just remake the BAM file.

Log in to answer this question.