Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
GATK CountCovariates running very slow indapa Bioinformatics 1 06-30-2011 06:46 AM
Samtools sort output smaller than input Sylphide Bioinformatics 3 04-15-2011 02:12 PM
samtools sort stdout pederworning Bioinformatics 4 04-09-2011 09:02 AM
samtools colorspace calmd is incredibly slow najoshi Bioinformatics 1 03-31-2011 08:33 PM
@HD SO field after samtools sort telos Bioinformatics 3 11-10-2010 07:12 AM

Thread Tools
Old 01-05-2010, 01:58 PM   #1
Location: Arlington, TX

Join Date: Nov 2009
Posts: 17
Default samtools sort running extremely slow


I am a new samtools user. I am trying to sort a bam file of the size 5 GB

using command

./samtools sort myFile.bam myFile.sorted

Apparently it is stuck at the merging phase:

[bam_sort_core] merging from 49 files...

It has already been 8 hours and still the program is running. My Top command shows extremely low cpu usage by this program. The machine is a 64 bit dual core with 8 GB chip in it.

Any reason why this should be so slow?


tsucheta is offline   Reply With Quote
Old 06-11-2010, 03:11 AM   #2
Location: Munich, Germany

Join Date: May 2010
Posts: 22

Bump. I'm also a bit confused by this message, in my case it reports merging 6 files. I use 3 lanes labeled with 5 barcodes each. To be sure I put each barcode-specific alignment in a separate directory and rerun, but it seems the "merging" isn't about that, only the .bam file you specify is processed...

This is a bit intransparent. In case anyone wants to investigate further, the source for bam_sort_core can be found here:

And some of the code in question:
for (;;) {
            if (buf[k] == 0) buf[k] = (bam1_t*)calloc(1, sizeof(bam1_t));
            b = buf[k];
            if ((ret = bam_read1(fp, b)) < 0) break;
            mem += ret;
            if (mem >= max_mem) {
                  sort_blocks(n++, k, buf, prefix, header);
                  mem = 0; k = 0;
Without taking apart bam_read1, it seems that the same file, fp, is read multiple times...
mixter is offline   Reply With Quote
Old 06-11-2010, 07:30 AM   #3
Senior Member
Location: Boston

Join Date: Feb 2008
Posts: 693

Probably because your file system is slow.
lh3 is offline   Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -8. The time now is 12:04 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO