Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • swbarnes2
    Senior Member
    • May 2008
    • 910

    #1

    Issue with new samtools 1.0 index and idxstats

    When using samtools 1.19, I would index my .bam, and use idxstatst to make a file of read counts per sequence in my reference, and the unmapped reads would be at the bottom of the list.

    The line would look like

    * 0 0 1027820

    To show 1027820 reads did not align

    When using samtools 1.0 to index, now, the idxstats file always claims there is exactly 1 read that mapped to nothing, which is clearly wrong.

    Can anyone else replicate this? This can't be the desired behavior, can it?
  • dpryan
    Devon Ryan
    • Jul 2011
    • 3478

    #2
    I just tested on an old BAM file (reindexed and ran idxstats) and got 0, as appropriate. Perhaps this only happens if there are unmapped reads in the file? I should note that you should ensure that both htslib and samtools are on the 1.0 tag release. When I just recloned them (just to ensure that any local changes weren't in there) I couldn't even compile samtools since the most current commit breaks compilation with the version of htslib I had from earlier in the day.

    Comment

    • swbarnes2
      Senior Member
      • May 2008
      • 910

      #3
      I went into the htslib-1.0 folder of my samtools 1.0 folder, and "make" seems to finish without errors, but samtools 1.0 still does the same thing: idxstats run from the v 1.0 indexing shows only 1 unmapped read. Rebuilding the index with 0.1.19 and rerunning idxstats shows the correct number.
      Last edited by swbarnes2; 08-19-2014, 02:32 PM.

      Comment

      • dariober
        Senior Member
        • May 2010
        • 311

        #4
        Originally posted by swbarnes2 View Post
        Can anyone else replicate this? This can't be the desired behavior, can it?
        I just upgraded to samtools-1.0.

        Indeed the same happens to me:

        Code:
        samtools --version
        samtools 1.0
        Using htslib 1.0
        Copyright (C) 2014 Genome Research Ltd.
        
        samtools index fk042_F5_14_CHEM1.bam
        samtools idxstats fk042_F5_14_CHEM1.bam | tail -n1
        *	0	0	1
        
        ## Now with samtools 0.18.0:
        ~/applications/samtools/samtools-0.1.18/samtools index fk042_F5_14_CHEM1.bam
        samtools idxstats fk042_F5_14_CHEM1.bam | tail -n1
        *	0	0	8882

        Comment

        • dpryan
          Devon Ryan
          • Jul 2011
          • 3478

          #5
          @dariober: In fact this is the issue I alluded to over on biostars :P

          It turns out that this only happens if there are unmapped read in the BAM file (otherwise, it correctly reports 0).

          Comment

          • dpryan
            Devon Ryan
            • Jul 2011
            • 3478

            #6
            I've submitted a bug report.

            Comment

            • swbarnes2
              Senior Member
              • May 2008
              • 910

              #7
              Originally posted by dpryan View Post
              I've submitted a bug report.
              Thank you. I didn't want to do that until I had some confirmation that other people were seeing the problem.

              Comment

              • dpryan
                Devon Ryan
                • Jul 2011
                • 3478

                #8
                I created a pull request to fix this.

                Comment

                • dariober
                  Senior Member
                  • May 2010
                  • 311

                  #9
                  Originally posted by dpryan View Post
                  I created a pull request to fix this.
                  Thanks a lot for taking care of this issue. Here's my comment to your post on github:

                  I'm quite keen on querying the index to get the number of unmapped reads, so I favour the second solution. (With the disclaimer the I'm not the one going to fix it though!)

                  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
                    ...
                    Today, 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, Today, 05:39 AM
                  0 responses
                  9 views
                  0 reactions
                  Last Post SEQadmin2  
                  Started by SEQadmin2, Yesterday, 09:56 AM
                  0 responses
                  11 views
                  0 reactions
                  Last Post SEQadmin2  
                  Started by SEQadmin2, 10-09-2026, 11:14 AM
                  0 responses
                  25 views
                  0 reactions
                  Last Post SEQadmin2  
                  Started by SEQadmin2, 09-29-2026, 09:51 AM
                  0 responses
                  76 views
                  0 reactions
                  Last Post SEQadmin2  
                  Working...