samtools sort stuck during merging
0
0
Entering edit mode
4.5 years ago

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 • 2.5k views
2
Entering edit mode

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

0
Entering edit mode

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...

0
Entering edit mode

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.