Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lre1234
    Senior Member
    • Aug 2011
    • 110

    #1

    Sorting a very large bam file

    Hi all,
    I am doing some whole genomes. The samples were done by sequencing 1 sample on all 12 lanes of a solid 5500xl machine. From the output, I aligned each individual lane separately, then merged the 12 bam files together using picardtools mergeSam. This merged bam file is rather large, 200GB in size and has around 2billion sequence reads. My problem is that now I have to sort the file. Any method that I have tried so far has not worked. Samtools fails with an error saying that there are too many files, and picard tools gives an error that it is out of memory. The compute node that I am using has 256GB of memory, so that should be enough. I have even tried increasing the -m flag to 16G in samtools sort. Still not working.

    Any thoughts?

    Thanks
  • GenoMax
    Senior Member
    • Feb 2008
    • 7142

    #2
    Check the output of the
    Code:
    limit
    command to see if you are running into a constraint in user resources. If you are submitting the job using a scheduler (LSF/SGE) then it would be useful to check if the queue you are using has a memory limit (per job/user)?

    Comment

    • Richard Finney
      Senior Member
      • Feb 2009
      • 701

      #3
      Use as much memory as you can. Set it to 240 GB or so if you have 256 and nothing else is running. Make sure you are using the -m parameter properly.
      The line to parse the -m arg is

      case 'm': max_mem = atol(optarg); break;

      There's no "16GB" , it's got to be 16000000000 (if I counted the zeros right).

      Comment

      • lh3
        Senior Member
        • Feb 2008
        • 686

        #4
        More recent versions parse "16G". 0.1.18 definitely does not.

        Comment

        • maubp
          Peter (Biopython etc)
          • Jul 2009
          • 1544

          #5
          It might be worth presorting the 12 individual BAM files before merging, that should make the final sort quicker.

          (The extra IO might overall be slower)

          Comment

          • lre1234
            Senior Member
            • Aug 2011
            • 110

            #6
            So, my 12 original files were all pre-sorted before merging, but I did manage to get the file sorted.

            Originally, I was using samtools 0.1.18, and with the sort command I set the -m flag to 16000000000. This took ~12 hrs to finish.

            After updating to samtools 0.1.19 and using the sort command with -m 2G and -@ 32, the file sorted in about 4hrs...

            Much improvement

            Comment

            Latest Articles

            Collapse

            • SEQadmin2
              Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
              by SEQadmin2



              Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

              Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
              ...
              10-14-2026, 09:55 AM
            • SEQadmin2
              New Genomics Technologies Take Aim at Long-Standing Limits
              by SEQadmin2


              Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

              We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
              ...
              09-28-2026, 10:25 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by SEQadmin2, Yesterday, 10:52 AM
            0 responses
            12 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-14-2026, 05:39 AM
            0 responses
            19 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-13-2026, 09:56 AM
            0 responses
            19 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-09-2026, 11:14 AM
            0 responses
            27 views
            0 reactions
            Last Post SEQadmin2  
            Working...