This is a test version of Biostars. For the public version, visit https://www.biostars.org.
samtools sort stuck during merging

Hi !

I got a new computer recently and had to re-install samtools (version 1.5) and a few other programs. Now when I try to sort a bam file, everything goes well (samtools creates all those little intermediate files) until the merging process :

[bam_sort_core] merging from 58 files...

Then it gets stuck. I get no error message but the output file (sorted.bam) remains empty even if I wait hours. When I monitor the activity of samtools, I see that it is reading a lot, but not writing. Any idea on what is going on ?

In case this is useful, I'm on MacOS 10.12, 8 Go, 4 cores and I tried two different settings for sorting :

samtools sort in.bam > sorted.bam              # 1st setting
samtools sort -@ 4 -m 1G in.bam > sorted.bam   # 2d setting
samtools sort bamtools next-gen

Have you tried explicitly specifying the output file using the -o argument?

Ok, I just tried that (I had little hope) but IT WORKED ! Thank you ! But WTF is going on ? samtools sort used to work perfectly well with stdout...

I would argue it's a bug. Definitely given that the manual states:

The sorted output is written to standard output by default, or to the specified file (out.bam) when -o is used.

0 answers

No answers yet.

Log in to answer this question.