Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • genomeHunter
    Member
    • Apr 2013
    • 26

    #1

    Fast BAM sorting

    Hello,

    I have lots of unsorted BAM files and the sorting process is very slow. One solution I could think of was to run multiple instances of samtools:

    cat files.txt | xargs -n 1 -P $num_threads samtools sort

    The problem is that this method is I/O bound. Are there any (free) faster alternatives?

    Should I try novosort?

    Cheers
    GH
  • Heisman
    Senior Member
    • Dec 2010
    • 534

    #2
    Are you aware you can use samtools sort with multiple threads with the "-@" option?

    Comment

    • GenoMax
      Senior Member
      • Feb 2008
      • 7142

      #3
      If you are doing this on a cluster (with a storage subsystem that can support multiple I/O streams) Heisman's solution will work.

      If you are I/O bound on a single server then your only option is patience.
      Last edited by GenoMax; 07-19-2013, 11:58 AM.

      Comment

      • genomeHunter
        Member
        • Apr 2013
        • 26

        #4
        Originally posted by Heisman View Post
        Are you aware you can use samtools sort with multiple threads with the "-@" option?
        No, I was not. I saw the "-@" option in a fork of samtools, I guess it was called samtools-mt. I did not know it was added to samtools.

        Thanks,
        GH

        Comment

        • genomeHunter
          Member
          • Apr 2013
          • 26

          #5
          Originally posted by GenoMax View Post
          If you are doing this on a cluster (with a storage subsystem that can support multiple I/O streams) Heisman's solution will work.

          If you are I/O bound on a single server then your only option is patience.
          I tried it on a moderate-sized BAM file and it was not very fast on our mini-server (32 Cores and RAID-6 disk). I guess I will be using xargs :-)

          Cheers,
          GH

          Comment

          • Richard Finney
            Senior Member
            • Feb 2009
            • 701

            #6
            Please note the -m parameter for samtools sort , this is the amount of memory to use.
            Using available memory will speed up thing. This also works for novocraft's novosort. You may also wish to copy to a fast disk for any temp files that spill to disk.

            Comment

            • genomeHunter
              Member
              • Apr 2013
              • 26

              #7
              Originally posted by Richard Finney View Post
              Please note the -m parameter for samtools sort , this is the amount of memory to use.
              Using available memory will speed up thing. This also works for novocraft's novosort. You may also wish to copy to a fast disk for any temp files that spill to disk.
              Thanks. I am using 4GB/threads and 16 threads. Our main disk is a 12-disk RAID-6 arrays with enterprise-level HDDs.

              Do you know how does samtools sort compare to SortSam and NovoSort?

              Cheers,
              GH

              Comment

              • GenoMax
                Senior Member
                • Feb 2008
                • 7142

                #8
                Originally posted by genomeHunter View Post
                Our main disk is a 12-disk RAID-6 arrays with enterprise-level HDDs.

                Cheers,
                GH
                How is it connected to the server: 6 Gbps SAS/8 Gbps Fiber Channel HBA?

                Comment

                • genomeHunter
                  Member
                  • Apr 2013
                  • 26

                  #9
                  Originally posted by GenoMax View Post
                  How is it connected to the server: 6 Gbps SAS/8 Gbps Fiber Channel HBA?
                  I am not 100% sure but it must be 6 Gbps SAS.

                  GH

                  Comment

                  • lh3
                    Senior Member
                    • Feb 2008
                    • 686

                    #10
                    Multi-threading is available in the released package. Novosort is faster than samtools.

                    Comment

                    • genomeHunter
                      Member
                      • Apr 2013
                      • 26

                      #11
                      Originally posted by lh3 View Post
                      Multi-threading is available in the released package. Novosort is faster than samtools.
                      Do you have any rough speedup factors? I tried

                      samtools view -buS exp.sam | samtools sort -@ 16 -m 4G - sorted

                      And it takes 10 minutes for a moderate size SAM file.

                      Cheers,
                      GH

                      Comment

                      • GenoMax
                        Senior Member
                        • Feb 2008
                        • 7142

                        #12
                        GH: Here are some systems tools to check if any hardware bottlenecks exist on your system. Start with the "iostat": http://www.thegeekstuff.com/2011/07/...stat-examples/

                        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
                        16 views
                        0 reactions
                        Last Post SEQadmin2  
                        Started by SEQadmin2, Yesterday, 10:48 AM
                        0 responses
                        17 views
                        0 reactions
                        Last Post SEQadmin2  
                        Started by SEQadmin2, 10-15-2026, 10:52 AM
                        0 responses
                        35 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...