Difference between Hard Clip(H) and Soft Clip(S) in Samtools CIGAR string
一般人都知道 H 和 S 的表面上的区别,即 S 就是 soft, H 就是 hard,S 后,序列里还是会保留序列的信息,而 H 则不会。
-------------------------------------------后面都不用看了,H和S没有区别,比对软件不能发现嵌合体--------------------------------------
但这只是表面上的,在深层次的意义上, H 和 S 又有什么本质的不同呢?
首先要了解嵌合体的概念:
嵌合体就是两个不同的序列错误的拼接到了一起,也就是一条序列分别比对到了 ref 的两个地方(这和多重比对、次级比对之间又有区别)

Example of extended CIGAR and the pileup output.
(a) Alignments of one pair of reads and three single-end reads.
(b) The corresponding SAM file. The ‘@SQ’ line in the header section gives the order of reference sequences. Notably, r001 is the name of a read pair. According to FLAG 163 (=1 + 2 + 32 + 128), the read mapped to position 7 is the second read in the pair (128) and regarded as properly paired (1 + 2); its mate is mapped to 37 on the reverse strand (32). Read r002 has three soft-clipped (unaligned) bases. The coordinate shown in SAM is the position of the first aligned base. The CIGAR string for this alignment contains a P (padding) operation which correctly aligns the inserted sequences. Padding operations can be absent when an aligner does not support multiple sequence alignment. The last six bases of read r003 map to position 9, and the first five to position 29 on the reverse strand. The hard clipping operation H indicates that the clipped sequence is not present in the sequence field. The NM tag gives the number of mismatches. Read r004 is aligned across an intron, indicated by the N operation.
(c) Simplified pileup output by SAMtools. Each line consists of reference name, sorted coordinate, reference base, the number of reads covering the position and read bases. In the fifth field, a dot or a comma denotes a base identical to the reference; a dot or a capital letter denotes a base from a read mapped on the forward strand, while a comma or a lowercase letter on the reverse strand.
clipped alignment因为着在比对过程中,并没有用到全部的read的序列,read两段的序列被截取了(clip or trim)。如下表示,即为clip alignment。
Alignment:
Read: ACGGTTGCGTTAA-TCCGCCACG
| ||||||||| ||||||
Reference: TAACTTGCGTTAAATCCGCCTGG
与clipped alignment对应的是spliced alignment,即read的中间没有比对到而两段比对上了。对应的表示如下:
Alignment:
Read: ACGGTTGCGTTAAGCTCATCCGCCACG
| ||||||||||||| |||||||||
Reference: ACGGTTGCGTTAA…..TCCGCCACG
clip alignment对应的CIGAR表示有两种S (soft clip) 和H (hard clip)。
BWA提到If the read has a chimeric alignment, the paired or the top hit uses soft clipping and is marked with neither 0x800 nor 0x100 bits. All the other hits part of the chimeric alignment will use hard clipping and be marked with 0x800 if option “-M” is not in use, or marked with 0x100 otherwise.
即如果发现嵌合比对,最好的比对top hit标记为soft clipping,其余的则标记为hard clipping。
如果是hard clip,则截取的部分不会在SAM文件对应的read中出现 (clipped sequences not present in SEQ),如果是soft clip (clipped sequences present in SEQ),则会出现。
Understand?
Ref:https://github.com/lh3/bwa/blob/master/NEWS.md
理解1:
Hard masked bases do not appear in the SEQ string, soft masked bases do.
So, if your cigar is: `10H10M10H` then the SEQ will only be 10 bases long.
if your cigar is 10S10M10S then the SEQ and base-quals will be 30 bases long.
首先,结果展示方式有区别:比如说10H10M10H,第10列的碱基序列只显示10bp;而如果是10S10M10S的话,就会显示30bp的序列,尽管开头和结尾的20bp也没比上。
In the case of soft-masking, even though the SEQ is present, it is not used by variant callers and not displayed when you view your data in a viewer. In either case, masked bases should not be used in calculating coverage.
在soft中,即使显示的序列比hard的要长,但是计算变异或可视化比对结果时,这些序列也不会被考虑。而且,2种情况计算覆盖度时,mask的碱基都不会考虑。
例子:
20692128 97 viral_genome 21417 60 69M32S chr7 101141242 0 TACATCTTCTCCCTCTCTCACGACACAAGAATTAGTCACATAGGGATGTTCTCGTAAATCTACATTATCTTACAAAAACATTTTTTAAAAATTTGCTAGGT (101bp) GGGGGGGGGGGGGGEGGEGGGGGGGGGFGGGGGGGGGGGGGEGFFGGGGGGGFGGFGGGGEGGGGGGGGGGGEGEFFGGGFEGGGGGFGCGGGFBGGGBG@ NM:i:4 MD:Z:6G34G6C5C14 AS:i:49 XS:i:0 SA:Z:chr7,101141091,+,66S35M,60,0;
20692128 353 chr7 101141091 60 66H35M = 101141242 252 ATCTTACAAAAACATTTTTTAAAAATTTGCTAGGT (35bp)GGGGGGEGEFFGGGFEGGGGGFGCGGGFBGGGBG@ NM:i:0 MD:Z:35 AS:i:35 XS:i:23 SA:Z:gi|224020395|ref|NC_001664.2|,21417,+,69M32S,60,4;
20692128 145 chr7 101141242 60 101M gi|224020395|ref|NC_001664.2| 21417 0 GCAACAGAGCGAGACCCTATATTCATGAGTGTTGCAATGAGCCAAGTAGTGGAGGTTGGCTTTTGAAGGCAGAAAAGGACTGAGAAAAGCTAACACAGAGA FEGCGGGGGCGEFCDEEEEGGGGGGGGGGGGGGGEGGGGGGFGGGEGGG
理解2:
当同一条reads比对到不同chr时(嵌合reads),会以hard clip的显示显示。比如上面的例子,R1分别比到了viral基因组和chr7上(前面69bp比到viral,后面35比到chr7),R2比到了chr7。
sam格式详细说明见:http://davetang.org/wiki/tiki-index.php?page=SAM
Difference between Hard Clip(H) and Soft Clip(S) in Samtools CIGAR string的更多相关文章
- (转)开源项目miaosha(下)
石墨文档:https://shimo.im/docs/2XlwliBQAYsKCHbq/ (二期)20.开源秒杀项目miaosha解读(下) [课程20]jmeter.xmind81.5KB [课程2 ...
- H.264学习笔记之一(层次结构,NAL,SPS)
一 H.264句法 1.1元素分层结构 H.264编码器输出的Bit流中,每个Bit都隶属于某个句法元素.句法元素被组织成有层次的结构,分别描述各个层次的信息. 图1 H.264分层结构由五层组成,分 ...
- C语言中.h和.c文件解析(很精彩)
C语言中.h和.c文件解析(很精彩) 简单的说其实要理解C文件与头文件(即.h)有什么不同之处,首先需要弄明白编译器的工作过程,一般说来编译器会做以下几个过程: 1.预处理阶段 2.词法与语法分析 ...
- C++中头文件(.h)和源文件(.cpp)都应该写些什么
头文件(.h): 写类的声明(包括类里面的成员和方法的声明).函数原型.#define常数等,但一般来说不写出具体的实现. 在写头文件时需要注意,在开头和结尾处必须按照如下样式加上预编译语句(如下): ...
- 最简单的基于librtmp的示例:发布H.264(H.264通过RTMP发布)
===================================================== 最简单的基于libRTMP的示例系列文章列表: 最简单的基于librtmp的示例:接收(RT ...
- HEVC(H.265)标准的编码器(x265,DivX265)试用
基于HEVC(H.265)的的应用级别的编码器发展的速度很快.所说的应用级别,就是指速度比较快的,有实际应用价值的编码器.目前可以直接使用的有两个:x265,DivX265. DivX265 DivX ...
- 在源文件(.c)和头文件(.h)中声明和定义的区别——C语言
最近在看多文件编程的时候遇到的一个问题,本来以为理解了声明和定义的区别(然而并没有····),也算是重新认识了一次声明和定义,下面上代码 情形一:在源文件(.c)中 相信大部分读者对声明和定义的理解是 ...
- 黄聪:FFmpeg视频转码技巧之-crf参数(H.264篇)
昨天,有个朋友给我出了个难题:他手上有一个视频,1080P的,49秒,200多兆:要求在确保质量的情况下把文件压缩到10M以内. 这是什么概念呢?按照文件大小10M来计算,码率是:10 x 8 / 4 ...
- C++ 中头文件(.h)和源文件(.cc)的写法简述
用C++编写比较大型的项目时,文件的分割管理确实确实是非常必要的 .下面就非常简洁明了地谈谈头文件(.h)和源文件(.cc)应该怎么写. 头文件(.h):写类的声明(包括类里面的成员和方法的声明).函 ...
随机推荐
- WPF中父子窗口的层次关系
关于子窗体的层级关系总结一下哈,希望能对大家有些帮助 假设有这样两个窗体:RootWindow,SubWindow,在RootWindow中引发某事件而显示SubWindow 1,如果弹出窗体(比如S ...
- MVC4 经典增删改查详情demo
MVC4 经典增删改查详情demo 源码 不解释 Mvc4增删改查详情Demo.7z public ActionResult Detail(int? id) { ViewData.Model ...
- DataSet 关系
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- C语言中的++和--
这个问题是老生常谈的问题了,虽然诸多大牛都深恶痛绝的告诉所有人不要那样写,但这永远挡不住学校的老师和考试. 今天我们来辨析一下这个东西. 首先我们来名词辨析一下吧: ++i 这个叫 前自增 i++ ...
- ruby学习总结02
1.条件判断(nil或alse为假,其他值均为真) 1.if语句 if/elsif/else/end 条件成立时执行相关操作 2.unless语句 unless/else/end 条件 ...
- MATLAB模拟布丰投针实验
MATLAB模拟布丰投针实验 标签(空格分隔): 算法 Buffon's Needle 桌面上有距离为a的若干平行线,将长度为L的针随机丢在桌面上,则这根针与平行线相交的概率是多少?假定L < ...
- jquery获取当前时间
一.获取当前时间 new Date()方法---------得到结果是当前电脑时间如2011-11-6,10:07 二.获取有个固定的时间方法---------var endtime=new Date ...
- implement Cartographer ROS for TurtleBots
github source: https://github.com/googlecartographer/cartographer_turtlebot 1. Building & Instal ...
- read 读取文件内容
文件名 test28.sh #!/bin bash # reading data from a file count= cat test | while read line do echo " ...
- 初始Hibernate框架技术
hibernate: 定义:ORM:Object Relational Mapping 对象 关系 映射 使用hibernate时几个必要的: 1.实体类 2.映射文件(类 -数据库表,属性-字段) ...