Hello,
I have a question about editing the flag number in sam/bam files. For my particular project, I will need to manually edit the flag after alignment, mainly because the orientation of reads is sometimes opposite as it should be. For example, the aligner may give a flag of 99, which means 5'-3' orientation (on the Waston (positive) strand); but in fact it should be 147, which means 3'-5'.
I think I could do it in binary for bam, because orientation is only one binary numbers for flag; but I'm not sure how to do it directly in sam since the number is combined with all other situations (e.g. 1 or 2 pair, mapped/unmapped, etc...). Any one has some suggestions please?
Thank you very much in advance for your attention:)
It should not be very difficult with a simple script. Get an idea on how to split the combined number. http://www.samformat.info/#/flag
This post might help you as well to get an idea: Tool to unmark duplicates Its not exactly same but deals with modifying samflags
Thank you. I've been using https://broadinstitute.github.io/picard/explain-flags.html for the same purpose. I guess I will need to write a script for this. Appreciate your help.