生活随笔
收集整理的這篇文章主要介紹了
推荐一个SAM文件中flag含义解释工具--转载
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
SAM是Sequence Alignment/Map 的縮寫。像bwa等軟件序列比對結(jié)果都會輸出這樣的文件。samtools網(wǎng)站上有專門的文檔介紹SAM文件。具體地址:http://samtools.sourceforge.net/SAM1.pdf
很多人困惑SAM文件中的第二列FLAG值是什么意思。根據(jù)文檔介紹我們可以計算,但是為了方便大家,下面給大家提供一個腳本工具,大家直接輸入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]]; |
| 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? += " " + lstFlags[i][0] + "<br>"; |
| 23 | ???????????????checkbox.checked = true; |
| 25 | ???????????????checkbox.checked = false; |
| 29 | ?????????document.getElementById('summary').innerHTML = summary; |
| 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]; |
| 41 | ?????????var?textbox?=?document.getElementById('tb'); |
| 42 | ?????????textbox.value?=?newFlagValue; |
| 43 | ?????????explainFlags(); |
| 47 | ???<noscript>This page requires JavaScript. Please enable it in your browser settings.</noscript> |
| 51 | This utility explains SAM flags in plain English. <br> |
| 54 | <form?onsubmit="explainFlags(); return false;"> |
| 56 | <input?id="tb"?type="text"?size="10"> |
| 57 | <input?type="submit"?value="Explain"><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();'> " +lstFlags[i][0] + "</input><br>"); |
| 64 | </script><input?type="checkbox"?name="cb0"?id="cb0"onclick="checkboxClicked();"> read paired<br><input?type="checkbox"name="cb1"?id="cb1"?onclick="checkboxClicked();"> read mapped in proper pair<br><input?type="checkbox"?name="cb2"?id="cb2"onclick="checkboxClicked();"> read unmapped<br><input?type="checkbox"name="cb3"?id="cb3"?onclick="checkboxClicked();"> mate unmapped<br><input?type="checkbox"?name="cb4"?id="cb4"?onclick="checkboxClicked();"> read reverse strand<br><input?type="checkbox"?name="cb5"?id="cb5"onclick="checkboxClicked();"> mate reverse strand<br><inputtype="checkbox"?name="cb6"?id="cb6"?onclick="checkboxClicked();"> first in pair<br><input?type="checkbox"?name="cb7"?id="cb7"onclick="checkboxClicked();"> second in pair<br><input?type="checkbox"name="cb8"?id="cb8"?onclick="checkboxClicked();"> not primary alignment<br><input?type="checkbox"?name="cb9"?id="cb9"onclick="checkboxClicked();"> read fails platform/vendor quality checks<br><input?type="checkbox"?name="cb10"?id="cb10"onclick="checkboxClicked();"> read is PCR or optical duplicate<br> |
| 68 | </div></form></body></html> |
總結(jié)
以上是生活随笔為你收集整理的推荐一个SAM文件中flag含义解释工具--转载的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。