Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • acoada
    Junior Member
    • Dec 2013
    • 8

    #1

    what if samtools sort failed while merging from temp files..

    I was sorting a hug BAM file using
    Code:
    samtools sort -@ 5 -m 4G  <in.bam> <out.prefix>
    While merging from temp files
    Code:
     [bam_sort_core] merging from 630 files...
    it was killed 'cos lack of memory...

    So I checked the temp files and found that I could not simply use samtools merge to merge those temp files 'cos they were not in order

    What shall I do if I just don't wanna start over again...*
  • Brian Bushnell
    Super Moderator
    • Jan 2014
    • 2709

    #2
    FYI, the "-@ 5" and "-m 4G" specify 4GB per thread for 5 threads, so 20GB total. You need to reduce the number of threads or the memory limit if you were trying to stay under 4GB.

    Comment

    • acoada
      Junior Member
      • Dec 2013
      • 8

      #3
      Originally posted by Brian Bushnell View Post
      FYI, the "-@ 5" and "-m 4G" specify 4GB per thread for 5 threads, so 20GB total. You need to reduce the number of threads or the memory limit if you were trying to stay under 4GB.
      Yep, the total memory should under 20Gb, yet it got 25Gb while merging, so it was killed.

      I just wanna know is there any way to tell samtools to redo the merge( just the merge), 'cos the temp files are already sorted in some way( fast sort? I'm not sure) and I don't want to waste the time to redo the sort.

      Thank you~

      Comment

      • Brian Bushnell
        Super Moderator
        • Jan 2014
        • 2709

        #4
        No, it probably died sorting the temp files. The split and merge parts are both low-memory, only the sort is high-memory.

        Comment

        • acoada
          Junior Member
          • Dec 2013
          • 8

          #5
          Originally posted by Brian Bushnell View Post
          No, it probably died sorting the temp files. The split and merge parts are both low-memory, only the sort is high-memory.
          samtools has told me that
          Code:
            [bam_sort_core] merging from 630 files...
          thus I am sure the all the temp files have been sorted and
          samtools was killed while doing merging work ...

          The point is, is there any way to redo the merging only, 'cos sorting was really time consuming...

          Comment

          • Brian Bushnell
            Super Moderator
            • Jan 2014
            • 2709

            #6
            I imagine that the merge and sort are done simultaneously. Anyway - if you want results you can trust, of course you can't use temp files from a program that crashed with a nondeterministic out-of-memory error; they could be in any condition.

            Note - I could be wrong; I can't remember the order of samtools' sort messages since I always ignore them. But there's no reason for it to need 25GB RAM while merging unless it is sorting at the same time, or writes are being internally buffered; and in either case, the temp files could be corrupt.
            Last edited by Brian Bushnell; 05-05-2014, 08:37 PM.

            Comment

            • acoada
              Junior Member
              • Dec 2013
              • 8

              #7
              Originally posted by Brian Bushnell View Post
              I imagine that the merge and sort are done simultaneously. Anyway - if you want results you can trust, of course you can't use temp files from a program that crashed with a nondeterministic out-of-memory error; they could be in any condition.

              Note - I could be wrong; I can't remember the order of samtools' sort messages since I always ignore them. But there's no reason for it to need 25GB RAM while merging unless it is sorting at the same time, or writes are being internally buffered; and in either case, the temp files could be corrupt.
              You're right. Samtools do sort while merging temp files, because there isn't ordinal order between temp files( each temp file contains all the chromosome... ) .

              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, 11:13 AM
              0 responses
              21 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, Yesterday, 10:48 AM
              0 responses
              18 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-15-2026, 10:52 AM
              0 responses
              36 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-14-2026, 05:39 AM
              0 responses
              42 views
              0 reactions
              Last Post SEQadmin2  
              Working...