Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • a_mt
    Member
    • Jul 2012
    • 34

    #1

    Uniquely mapped reads from BAM file (BWA)

    Hi all,

    I know this question has been asked many times. But, I am still not able to find the proper answer. So, how do you caluclate the number of uniquely mapped reads from BAM file generated by BWA?

    So far, I have tried the folowing:

    Code:
    samtools flagstat LPCWLN_fsorted.bam
    118956972 + 0 in total (QC-passed reads + QC-failed reads)
    0 + 0 duplicates
    117768703 + 0 mapped (99.00%:-nan%)
    118956972 + 0 paired in sequencing
    59478678 + 0 read1
    59478294 + 0 read2
    116464167 + 0 properly paired (97.90%:-nan%)
    117419717 + 0 with itself and mate mapped
    348986 + 0 singletons (0.29%:-nan%)
    834518 + 0 with mate mapped to a different chr
    755636 + 0 with mate mapped to a different chr (mapQ>=5)
    
    samtools view LPCWLN_fsorted.bam | wc -l
    118956972
    
    samtools view -F 256 LPCWLN_fsorted.bam | wc -l
    118956972
    
    samtools view LPCWLN_fsorted.bam | grep XT:A:U | wc -l
    105334435
    I am totally confused now? Does the 3rd line of flagstat o/p gives the no. of uniqely mapped reads ? or the SAM flag -F 256 gives ? or the other one?

    Appreciate any help.

    Thanks
  • Brian Bushnell
    Super Moderator
    • Jan 2014
    • 2709

    #2
    bwa adds "XT:A:R" to to ambiguously-mapped reads and "XT:A:U" to uniquely-mapped reads, so filtering by that tag should work. The 256 bit (0x100) indicates that an alignment is secondary, which is relevant, but won't help you in this case. Note that if you map with BBMap (which also adds XT:A:U and XT:A:R tags), you can use the flag "ambig=toss" to consider ambiguously-mapping reads as unmapped; only uniquely-mapped reads will be considered mapped.
    Last edited by Brian Bushnell; 04-29-2014, 12:05 PM.

    Comment

    • a_mt
      Member
      • Jul 2012
      • 34

      #3
      Hi,

      Thank you very much for the reply.
      Code:
      XT:A:U
      tag works fine

      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...