惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
量子位
D
DataBreaches.Net
博客园 - 司徒正美
J
Java Code Geeks
博客园 - 【当耐特】
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
B
Blog
The Cloudflare Blog
D
Docker
I
InfoQ
爱范儿
爱范儿
MongoDB | Blog
MongoDB | Blog
腾讯CDC
月光博客
月光博客
Hugging Face - Blog
Hugging Face - Blog
Microsoft Azure Blog
Microsoft Azure Blog
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
S
SegmentFault 最新的问题
GbyAI
GbyAI
有赞技术团队
有赞技术团队

郑泽鑫的博客

使用 Github Actions 自动更新 ANNOVAR 的 Clinvar 数据库 2020 年终总结 - 郑泽鑫的博客 解包一个 PAR 打包的 perl 程序源码 阿里云PBS作业排队管理 - 郑泽鑫的博客 VPS装机记录(3):任务机器人 - 郑泽鑫的博客 VPS装机记录(2):使用mosh - 郑泽鑫的博客 2019 年终总结 - 郑泽鑫的博客 VPS装机记录(1):SSH篇 - 郑泽鑫的博客 Typecho博客被刷垃圾评论 - 郑泽鑫的博客 记录 VEP 关于 COSMIC 注释的一个坑 记录一次 Name.com 自动续费成功退款的经过 - 郑泽鑫的博客 静态编译 Tmux - 郑泽鑫的博客 基因组、cDNA、氨基酸坐标转换神器:Transvar - 郑泽鑫的博客 macOS Case Sensitive to Case Insensitive(使用 Carbon Copy Cloner) 2018 年终总结 - 郑泽鑫的博客 ANNOVAR (3): 更新 COSMIC 数据库 (v70+) ANNOVAR (2): 关于注释数据库 - 郑泽鑫的博客 PyInstaller 打包 python 脚本的一些心得 - 郑泽鑫的博客 今天是万圣节 - 郑泽鑫的博客 用 youtube-dl 下载油管视频 - 郑泽鑫的博客 伊恩结 - 郑泽鑫的博客 annovar 注释软件 - 郑泽鑫的博客 Pileup Format 学习笔记 - 郑泽鑫的博客 Github 万圣节彩蛋 - 郑泽鑫的博客
SAM 文件学习笔记 - 郑泽鑫的博客
with / · 2016-04-02 · via 郑泽鑫的博客

The SAM Format Specification

SAM stands for Sequence Alignment/Map format. It is a TAB-delimited text format consisting of a header section, which is optional, and an alignment section. If present, the header must be prior to the alignments. Header lines start with ‘@’, while alignment lines do not. Each alignment line has 11 mandatory fields for essential alignment information such as mapping position, and variable number of optional fields for flexible or aligner specific information.

An example

示例
示例

Terminologies and Concepets/名词术语和概念

  • Template
  • Segment
  • Read
  • Linear alignment 线性比对
  • Chimeric alignment 嵌合比对
  • Read alignment
  • Multiple mapping
  • 1-based coordinate system
  • 0-based coordinate system
  • Phred scale

header lines match /^@[A-Z][A-Z](\t[A-Za-z][A-Za-z0-9]:[ -~]+)+$/ or /^@CO\t.*/

The alignment section/比对结果部分

mandatory fields/必需字段

Col Field Description
1 QNAME 比对片段的(template)的编号
2 FLAG 位标识,templatemapping情况的数字表示,每一个数字代表一种比对情况,这里的值是符合情况的数字相加总和
3 RNAME 参考序列的编号,如果注释中对SQ-SN进行了定义,这里必须和其保持一致,另外对于没有mapping上的序列,这里是‘*’
4 POS 比对上的位置,注意是从1开始计数,没有比对上,此处为0
5 MAPQ MAPpingQualitymapping的质量
6 CIAGR 简要比对信息表达式(CompactIdiosyncraticGappedAlignmentReport),其以参考序列为基础,使用数字加字母表示比对结果,比如3S6M1P1I4M,前三个碱基被剪切去除了,然后6个比对上了,然后打开了一个缺口,有一个碱基插入,最后是4个比对上了,是按照顺序的
7 RNEXT 下一个片段比对上的参考序列的编号,没有另外的片段,这里是‘*’,同一个片段,用‘=’
8 PNEXT 下一个片段比对上的位置,如果不可用,此处为0
9 TLEN TemplateLengthTemplate的长度,最左边得为正,最右边的为负,中间的不用定义正负,不分区段(single-segment)的比对上,或者不可用时,此处为0
10 SEQ 序列片段的序列信息,如果不存储此类信息,此处为’*‘,注意CIGAR中M/I/S/=/X对应数字的和要等于序列长度
11 QUAL queryQUALity序列的质量信息,格式同FASTQ一样
12 OPT 可选字段(optionalfields),格式如:TAG:TYPE:VALUE,其中TAG有两个大写字母组成,每个TAG代表一类信息,每一行一个TAG只能出现一次,TYPE表示TAG对应值的类型,可以是字符串、整数、字节、数组等
  1. QNAME (Query template NAME) string [!-?A-~]{1,254}
  2. FLAG int [0,216-1]
  3. RNAME (Reference sequence NAME of the alignment) string *|[!-()+-<>-~][!-~]*
  4. POS (1-based leftmost mapping POSition of the first matching base. ) int [0,231-1]
  5. MAPQ (MAPping Quality) int [0,28-1]
  6. CIGAR(CIGAR string) string *|([0-9]+[MIDNSHPX=])+
  7. RNEXT( Reference sequence name of the primary alignment of the NEXT read in the template) string *|=|[!-()+-<>-~][!-~]*
  8. PNEXT(Position of the primary alignment of the NEXT read in the template) int [0,231-1]
  9. TLEN(signed observed Template LENgth.) int [-231+1,231-1]
  10. SEQ(segment SEQuence) string *|[A-Za-z=.]+
  11. QUAL(ASCII of base QUALity plus 33 (same as the quality string in the Sanger FASTQ format)) string [!-~]+

optional fields/可选字段

All optional fields follow the TAG:TYPE:VALUE format where TAG is a two-character string that matches /[A-Za-z][A-Za-z0-9]/. Each TAG can only appear once in one alignment line. A TAG containing lowercase letters are reserved for end users. In an optional field, TYPE is a single case-sensitive letter which defines the format of VALUE:

参考: