Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • winsettz
    Member
    • Sep 2012
    • 91

    #1

    Parsing reads from SAM/BAM by orientation

    Doing some NGS quality control. I'm mapping reads back to a host genome I know is in there, and I'm looking for reads with anomalous behavior, such as forward-forward or reverse-reverse reads.

    I /think/ in SAM flags, this case:

    5'___________________3'
    3'_<--__________<--___5'

    Would be

    Read reverse strand/SEQ being reverse complemented (bit 16)
    Mate reverse strand/SEQ of the next segment in the template being reversed (bit 32)

    Which corresponds to -f 48.

    For the

    5'___-->_____________-->__3'
    3'_______________________5'

    case, am I correct in assuming it is -F 48?

    And for classic reads, it is either read reverse strand (-f 16) or the mate which is reversed (-f 32).

    The upper read in this case is forward strand, and its mate is on the reverse. In the case of the bottom read, its flag would be read-reverse-strand, but not its mate.

    5'___-->__________________3'
    3'___________________<--__5'


    5'___<--__________________3'
    3'___________________-->__5'

    Do I have it right, or am I confused? I've been digging through the blogs for answers, but haven't found any yet. That said, I'm going to manually extract those reads by flag from samtools and remap to reference and see how they look.
    Last edited by winsettz; 09-19-2013, 05:18 PM.
  • swbarnes2
    Senior Member
    • May 2008
    • 910

    #2
    Looks right to me.

    Comment

    • winsettz
      Member
      • Sep 2012
      • 91

      #3
      The other obvious duh I forgot: If I want only reads that are paired, everything is +1 bit, so

      -f 49, but for the second case which I am calling -F 48, I think samtools can take -f and -F simultaneously, so it would be -f 1 -F 48.

      And if I wanted to be sophisticated:
      5'___________________3'
      3'_<--__________<--___5'
      R1=113 (1+16+32+64), or: read-paired, read reverse-strand, mate reverse strand, first-in pair
      R2=177 (1+16+32+128), or: read-paired, read reverse-strand, mate reverse strand, first-in pair

      And
      5'___-->_____________-->__3'
      3'_______________________5'
      R1= -f 65 (1+64, read-paired, first-in-pair), then -F 48 (*not* read-reverse-strand, *not* mate-reverse-strand).
      R1= -f 128 (1+128, read-paired, second-in-pair), then -F 48 (*not* read-reverse-strand, *not* mate-reverse-strand).

      Otherwise, the flags will also bring in data that doesn't have the -f 1 bit, and throw in a bunch of unpaired data? Though if one doesn't have the paired bit, then it's unlikely the other bits would be included. I wonder how SAM filters, but I think the filter simply looks for the /inclusion/ of the bits you mark, and treats them as wildcard?

      Edit:

      ------------------------------------
      At the end of the day, -f 48 covers the <- <- case.

      The -> -> case with -F 48 gave me un-even counts in R1 vs R2, so I went with

      -f 1 (paired) -F 60
      Last edited by winsettz; 10-01-2013, 05:49 AM. Reason: updates

      Comment

      Latest Articles

      Collapse

      • SEQadmin2
        New Genomics Technologies Take Aim at Long-Standing Limits
        by SEQadmin2


        Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

        We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
        ...
        Yesterday, 10:25 AM
      • SEQadmin2
        How Immunogenomics Decodes Immunity’s Genetic Blueprint
        by SEQadmin2




        The immune system’s power comes from its genetic diversity, allowing myriad threats to be neutralized through first recognizing foreign antigens. That diversity is also what makes the immune system so difficult to study. Recent advances in sequencing technology and computational biology, however, are giving researchers new tools to understand immune responses and immune-related diseases in greater detail.

        This convergence of genetics, immunology, and computation...
        09-01-2026, 05:41 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, Today, 09:51 AM
      0 responses
      10 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 09-25-2026, 09:06 AM
      0 responses
      32 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 09-23-2026, 11:05 AM
      0 responses
      27 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 09-18-2026, 11:37 AM
      1 response
      48 views
      0 reactions
      Last Post pekgio
      by pekgio
       
      Working...