I want to subtract the reads from forward and reverse strand, from a BAM file of Histone ChiP-seq data, to get the net reads mapping on either forward/reverse strand, how to do that. Any suggestions will be appreciated.
0x20 is if your data is paired end and will filter based on the strand of the mate. You want 0x10 for the query. For standard NGS data, mostly your pairs should be on the opposite strands anyway - except for weird events like DNA translocations, e.g., inversions.
[There is a slide (Using NGS Data to find chromosomal rearrangements) in this [PDF][1] to explain how the pairs will behave for these events.]
so do this for forward:
samtools view -F 0x10
and this for reverse:
samtools view -f 0x10
Use the -X flag in "samtools view" to convert the flag column from a numeric bit field to letters (as described here) like this:
And since I don't see it mentioned on this particular page, I'll add that tool at https://broadinstitute.github.io/picard/explain-flags.html is particularly helpful for making and deciphering these commands. The fact that the flag 20 includes both unmapped and those mapped to the reverse strand was not obvious to me at first. Bitwise is a compact but not immediately obvious way to indicate these sets. Slides 28-31 of Pierre Lindenbaums's presentation, which he highlighted in this post SAM flags meaning helped a lot.
ADD REPLY
• link
updated 2.4 years ago by
Ram
44k
•
written 9.6 years ago by
Wayne
★
2.1k
1
Entering edit mode
Thanks! Specially, the URL from broadInstitute was very useful.
Hey there,
I want to subtract the reads from forward and reverse strand, from a BAM file of Histone ChiP-seq data, to get the net reads mapping on either forward/reverse strand, how to do that. Any suggestions will be appreciated.