flags in SAM format

次世代シーケンサから出てくるshort readのアラインメントを扱うときのフォーマット。今のところ、一番デファクトに近いところにいる、といえるでしょう。

http://samtools.sourceforge.net/SAM1.pdf
http://samtools.sourceforge.net/samtools.shtml

SAM toolsが使えるのでいろいろオイシイのだけれど、このフォーマットを解釈するときに必須のフラグが16進でが定義されているんだよね。2進にした方が見やすいときもある...ということで、2進も追加したバージョン。

Flag(binary)             Flag(hex)  Description
0b 0000 0000 0000 0001   0x0001	    the read is paired in sequencing
0b 0000 0000 0000 0010   0x0002	    the read is mapped in a proper pair
0b 0000 0000 0000 0100   0x0004	    the query sequence itself is unmapped
0b 0000 0000 0000 1000   0x0008	    the mate is unmapped

0b 0000 0000 0001 0000   0x0010	    strand of the query (1 for reverse)
0b 0000 0000 0010 0000   0x0020	    strand of the mate
0b 0000 0000 0100 0000   0x0040	    the read is the first read in a pair
0b 0000 0000 1000 0000   0x0080	    the read is the second read in a pair

0b 0000 0001 0000 0000   0x0100	    the alignment is not primary
0b 0000 0010 0000 0000   0x0200	    the read fails platform/vendor quality checks
0b 0000 0100 0000 0000   0x0400	    the read is either a PCR or an optical duplicate