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
          Choosing Between NGS and qPCR
          by seqadmin



          Next-generation sequencing (NGS) and quantitative polymerase chain reaction (qPCR) are essential techniques for investigating the genome, transcriptome, and epigenome. In many cases, choosing the appropriate technique is straightforward, but in others, it can be more challenging to determine the most effective option. A simple distinction is that smaller, more focused projects are typically better suited for qPCR, while larger, more complex datasets benefit from NGS. However,...
          10-18-2024, 07:11 AM
        • seqadmin
          Non-Coding RNA Research and Technologies
          by seqadmin




          Non-coding RNAs (ncRNAs) do not code for proteins but play important roles in numerous cellular processes including gene silencing, developmental pathways, and more. There are numerous types including microRNA (miRNA), long ncRNA (lncRNA), circular RNA (circRNA), and more. In this article, we discuss innovative ncRNA research and explore recent technological advancements that improve the study of ncRNAs.

          Nobel Prize for MicroRNA Discovery
          This week,...
          10-07-2024, 08:07 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by seqadmin, Yesterday, 06:09 AM
        0 responses
        10 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 10-30-2024, 05:31 AM
        0 responses
        12 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 10-24-2024, 06:58 AM
        0 responses
        21 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 10-23-2024, 08:43 AM
        0 responses
        52 views
        0 likes
        Last Post seqadmin  
        Working...
        X