SAM是Sequence Alignment/Map 的缩写。像bwa等软件序列比对结果都会输出这样的文件。samtools网站上有专门的文档介绍SAM文件。具体地址:http://samtools.sourceforge.net/SAM1.pdf

很多人困惑SAM文件中的第二列FLAG值是什么意思。根据文档介绍我们可以计算,但是为了方便大家,下面给大家提供一个脚本工具,大家直接输入flag值就可以知道它代表的含义了。

该脚本的使用方法如下截图所示:

脚本工具的使用方法:

将下面的代码保存在记事本里面,另存为一个html文件,如文件名:FlagExplain.html(拓展名一定要为.html)。双击既可以在浏览器里面打开了。

01 <html><head><meta http-equiv="Content-Type" content="text/html; charset=GBK">
02    <title>Explain SAM Flags</title>
03    <script type="text/javascript">
04       lstFlags = [["read paired", 0x1],
05              ["read mapped in proper pair", 0x2],
06              ["read unmapped", 0x4],
07              ["mate unmapped", 0x8],
08              ["read reverse strand", 0x10],
09              ["mate reverse strand", 0x20],
10              ["first in pair", 0x40],
11              ["second in pair", 0x80],
12              ["not primary alignment", 0x100],
13              ["read fails platform/vendor quality checks", 0x200],
14              ["read is PCR or optical duplicate", 0x400]];
15  
16       function explainFlags() {
17          var flagValue = parseInt(document.getElementById('tb').value); //returns 0 or NaN if can't parse
18          var summary = "";
19          for(var i = 0; i < lstFlags.length; i++) {
20             var checkbox document.getElementById('cb' + i)
21             if(lstFlags[i][1] & flagValue) {
22                summary  += " &nbsp; &nbsp; " + lstFlags[i][0] + "<br>";
23                checkbox.checked = true;
24             } else {
25                checkbox.checked = false;
26             }
27          }
28  
29          document.getElementById('summary').innerHTML = summary;
30       }
31  
32       function checkboxClicked() {
33          //compute the new flag value
34          var newFlagValue = 0;
35          for(var i = 0; i < lstFlags.length; i++) {
36             var checkBox document.getElementById('cb' + i);
37             if(checkBox.checked) {
38                newFlagValue |= lstFlags[i][1];
39             }
40          }
41          var textbox document.getElementById('tb');
42          textbox.value newFlagValue;
43          explainFlags();
44       }
45    </script>
46  
47    <noscript>This page requires JavaScript. Please enable it in your browser settings.</noscript>
48 </head>
49 <body>
50  
51 This utility explains SAM flags in plain English. <br>
52 <br>
53  
54 <form onsubmit="explainFlags(); return false;">
55 Flag: &nbsp;
56 <input id="tb" type="text" size="10"> &nbsp; &nbsp; &nbsp;
57 <input type="submit" value="Explain"><br>
58 <br>
59 Explanation:<br>
60 <script type="text/javascript">
61 for(var i = 0; i < lstFlags.length; i++) {
62    document.write("<input type=checkbox name=cb" + i + " id='cb" + i + "' onclick='checkboxClicked();'> &nbsp; " +lstFlags[i][0] + "</input><br>");
63 }
64 </script><input type="checkbox" name="cb0" id="cb0" onclick="checkboxClicked();"> &nbsp; read paired<br><input type="checkbox" name="cb1" id="cb1"onclick="checkboxClicked();"> &nbsp; read mapped in proper pair<br><inputtype="checkbox" name="cb2" id="cb2" onclick="checkboxClicked();"> &nbsp; read unmapped<br><input type="checkbox" name="cb3" id="cb3" onclick="checkboxClicked();"> &nbsp; mate unmapped<br><input type="checkbox" name="cb4" id="cb4" onclick="checkboxClicked();"> &nbsp; read reverse strand<br><input type="checkbox" name="cb5" id="cb5" onclick="checkboxClicked();"> &nbsp; mate reverse strand<br><input type="checkbox" name="cb6" id="cb6" onclick="checkboxClicked();"> &nbsp; first in pair<br><input type="checkbox" name="cb7" id="cb7" onclick="checkboxClicked();"> &nbsp; second in pair<br><input type="checkbox" name="cb8" id="cb8"onclick="checkboxClicked();"> &nbsp; not primary alignment<br><input type="checkbox" name="cb9" id="cb9" onclick="checkboxClicked();"> &nbsp; read fails platform/vendor quality checks<br><input type="checkbox" name="cb10" id="cb10" onclick="checkboxClicked();"> &nbsp; read is PCR or optical duplicate<br>
65 <br>
66 Summary:<br>
67 <div id="summary">
68 </div></form></body></html>

参考:https://www.plob.org/article/1697.html

推荐一个SAM文件或者bam文件中flag含义解释工具的更多相关文章

  1. 推荐一个SAM文件中flag含义解释工具--转载

    SAM是Sequence Alignment/Map 的缩写.像bwa等软件序列比对结果都会输出这样的文件.samtools网站上有专门的文档介绍SAM文件.具体地址:http://samtools. ...

  2. 31、SAM文件中flag含义解释工具--转载

    转载:http://www.cnblogs.com/nkwy2012/p/6362996.html  SAM是Sequence Alignment/Map 的缩写.像bwa等软件序列比对结果都会输出这 ...

  3. 推荐一个可以直接在Visual Studio中看到complexity的插件CodeMaid

    博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:推荐一个可以直接在Visual Studio中看到complexity的插件CodeMaid.

  4. 推荐一个免费的生成词云(word cloud)的在线工具

    "词云"这个概念由美国西北大学新闻学副教授.新媒体专业主任里奇·戈登(Rich Gordon)提出. "词云"就是对网络文本中出现频率较高的"关键词& ...

  5. bat脚本中%~dp0含义解释

    在Windows脚本中,%i类似于shell脚本中的$i,%0表示脚本本身,%1表示脚本的第一个参数,以此类推到%9,在%和i之间可以有"修饰符"(完整列表可通过"for ...

  6. SAMTOOLS使用 SAM BAM文件处理

    [怪毛匠子 整理] samtools学习及使用范例,以及官方文档详解 #第一步:把sam文件转换成bam文件,我们得到map.bam文件 system"samtools view -bS m ...

  7. bam文件测序深度统计-bamdst

    最近接触的数据都是靶向测序,或者全外测序的数据.对数据的覆盖深度及靶向捕获效率的评估成为了数据质量监控中必不可少的一环. 以前都是用samtools depth 算出单碱基的深度后,用perl来进行深 ...

  8. SAM/BAM文件处理

    当测序得到的fastq文件map到基因组之后,我们通常会得到一个sam或者bam为扩展名的文件.SAM的全称是sequence alignment/map format.而BAM就是SAM的二进制文件 ...

  9. 文件格式——Sam&bam文件

    Sam&bam文件 SAM是一种序列比对格式标准, 由sanger制定,是以TAB为分割符的文本格式.主要应用于测序序列mapping到基因组上的结果表示,当然也可以表示任意的多重比对结果.当 ...

随机推荐

  1. SQL SERVER数据库附加是只读的解决方法

    使用sa登录SQL Server2008附加数据库,附加之后数据库为只读的, 点数据库-->“属性”-->“选项”-->“状态”, 发现“数据库为只读”这一项为True,改为fals ...

  2. webpack(3)-管理资源

    管理资源:(file-loader 和 url-loader 可以接收并加载任何文件,然后将其输出到构建目录) 加载css:style-loader.css-loader 以style的形式插入到he ...

  3. windows下gitbash中使用zip命令

    参考: https://ranxing.wordpress.com/2016/12/13/add-zip-into-git-bash-on-windows/

  4. Ubuntu设置su和sudo为不需要密码 (摘录自别处)

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/langb2014/article/details/54646675 针对非服务器用户,只是用普通的U ...

  5. 配置成功java11后安装eclipse失败

    前提是 1.java是成功配置的, 2.看清楚32bit,还是64bit,需要一致 THEN 方法一:去安装java11之前的版本,正确配置环境 方法二:java11中没有jre(不打紧).所以需要直 ...

  6. 67.web--手机端兼容性问题

    H5页面窗口自动调整到设备宽度,并禁止用户缩放页面 <meta name="viewport" content="width=device-width,initia ...

  7. redis----------linux和mac如何安装redis和启动,关闭

    1.打开官网https://redis.io/download.官网有安装命令 2.以下是我的执行过程截图 执行完官网给的命令以后,再执行  make PREFIX=/usr/local/redis ...

  8. C#中类成员的执行顺序

    先进行细分: 类的成员分为:字段.属性.方法.构造方法 成员的修饰符:静态成员.实例成员 层次结构:父类.子类 先不考虑继承关系,执行顺序为: 静态字段静态构造方法实例字段实例构造方法属性和方法是在调 ...

  9. linux 命令 jps 和 goassess

    jps (Java Virtual Machine Process Status Tool)  是java提供的一个显示当前所有java进程pid的命令,适合在linux/unix平台上简单察看当前j ...

  10. Windows下安装Redis服务

    说明:本文拷贝自https://jingyan.baidu.com/article/0f5fb099045b056d8334ea97.html Redis是有名的NoSql数据库,一般Linux都会默 ...