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
          Recent Advances in Sequencing Analysis Tools
          by seqadmin


          The sequencing world is rapidly changing due to declining costs, enhanced accuracies, and the advent of newer, cutting-edge instruments. Equally important to these developments are improvements in sequencing analysis, a process that converts vast amounts of raw data into a comprehensible and meaningful form. This complex task requires expertise and the right analysis tools. In this article, we highlight the progress and innovation in sequencing analysis by reviewing several of the...
          05-06-2024, 07:48 AM
        • seqadmin
          Essential Discoveries and Tools in Epitranscriptomics
          by seqadmin




          The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
          04-22-2024, 07:01 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by seqadmin, 05-10-2024, 06:35 AM
        0 responses
        16 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 05-09-2024, 02:46 PM
        0 responses
        21 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 05-07-2024, 06:57 AM
        0 responses
        19 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 05-06-2024, 07:17 AM
        0 responses
        20 views
        0 likes
        Last Post seqadmin  
        Working...
        X