转载:http://www.cnblogs.com/nkwy2012/p/6362996.html

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

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

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

脚本工具的使用方法:

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

<html><head><meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>Explain SAM Flags</title>
<script type="text/javascript">
lstFlags = [["read paired", 0x1],
["read mapped in proper pair", 0x2],
["read unmapped", 0x4],
["mate unmapped", 0x8],
["read reverse strand", 0x10],
["mate reverse strand", 0x20],
["first in pair", 0x40],
["second in pair", 0x80],
["not primary alignment", 0x100],
["read fails platform/vendor quality checks", 0x200],
["read is PCR or optical duplicate", 0x400]];

function explainFlags() {
var flagValue = parseInt(document.getElementById('tb').value); //returns 0 or NaN if can't parse
var summary = "";
for(var i = 0; i < lstFlags.length; i++) {
var checkbox = document.getElementById('cb' + i)
if(lstFlags[i][1] & flagValue) {
summary += " &nbsp; &nbsp; " + lstFlags[i][0] + "<br>";
checkbox.checked = true;
} else {
checkbox.checked = false;
}
}

document.getElementById('summary').innerHTML = summary;
}

function checkboxClicked() {
//compute the new flag value
var newFlagValue = 0;
for(var i = 0; i < lstFlags.length; i++) {
var checkBox = document.getElementById('cb' + i);
if(checkBox.checked) {
newFlagValue |= lstFlags[i][1];
}
}
var textbox = document.getElementById('tb');
textbox.value = newFlagValue;
explainFlags();
}
</script>

<noscript>This page requires JavaScript. Please enable it in your browser settings.</noscript>
</head>
<body>

This utility explains SAM flags in plain English. <br>
<br>

<form onsubmit="explainFlags(); return false;">
Flag: &nbsp;
<input id="tb" type="text" size="10"> &nbsp; &nbsp; &nbsp;
<input type="submit" value="Explain"><br>
<br>
Explanation:<br>
<script type="text/javascript">
for(var i = 0; i < lstFlags.length; i++) {
document.write("<input type=checkbox name=cb" + i + " id='cb" + i + "'onclick='checkboxClicked();'> &nbsp; " +lstFlags[i][0] + "</input><br>");
}
</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>
<br>
Summary:<br>
<div id="summary">
</div></form></body></html>

 

31、SAM文件中flag含义解释工具--转载的更多相关文章

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

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

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

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

  3. Python工程文件中的名词解释---Module与Package的区别

    当我们在已有的Python工程文件中创建新的内容是,通常会有两种类型文件供你选择---Module和Package,对于初学者来说会搞不清楚这两种文件直接的关系.这里就来解释一下这两者之间的关系. M ...

  4. BD面试题1-两个大文件中找出公共记录[转载]

    转自:https://blog.csdn.net/tiankong_/article/details/77234726#commentBox 1.题目 给定a.b两个文件,各存放50亿个url,每个u ...

  5. Andoid java文件中的Log检查工具

    AndroidLogChecker 由于发布软件版本的时候我们需要把Log注释掉,此工具可以检查java类中的Log所在行以及是否已经注释. Github: https://github.com/cu ...

  6. linux中shell变量$#,$@,$0,$1,$2的含义解释 (转载)

    变量说明: $$Shell本身的PID(ProcessID)$!Shell最后运行的后台Process的PID$?最后运行的命令的结束代码(返回值)$-使用Set命令设定的Flag一览$*所有参数列表 ...

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

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

  8. 块结构在文件中的表示IOB【转载】

    转自:http://www.coderjie.com/blog/43b3601e0a2411e7841d00163e0c0e36 1.块在内存中以树的形式存储,分好块的文本在文件中用IOB标记存储: ...

  9. 在Android.mk文件中输出打印消息 (转载)

    转自:http://blog.csdn.net/xiaibiancheng/article/details/8479694 在进行Android NDK的开发当中有时想看看Android.mk文件当中 ...

随机推荐

  1. nginx配置大全

    nginx配置大全

  2. [java]Arrays.copyOf() VS System.arrayCopy()

    If we want to copy an array, we can use either System.arraycopy() or Arrays.copyOf(). In this post, ...

  3. 2014暑假ACM13级一批集训内容

    2014 这个暑假,我大一的暑假来吧!!! 2014暑假ACM13级一批集训内容 集训期间时间安排: 周一到周六 上午:8:00-11:30 下午:2:00-5:30 晚上7:00-9:30 周日自由 ...

  4. Shiro-自定义realm

    Shiro自定义 realm package com.zhen.realm; import org.apache.shiro.authc.AuthenticationException; import ...

  5. unity3D编辑器扩展

    编辑器扩展只是在编辑项目中运行,发布出来是不会运行的. 固定创建一个文件夹Editor:所有的资源或者代码都不会被打包进去. 01.使用MenuItem添加菜单栏按钮 脚本不需要作为组件存在,可以不用 ...

  6. POJ1363 Rails 验证出栈序列问题

    题目地址: http://poj.org/problem?id=1363 此题只需验证是否为合法的出栈序列. 有两个思路: 1.每个已出栈之后的数且小于此数的数都必须按降序排列.复杂度O(n^2),适 ...

  7. Linux tar.gz 、zip、rar 解压 压缩命令

    tar -c: 建立压缩档案 -x:解压 -t:查看内容 -r:向压缩归档文件末尾追加文件 -u:更新原压缩包中的文件 这五个是独立的命令,压缩解压都要用到其中一个,可以和别的命令连用但只能用其中一个 ...

  8. js string.format 方法

    String.prototype.format = function(args) { var result = this; if (arguments.length > 0) { if (arg ...

  9. vs参数配置

    配置属性-常规: 输出目录:工程的输出目录,主要包括.exe..dll..lib文件,是工程最后想要的文件.vs2015位于解决方案的\x64\Debug下,vs2010,vs2005位于解决方案的D ...

  10. gcc 4.8.5安装

    在利用张乐博士的最大熵模型工具包(Maximum Entropy Modeling Toolkit for Python and C++)和条件随机场的经典工具包CRF++(CRF++: Yet An ...