Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • id0
    Senior Member
    • Sep 2012
    • 130

    #1

    Why is the samtools multi-threaded argument undocumented?

    There are a bunch of discussion threads regarding samtools multi-threaded argument (-@). However, I can't seem to find any official documentation regarding that. Does anyone know why that is? Is it safe to use? Does it work for only a subset of samtools commands?

    On a related note, are there other undocumented arguments that might be useful?
  • sdriscoll
    I like code
    • Sep 2009
    • 436

    #2
    Weird - I never knew about that option. Maybe that's what was absorbed from the psamtools project that disappeared. It appears to be an option for 'view' and 'sort'. I just tried it with 'view' and samtools does in fact show > 100% cpu use and it converted sam to bam much faster than without so...I guess it's legit. I tried it with 'sort' as well and it worked fine - much faster.
    /* Shawn Driscoll, Gene Expression Laboratory, Pfaff
    Salk Institute for Biological Studies, La Jolla, CA, USA */

    Comment

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

      #3
      There is an open pull request to rename this to -p since the '@' sign causes trouble for some scripting languages like Perl,


      (This was opened a while ago so it may be too late in terms of breaking existing scripts)

      Comment

      • jkbonfield
        Senior Member
        • Jul 2008
        • 146

        #4
        There are at least two different multi-threading implementations in Samtools. Heng Li's and Nils Homer's. The latter appears to be more efficient as it multi-threads decoding too, but it's less clear how to control it to just, say, 500% cpu (as it'll use the same number of threads encoding as decoding). Nils' version takes a -n parameter between "samtools" and the subcommand. Eg samtools -n 4 flagstats a.bam.

        Samtools is undergoing a lot of changes at the moment though with the migration to htslib, and in time the multi-threading issues will be addressed too.

        Comment

        • GenoMax
          Senior Member
          • Feb 2008
          • 7142

          #5
          Originally posted by jkbonfield View Post

          Samtools is undergoing a lot of changes at the moment though with the migration to htslib, and in time the multi-threading issues will be addressed too.
          Is there an ETA for this?

          Comment

          • jkbonfield
            Senior Member
            • Jul 2008
            • 146

            #6
            Not that I know of. I believe the first thing planned is a new official release of the reorganised code base, so some unknown length of time after that for threading investigations.

            We also plan to add CRAM support too, but right now I'm still working on that as part of Staden io_lib's sam/bam/cram code.

            Comment

            • jkbonfield
              Senior Member
              • Jul 2008
              • 146

              #7
              It's not samtools, but maybe still of interest. I released the new version of Staden Package's io_lib (aka libstaden-read in some linux distribution) which contains a multi-threaded BAM/CRAM/SAM converter called scramble.

              The threading is still a work in progress and it should therefore be considered as experimental. It works well for BAM (comparable to Nils Homer's implementation), less well for CRAM (maximum maybe 6x speed up, but varies depending on data set), and is as yet only single-threaded for SAM I/O although the SAM reading and writing is far faster than in Samtools.

              Staden Package /io_lib/1.13.2 files. Browse /io_lib/1.13.2 files for Staden Package


              The code hasn't been tested on Windows yet. Older io_lib releases work, but almost certainly the use of pthreads has broken that. I still need to back-port it to windows, or at least the MinGW/Msys environment.

              I'm NOT planning on adding things like sorting and the basic experiments at merging and pileup are really just demonstration / testing tools for myself. Fundamentally this library was written first and foremost to provide an I/O layer for Gap5 (and gap4, xgap, etc before that). Some of the code will make its way into Samtools later on though - specifically the CRAM implementation.

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