Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • kgulukota
    Member
    • Oct 2011
    • 30

    Why does samtools idxstats not show the stats

    The ref sequences in my bam file are 1, 2, ...

    idxstats reports get that 0 reads are mapped to each reference.

    Code:
    $ samtools idxstats MyBam.bam
    1	197195432	0	0
    10	129993255	0	0
    11	121843856	0	0
    And yet, the bam file is fine, I can see millions of reads mapped to each reference sequence (with samtools view) and I can run mpileup on it as well. Why would idxstats not work? Any ideas?

    Thanks,
    Gulu
    Kamalakar Gulukota,
    Director,
    Center for Bioinformatics and Computational Biology
    NorthShore University Health System, [email protected]
  • twaddlac
    Member
    • Feb 2011
    • 49

    #2
    I'm not sure why it wouldn't work - I never had a problem with it before.

    If you're looking for a workaround you could so something like:
    Code:
    samtools view MyBam.bam | cut -f3 | sort | uniq -c
    Though this will omit the length of the reference.

    I hope this helps!

    Comment

    • kgulukota
      Member
      • Oct 2011
      • 30

      #3
      Thank you twaddlac! Yes, I have been doing something like that. Unfortunately I have multiple files and each file has billions of lines and hence my server takes hours per file for this. I thought idxstats might have a fast way. Oh well ...
      Kamalakar Gulukota,
      Director,
      Center for Bioinformatics and Computational Biology
      NorthShore University Health System, [email protected]

      Comment

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

        #4
        Try reindexing - 'samtools idxstats' relies on extra fields in the BAI file which are not present in very old BAI files (early versions of 'samtools index' didn't write them).

        Comment

        • kgulukota
          Member
          • Oct 2011
          • 30

          #5
          Thank you maubp!

          I reindexed and it worked fine. (The original .bai file was something I downloaded from a public site along with the bam file).
          Kamalakar Gulukota,
          Director,
          Center for Bioinformatics and Computational Biology
          NorthShore University Health System, [email protected]

          Comment

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

            #6
            Originally posted by kgulukota View Post
            Thank you maubp!

            I reindexed and it worked fine. (The original .bai file was something I downloaded from a public site along with the bam file).
            Great - can you try contacting the site so they can update their BAI files too?

            Comment

            Latest Articles

            Collapse

            • GATTACAT
              Reply to Nine Things a Sample Prep Scientist Thinks About Before Sequencing
              by GATTACAT
              Love this - good data definitely starts from good input, and poor input can only give relatively poor data. I particularly like the mention of Nanodrop/absorbance based methods for quantification. It's such a toss up if you'll get an accurate reading or what amounts to a randomly generated number, and a lot of library/sequencing related issues can be traced back to poor quant.
              07-01-2026, 11:43 AM
            • SEQadmin2
              Nine Things a Sample Prep Scientist Thinks About Before Sequencing
              by SEQadmin2


              I’m not a sequencing expert. I’m a purification scientist who uses NGS to evaluate workflows my group develops. With this perspective, we think about the sample first and the NGS workflow second. The sequencer is an exceptionally honest reporter, but it can only report on what you give it, so whether you get clean, interpretable data from an NGS workflow is largely determined before you begin.

              Here are nine questions we think about, in roughly the order they matter, before...
              06-18-2026, 07:11 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by SEQadmin2, Yesterday, 11:08 AM
            0 responses
            6 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 06-30-2026, 05:37 AM
            0 responses
            11 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 06-26-2026, 11:10 AM
            0 responses
            19 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 06-17-2026, 06:09 AM
            0 responses
            53 views
            0 reactions
            Last Post SEQadmin2  
            Working...