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><input type="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><inputtype="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>

推荐一个SAM文件中flag含义解释工具--转载的更多相关文章

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

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

  2. 推荐一个SAM文件或者bam文件中flag含义解释工具

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

  3. 怎样将多个CSS文件导入一个CSS文件中

    问题: 在HTML中引入css的其中的两个方法:    导入式和链接式的目的都是将一个独立的css文件引入一个文件中,二者的区别不大,事实上,二者最大的区别在于链接式使用html的标记引入外部css文 ...

  4. 在VS中让一个JS文件智能提示另一个JS文件中的成员

    “在VS中如何让一个JS文件智能提示另一个JS文件中的成员” 有时候会有这种情况:当我的一个Web页面引用了两个JS文件(假如分别叫common.js和JScript1.js),如果JScript1. ...

  5. 多个.txt文件合并到一个.txt文件中

    如果想要将多个.txt文件合并到一个.txt文件中,可以先将所有.txt文件放到一个文件夹中,然后使用.bat文件完成任务. 例如,在一个文件夹下有1.txt, 2.txt, 3.txt三个文件,想把 ...

  6. java:利用java的输入/输出流将一个文件的每一行+行号复制到一个新文件中去

    import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.Fi ...

  7. 如何调用另一个python文件中的代码

    模块的搜索路径 模块的搜索路径都放在了sys.path列表中,如果缺省的sys.path中没有含有自己的模块或包的路径,可以动态的加入(sys.path.apend)即可.下面是sys.path在Wi ...

  8. shell如何传递变量到另一个脚本文件中

    http://www.jbxue.com/article/shell/20707.html本文介绍了shell脚本传递变量到另一个脚本文件中的方法,在脚本中调用另一脚本,即创建了一个子进程,感兴趣的朋 ...

  9. 把当前文件夹的xlsx或xls文件合并到一个excel文件中的不同sheet中

    把当前文件夹的xlsx或xls文件合并到一个excel文件中的不同sheet中步骤如下: 把需要合并的文件放到同一个文件夹 在该文件夹中新建一个excel文件 打开新建的excel问价,把鼠标放到sh ...

随机推荐

  1. 畅通工程续 (SPFA模板Floy模板)

    http://acm.hdu.edu.cn/showproblem.php?pid=1874 SPFA #include <iostream> #include <stdio.h&g ...

  2. JS 转整型

    1.丢弃小数部分,保留整数部分 js:parseInt(7/2) 2.向上取整,有小数就整数部分加1 js: Math.ceil(7/2) 3,四舍五入. js: Math.round(7/2) 4, ...

  3. c语言中strcpy与strlen函数对字符串最后的'\0'的处理

    对于strcpy来说,它会把字符串最后的‘\0’一起拷贝 对于strlen来说,它计算字符串长度的时候不会把最后的‘\0’计算进去

  4. Perl实战(一)

    在Perl中,我们可以通过uc,lc,\U,\L来修改变量的值.其中uc,\U可以将变量中的字母全部转换为大写. lc,\L可以将变量中的字母全部转换为小写. $big = "\U$var& ...

  5. html文件上传控件file自定义样式

    问题: HTML自带的file上传按钮因在各种浏览器里显示样式不一.不易自定义样式给我们带来很大的麻烦. 解决思路: 将input[type=file]控件隐藏,使用一个input[type=text ...

  6. BP神经网络的Java实现(转载)

    神经网络的计算过程 神经网络结构如下图所示,最左边的是输入层,最右边的是输出层,中间是多个隐含层,隐含层和输出层的每个神经节点,都是由上一层节点乘以其权重累加得到,标上“+1”的圆圈为截距项b,对输入 ...

  7. Python tricks(4) -- with statement

    简介 with是从2.5版本引入的一个语法. 这个语法本身是为了解决try..finally繁琐的释放各类资源(文件句柄, Lock等)的问题. 如果想在旧版本中使用这个功能, 直接引入future模 ...

  8. Python 基本数据类型(2)

    知识内容: 1.python对象模型 2.数字与bool 3.字符串 4.列表与元组 5.字典与集合 一.python对象模型 1.python对象模型 对象是python语言中最基本的概念,在pyt ...

  9. DOS操作系统的历史

    昨日(7月27日),微软公司的DOS操作系统迎来了30岁生日. DOS是历史上一个划时代的产品,标识着PC(个人电脑)的崛起和普及,对计算机行业影响深远. 只有了解DOS的历史,才能理解今天的计算机工 ...

  10. C++结构体字节对齐

    转自:http://www.cnblogs.com/JensenCat/p/4770171.html 这里是头文件结构的定义: 一个非字节对齐结构体_tagTest2 一个字节对齐_tagTest3 ...