SAM文件HEADER: SAM Format Header
SAM文件每一列的信息:

image.png

image.png

image.png
理解FLAG值含義的關(guān)鍵在于將FLAG轉(zhuǎn)換為二進(jìn)制,再對(duì)照下方的表,哪一位上是1,就代表這個(gè)比對(duì)符合后面的描述。
計(jì)算機(jī)處理時(shí),可通過對(duì)FLAG值和每種FLAG進(jìn)行與運(yùn)算,若為True,則包含此FLAG,反之不包含。
| FLAG(十進(jìn)制) | 二進(jìn)制 | 描述 | 英文描述 |
|---|---|---|---|
| 1 | 1 | Pair end(PE)測(cè)序,否則是Single end(SE)測(cè)序。 | Read paired |
| 2 | 10 | 代表正常比對(duì),如果是PE測(cè)序,還代表PE的兩條read之間的比對(duì)距離沒有明顯偏離插入片段長(zhǎng)度。 | Read mapped in proper pair |
| 4 | 100 | 該read沒有比對(duì)到參考序列。 | Read unmapped |
| 8 | 1000 | PE測(cè)序的另一個(gè)配對(duì)read沒有比對(duì)到參考序列。 | Mate unmapped |
| 16 | 10000 | 比對(duì)到負(fù)鏈(反向互補(bǔ)后比對(duì)到參考序列)。 | Read reverse strand |
| 32 | 100000 | PE測(cè)序的另一條read反向互補(bǔ)后比對(duì)到參考序列。 | Mate reverse strand |
| 64 | 1000000 | PE測(cè)序read1。 | First in pair |
| 128 | 10000000 | PE測(cè)序read2。 | Second in pair |
| 256 | 100000000 | 二次比對(duì)(secondary alignment),該read在基因組上比對(duì)到了多個(gè)位置,當(dāng)前比對(duì)位置是次佳比對(duì)位置,通常需要過濾掉,但有些分析場(chǎng)景中很有用。 | Not primary alignment |
| 512 | 1000000000 | 低于(測(cè)序平臺(tái)等)過濾閾值。 | Read fails platform/vendor quality checks |
| 1024 | 10000000000 | PCR重復(fù)序列(來自測(cè)序文庫(kù)構(gòu)建過程)或光學(xué)重復(fù)(來自測(cè)序過程)。 | Read is PCR or optical duplicate |
| 2048 | 100000000000 | 該read可能存在嵌合,這個(gè)比對(duì)部分只是來自其中的一部分序列(supplementary alignment)。 | Supplementary alignment |
SAM文件中CIGAR字符串詳細(xì)記錄了read比對(duì)到參考序列上的細(xì)節(jié):
| 標(biāo)記 | 描述 | Description | Consumes query | Consumes reference |
|---|---|---|---|---|
| M | 匹配(包含完全匹配和單堿基錯(cuò)配) | alignment match (can be a sequence match or mismatch) | yes | yes |
| I | 序列插入(包含潛在Insertion變異) | insertion to the reference | yes | no |
| D | 序列刪除(包含潛在Deletion變異) | deletion from the reference | no | yes |
| N | 跳過參考序列 | skipped region from the reference | no | yes |
| S | 軟跳過(soft clip),跳過read中的部分序列,不會(huì)改變r(jià)ead長(zhǎng)度 | soft clipping (clipped sequences present inSEQ) | yes | no |
| H | 硬跳過(hard clip),直接剪切掉read中部分序列,會(huì)改變r(jià)ead長(zhǎng)度 | hard clipping (clipped sequences NOT present inSEQ) | no | no |
| P | padding,類似N,跳過參考序列的部分區(qū)域 | padding (silent deletion from padded reference) | no | no |
| = | 完全匹配 | sequence match | yes | yes |
| X | 序列錯(cuò)配 | sequence mismatch | yes | yes |
“Consumes query” and “consumes reference” indicate whether the CIGAR operation causes the alignment to step along the query sequence and the reference sequence respectively.
BAM文件中除了必須的前11列信息之外,不同的BAM文件中后面記錄metadata的列是不固定的,在不同的處理軟件中輸出時(shí)也會(huì)有所不同,meatdata含義:SAM (Sequence Alignment/Map) Format Alignment Tags (samformat.info)
參考:
從零開始完整學(xué)習(xí)全基因組測(cè)序數(shù)據(jù)分析:第5節(jié) 理解并操作BAM文件
SAM Format Flag
https://samtools.github.io/hts-specs/SAMv1.pdf