{"id":465,"date":"2019-11-04T17:13:28","date_gmt":"2019-11-04T09:13:28","guid":{"rendered":"http:\/\/www.wuchangsong.com\/?p=465"},"modified":"2019-11-04T17:17:57","modified_gmt":"2019-11-04T09:17:57","slug":"ardb%e5%92%8cvfdb%e6%95%b0%e6%8d%ae%e5%ba%93%e6%af%94%e5%af%b9%e5%90%8e%e7%ad%9b%e9%80%89","status":"publish","type":"post","link":"http:\/\/www.wuchangsong.com\/?p=465","title":{"rendered":"ARDB\u548cVFDB\u6570\u636e\u5e93\u6bd4\u5bf9\u540e\u7b5b\u9009"},"content":{"rendered":"<p>python .py -i db.fasta -I blastresult.tab -o selected.txt -O filtered.txt<br \/>\nblastresult.tab\u662f\u6839\u636eP\u503csort\u540e\u7684\u6587\u4ef6<\/p>\n<pre>\r\nfrom __future__ import division\r\nimport re\r\nimport sys, getopt\r\nimport operator\r\nfrom Bio import SeqIO\r\nfrom Bio.Seq import Seq\r\nfrom Bio.SeqRecord import SeqRecord\r\nfrom Bio.Alphabet import generic_nucleotide\r\n\r\nopts, args = getopt.getopt(sys.argv[1:], \"hI:i:o:O:\")\r\ninput_info1= \"\"\r\ninput_info2= \"\"\r\nout_file1 = \"\"\r\nout_file2 = \"\"\r\n\r\nfor op, value in opts:\r\n    if op ==\"-o\": #ARG_pattern_MIN_7030.fasta or ARG_pattern_MAX_7030.fasta\r\n        out_file1 = open(value, \"w\")\r\n        filename_pro = str (value)\r\n        name_item = filename_pro.strip().split(\".\")\r\n        filename = name_item[0]\r\n    elif op == \"-i\": # All_ARGcontig_remove_S_nr.fasta\r\n        input_info1 = open(value, \"r\")\r\n    elif op == \"-I\":\r\n        input_info2 = open(value, \"r\")\r\n    elif op == \"-O\":\r\n        out_file2 = open(value, \"w\")\r\n        filename_pro = str (value)\r\n        name_item = filename_pro.strip().split(\".\")\r\n        filename = name_item[0]      \r\n\r\ndict1 = {} \r\ndict2 = {}\r\nfor record in SeqIO.parse(input_info1,\"fasta\"):\r\n    h = len(record.seq)\r\n   \r\n    dict1[record.id]=h\r\n    dict2[record.id]=record.description\r\n    \r\n        \r\nfor line1 in input_info2:\r\n    info1 = line1.strip(\"\\n\").split(\"\\t\")\r\n    a = float(info1[2])\r\n    b = float(info1[3])\r\n    c = b\/float(dict1[info1[1]])\r\n    if a >= 80.0 and c >= 0.8:\r\n        out_file1.write(str(dict1[info1[1]])+'\\t'+str(b)+'\\t'+dict2[info1[1]]+'\\t'+line1)\r\n    else:\r\n        out_file2.write(str(dict1[info1[1]])+'\\t'+str(b)+'\\t'+dict2[info1[1]]+'\\t'+line1)\r\ninput_info1.close()\r\ninput_info2.close()\r\nout_file1.close()\r\nout_file2.close()\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>python .py -i db.fasta -I blastresult.tab -o selected.txt -O filtered.txt blastresult.tab\u662f\u6839\u636eP\u503csort\u540e\u7684\u6587\u4ef6 from __future__ import division import re import sys, getopt import operator from Bio import SeqIO from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord from Bio.Alphabet import generic_nucleotide opts, args = getopt.getopt(sys.argv[1:], &#8220;hI:i:o:O:&#8221;) input_info1= &#8220;&#8221; input_info2= &#8220;&#8221; out_file1 = &#8220;&#8221; out_file2 = &#8220;&#8221; for op, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,2],"tags":[],"_links":{"self":[{"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=\/wp\/v2\/posts\/465"}],"collection":[{"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=465"}],"version-history":[{"count":3,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=\/wp\/v2\/posts\/465\/revisions"}],"predecessor-version":[{"id":468,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=\/wp\/v2\/posts\/465\/revisions\/468"}],"wp:attachment":[{"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=465"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wuchangsong.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}