Sorting of a bam file takes toooo long time
1
1
Entering edit mode
3.5 years ago

I am trying to use samtools sort function to sort a bam file (named as PT2) (size 180 megabite), which is not large. The sorting never end and no error message appeared. I have checked the memory of the VM Ubunto using (meminfo file in the proc folder on the home account). Also I have around 80 gig disc space

First code (extremely slow) :

samtools sort -o outputs/PT2_sorted.bam outputs/PT2.bam

second code (very slow):

samtools sort -o outputs/PT2_sorted.bam outputs/PT2.bam

What do you think is a reason behind this slow working ? any advice ?

Thanks

linux bam • 2.8k views
ADD COMMENT
1
Entering edit mode

try to set the following options:

  -m INT     Set maximum memory per thread; suffix K/M/G recognized [768M]
  -T PREFIX  Write temporary files to PREFIX.nnnn.bam
ADD REPLY
0
Entering edit mode

Thanks can you provide a full code line ?

Thanks

ADD REPLY
1
Entering edit mode

from the above suggestion

u can change -m value.

samtools sort -m 1G -T temp -o outputs/PT2_sorted.bam outputs/PT2.bam
ADD REPLY
0
Entering edit mode

That should be finished in like no time. Is the process even running? Use top to check. Please add comments via ADD REPLY.

ADD REPLY
0
Entering edit mode

what is top top check

ADD REPLY
0
Entering edit mode

Please use google and search for "linux top command". It shows you memory/CPU footprint of each running process, like Task Manager (Windows)/ Activity Monitor (macOS).

ADD REPLY
0
Entering edit mode

top to check, sorry was a typo, just open a terminal and type top, this shows an overview of active processes, and you should see samtools somewhere on top if it is running.

ADD REPLY
1
Entering edit mode
3.5 years ago

That was resolved. The point was to increase the VM memory from 1024 to around 1800. This enabled running the command (even without adding -m or -T)

Thanks

ADD COMMENT
0
Entering edit mode

On a side note, your profile has a weird Google Scholar link. I guess it's because you posted your Scholar URL where only your ID was required. You should fix that as your profile does not point to your scholar profile at the moment.

ADD REPLY

Login before adding your answer.

Traffic: 1795 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6