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
              Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
              by SEQadmin2



              CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

              Despite this, “CRISPR helped turn genome editing from a specialized technique into
              ...
              07-31-2026, 11:01 AM
            • SEQadmin2
              Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
              by SEQadmin2


              Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

              The systematic characterization of the human proteome has
              ...
              07-20-2026, 11:48 AM
            • SEQadmin2
              Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
              by SEQadmin2



              Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
              ...
              07-09-2026, 11:10 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by SEQadmin2, 08-03-2026, 10:13 AM
            0 responses
            15 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 07-31-2026, 02:55 AM
            0 responses
            32 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 07-24-2026, 12:17 PM
            0 responses
            23 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 07-23-2026, 11:41 AM
            0 responses
            21 views
            0 reactions
            Last Post SEQadmin2  
            Working...