Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

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

  • #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


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

      Comment


      • #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

        • seqadmin
          Current Approaches to Protein Sequencing
          by seqadmin


          Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
          04-04-2024, 04:25 PM
        • seqadmin
          Strategies for Sequencing Challenging Samples
          by seqadmin


          Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
          03-22-2024, 06:39 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by seqadmin, 04-11-2024, 12:08 PM
        0 responses
        18 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 04-10-2024, 10:19 PM
        0 responses
        22 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 04-10-2024, 09:21 AM
        0 responses
        16 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 04-04-2024, 09:00 AM
        0 responses
        47 views
        0 likes
        Last Post seqadmin  
        Working...
        X