Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • how to get reads with "mate mapped to a different chr"

    In the output of
    Code:
    samtools flagstat input.bam
    There is these last two lines:

    HTML Code:
    xxx +0 with mate mapped to a different chr
    xxx +0 with mate mapped to a different chr (mapQ>=5)
    I'm wondering what's the FLAG for "mate mapped to a different chr"?

  • #2
    There is no flag; you compare "rname" with "rnext". If they are the same, or "rnext" is "=", and they are both mapped (0x1 set, 0x4 and 0x8 not set) then they are on the same sequence. They are mapped to different sequences if both are mapped but rnext is not "=" and not equal to rname.

    Comment


    • #3
      Originally posted by Brian Bushnell View Post
      There is no flag; you compare "rname" with "rnext". If they are the same, or "rnext" is "=", and they are both mapped (0x1 set, 0x4 and 0x8 not set) then they are on the same sequence.
      oh, i see. Thanks!

      Comment


      • #4
        Good question.

        Consult the Sam format documentation.



        Section 1.4 contains the bitwise flag descriptions.

        Note that not all software properly sets these flags.

        I guess you'd check the 0x4 and 0x8 flags ( 0x4=segment unmapped, 0x8=segment unmapped). If both unmapped then check if field 3 (RNAME) is not same as field 7 (RNEXT) [and 8 field is not '*' and not '='] .

        There are various "FIXMATE" programs running around; you may wish to use.

        I'm not sure about 0x800 flag (not same as 0x8). "Chimeric" I'm guessing doesn't always mean same chromosome.
        Last edited by Richard Finney; 01-12-2015, 12:24 PM.

        Comment


        • #5
          Originally posted by Richard Finney View Post
          I'm not sure about 0x800 flag (not same as 0x8). "Chimeric" i'm guessing doesn't always mean same chromosome.
          I don't think the answer is fully defined for either chimeric or secondary alignments.

          Comment


          • #6
            Originally posted by Brian Bushnell View Post
            I don't think the answer is fully defined for either chimeric or secondary alignments.
            I'm actually pretty confused about what is "secondary alignment".. can you clarify it a little bit?

            Also, in the attached image, I don't understand how the entry in the second column equals to that in the first column? For example, 0x0001 and p are supposed to represent the same thing I guess? what's the encoding conversion rules here? And where is the string representation used? In BAM files?
            Attached Files

            Comment


            • #7
              I have not seen that string notation before ("p", "P", etc) and it's not part of the SAM specification as far as I know. Reads are supposed to have at most one primary alignment; if a read maps to multiple locations, it can have multiple secondary alignments (0x100 flag bit). But reads can also have multiple 0x800 "supplementary" alignments, a new feature of the sam format which is rather confusing.

              Comment


              • #8
                Originally posted by Brian Bushnell View Post
                I have not seen that string notation before ("p", "P", etc) and it's not part of the SAM specification as far as I know. Reads are supposed to have at most one primary alignment; if a read maps to multiple locations, it can have multiple secondary alignments (0x100 flag bit). But reads can also have multiple 0x800 "supplementary" alignments, a new feature of the sam format which is rather confusing.
                Yeah, the documentation is very limited and confusing. I have to search online for a few tutorials to get an OK understanding of bitwise FLAG..

                I'm confused.. what does supplementary alignment mean?

                Comment


                • #9
                  In practice, if you run bwa, it means a chimeric alignment, in which there are multiple local alignments that are not very close to each other. I am not aware of any other aligners that generate it.

                  Comment


                  • #10
                    Originally posted by Brian Bushnell View Post
                    In practice, if you run bwa, it means a chimeric alignment, in which there are multiple local alignments that are not very close to each other. I am not aware of any other aligners that generate it.
                    I see. Thanks.

                    Comment


                    • #11
                      Originally posted by Brian Bushnell View Post
                      I have not seen that string notation before ("p", "P", etc) and it's not part of the SAM specification as far as I know.
                      It's been deprecated. Back in the day, there was a multicharacter version of the FLAG field available from samtools. That was done away with after the conversion to htslib (I'm pretty sure it was still there in 0.1.19). The only thing I've ever seen use those is BS-Seeker2, in fact.

                      Comment


                      • #12
                        Originally posted by dpryan View Post
                        It's been deprecated. Back in the day, there was a multicharacter version of the FLAG field available from samtools. That was done away with after the conversion to htslib (I'm pretty sure it was still there in 0.1.19). The only thing I've ever seen use those is BS-Seeker2, in fact.
                        I see. Good to know!

                        Comment


                        • #13
                          one way to get it

                          see https://www.biostars.org/p/17575/#327644
                          http://www.bits.vib.be/index.php

                          Comment

                          Latest Articles

                          Collapse

                          • 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
                          • seqadmin
                            Techniques and Challenges in Conservation Genomics
                            by seqadmin



                            The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

                            Avian Conservation
                            Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
                            03-08-2024, 10:41 AM

                          ad_right_rmr

                          Collapse

                          News

                          Collapse

                          Topics Statistics Last Post
                          Started by seqadmin, Yesterday, 06:37 PM
                          0 responses
                          8 views
                          0 likes
                          Last Post seqadmin  
                          Started by seqadmin, Yesterday, 06:07 PM
                          0 responses
                          8 views
                          0 likes
                          Last Post seqadmin  
                          Started by seqadmin, 03-22-2024, 10:03 AM
                          0 responses
                          49 views
                          0 likes
                          Last Post seqadmin  
                          Started by seqadmin, 03-21-2024, 07:32 AM
                          0 responses
                          66 views
                          0 likes
                          Last Post seqadmin  
                          Working...
                          X