This is a test version of Biostars. For the public version, visit https://www.biostars.org.
samtools sort doesn't finish sorting bam file, just hangs for hours

I am trying to sort a bam file, which is 4.1 GB in size using simply samtools sort -o sorted.bam start.bam, but the file hangs after about 6.5 hours when the sorted file is 3.1 GB, no warning messages or anything. None of the temp files have been deleted either. I don't think the computer ran out of RAM. This has happened on my second attempt.

Why can't I sort this bam file? How can I get the sort to finish?

samtools

Very odd. Command seems fine. If you want to try a different tool use sambamba.

Use top to see if the process is still running.

I don't think the computer ran out of RAM.

How much RAM do you have?

1 answer

Check 1 : is your BAM file okay? see below link

How to systematically check if a bam file is truncated

Check 2 : do you have enough space on disk ?

df -h

indeed, the issue was disk space, silly me. It would have been nice had samtools provided an error, however, the temp files used more space than I anticipated.

If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted.
Upvote|Bookmark|Accept

Log in to answer this question.