Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • adrian
    Member
    • Oct 2009
    • 90

    #1

    How can I add NH:i:1 tag for every uniquely mapped read from BWA

    Hi:

    I have a BWA aligned BAM file. This BWA generated BAM file does not have NH:i:1 tag.

    My aim is to create a BAM file where read is mapped uniquely and add NH:i:1 tag at the end of read.

    I can filter BWA generated BAM file based on XT:A:U tag.


    However, I am not sure how to add NH:i:1 at end of every alignment read.

    Is there a way to do in pysam. I don't know exactly how to add NH:i:1 tag at end of read has XT:A:U tag. I appreciate any help.

    Thank you.


    from the following:

    AMSAG1_299:7:2206:6444:162983 1187 1 249246 23 75M = 249327 156 CTGCGGGTGAAGTTCAAAGTACTATTCGGGTTTTTTTTTTAAAGTTTGGCTGGGTGCAGCGGCTCACGCCTGTAA @@@FFFFDDDH?FBHIGIIDGHGIJIJJIJJGHIIJJGI>BBBDCE@A=6;@@?,38CA587;;;>><??A8:>C X0:i:1 X1:i:1 XA:Z:16,-90270336,75M,1; MD:Z:75 RG:Z:128215 XG:i:0 AM:i:0 NM:i:0 SM:i:23 XM:i:0 XO:i:0 XT:A:U <<<--


    TO:

    AMSAG1_299:7:2206:6444:162983 1187 1 249246 23 75M = 249327 156 CTGCGGGTGAAGTTCAAAGTACTATTCGGGTTTTTTTTTTAAAGTTTGGCTGGGTGCAGCGGCTCACGCCTGTAA @@@FFFFDDDH?FBHIGIIDGHGIJIJJIJJGHIIJJGI>BBBDCE@A=6;@@?,38CA587;;;>><??A8:>C X0:i:1 X1:i:1 XA:Z:16,-90270336,75M,1; MD:Z:75 RG:Z:128215 XG:i:0 AM:i:0 NM:i:0 SM:i:23 XM:i:0 XO:i:0 XT:A:U NH:i:1 <<<---
  • maubp
    Peter (Biopython etc)
    • Jul 2009
    • 1544

    #2
    Someone has asked the same question on the pysam user group:


    If you are going to send duplicate questions to multiple places, please include the links to avoid wasting people's time. Thank you.

    Comment

    • adrian
      Member
      • Oct 2009
      • 90

      #3
      Thank you!
      Last edited by adrian; 06-25-2014, 06:01 PM.

      Comment

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

        #4
        Presumably (since you asked on the pysam group) you can program in Python?

        Do you want to add
        Code:
        NH:i:1
        to every single read, or should there be a test of some kind? e.g. Only do this to mapped reads?

        Essentially open the input BAM file, loop over all the reads - modify the
        Code:
        .tags
        attribute to change the tags, and output the modified read. If you can find an example using pysam to filter a BAM file that would be a good basis to start from.

        (You don't have to use pysam - see https://github.com/peterjc/picobio/b..._strip_tags.py for a related task which uses plain Python and the samtools command to handle SAM/BAM conversion - but for more complicated work pysam would be worth learning)

        Comment

        Latest Articles

        Collapse

        • SEQadmin2
          16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
          by SEQadmin2




          NGS has revolutionized clinical microbiology by offering new ways to identify and surveil pathogens without prior knowledge of the target. One popular approach is 16S rRNA and ITS amplicon sequencing, which targets specific microbial markers. But studies are increasingly incorporating shotgun metagenomics, a technique that sequences all DNA from a sample without targeting specific microbial markers. This approach allows more detailed taxonomic classification, detection...
          10-30-2026, 06:46 AM
        • 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

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by SEQadmin2, 10-28-2026, 09:57 AM
        0 responses
        41 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-28-2026, 09:51 AM
        0 responses
        25 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-22-2026, 11:13 AM
        0 responses
        74 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-22-2026, 10:48 AM
        0 responses
        48 views
        0 reactions
        Last Post SEQadmin2  
        Working...