SAM flag
SAM文件是二进制比对文件,其中FLAG值记录了该read的比对信息。 FLAG巧妙地采用二进制来存储信息,解读FLAG即可确定read属性,所以samtools常常依据FLAG来过滤处理SAM/BAM。
Python code
1 | import argparse |
执行程序即可解析 1
2
3
4
5
6
7
8
9
10
11
12$ python flags_explain.py -i 1294
Flags: 1294
Hex Dec Property Information
0x2 2 PROPER_PAIR ..each segment properly aligned according to the aligner
0x4 4 UNMAP ..segment unmapped
0x8 8 MUNMAP ..next segment in the template unmapped
0x100 256 SECONDARY ..secondary alignment
0x400 1024 DUPLICATE ..PCR or optical duplicate
0x50e 1294 PROPER_PAIR,UNMAP,MUNMAP,SECONDARY,DUPLICATE
htslib 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24/*! @abstract the read is paired in sequencing, no matter whether it is mapped in a pair */
/*! @abstract the read is mapped in a proper pair */
/*! @abstract the read itself is unmapped; conflictive with BAM_FPROPER_PAIR */
/*! @abstract the mate is unmapped */
/*! @abstract the read is mapped to the reverse strand */
/*! @abstract the mate is mapped to the reverse strand */
/*! @abstract this is read1 */
/*! @abstract this is read2 */
/*! @abstract not primary alignment */
/*! @abstract QC failure */
/*! @abstract optical or PCR duplicate */
/*! @abstract supplementary alignment */