# HG changeset patch # User peterjc # Date 1366210438 14400 # Node ID 8a0771c5e23618beeb000db7b202942da6cb41f2 # Parent 662fea0fe6b23cd9f9c9bb2508f9e6f8426d490b Uploaded v0.0.5, reports number of queries with hits in stdout (peek text). diff -r 662fea0fe6b2 -r 8a0771c5e236 tools/ncbi_blast_plus/blastxml_to_top_descr.py --- a/tools/ncbi_blast_plus/blastxml_to_top_descr.py Wed Feb 20 13:36:37 2013 -0500 +++ b/tools/ncbi_blast_plus/blastxml_to_top_descr.py Wed Apr 17 10:53:58 2013 -0400 @@ -7,6 +7,10 @@ import sys import re +if "-v" in sys.argv or "--version" in sys.argv: + print "v0.0.5" + sys.exit(0) + if sys.version_info[:2] >= ( 2, 5 ): import xml.etree.cElementTree as ElementTree else: @@ -58,6 +62,7 @@ count = 0 +pos_count = 0 outfile = open(out_file, 'w') outfile.write("#Query\t%s\n" % "\t".join("BLAST hit %i" % (i+1) for i in range(topN))) for event, elem in context: @@ -103,6 +108,8 @@ assert hit_def not in hit_descrs hit_descrs.append(hit_def) #print "%r has %i hits" % (qseqid, len(hit_descrs)) + if hit_descrs: + pos_count += 1 hit_descrs = hit_descrs[:topN] while len(hit_descrs) < topN: hit_descrs.append("") @@ -112,4 +119,4 @@ root.clear() elem.clear() outfile.close() -print "%i BLAST results" % count +print "Of %i queries, %i had BLAST results" % (count, pos_count) diff -r 662fea0fe6b2 -r 8a0771c5e236 tools/ncbi_blast_plus/blastxml_to_top_descr.txt --- a/tools/ncbi_blast_plus/blastxml_to_top_descr.txt Wed Feb 20 13:36:37 2013 -0500 +++ b/tools/ncbi_blast_plus/blastxml_to_top_descr.txt Wed Apr 17 10:53:58 2013 -0400 @@ -52,6 +52,7 @@ on the 'blast_datatypes' repository in the Tool Shed. v0.0.3 - Include the test files required to run the unit tests v0.0.4 - Quote filenames in case they contain spaces (internal change) +v0.0.5 - Include number of queries with BLAST matches in stdout (peek text) Developers @@ -60,7 +61,7 @@ This script and related tools are being developed on the following hg branch: http://bitbucket.org/peterjc/galaxy-central/src/tools -For making the "Galaxy Tool Shed" http://community.g2.bx.psu.edu/ tarball use +For making the "Galaxy Tool Shed" http://toolshed.g2.bx.psu.edu/ tarball use the following command from the Galaxy root folder: $ tar -czf blastxml_to_top_descr.tar.gz tools/ncbi_blast_plus/blastxml_to_top_descr.* tools/ncbi_blast_plus/repository_dependencies.xml test-data/blastp_four_human_vs_rhodopsin.xml test-data/blastp_four_human_vs_rhodopsin_top3.tabular diff -r 662fea0fe6b2 -r 8a0771c5e236 tools/ncbi_blast_plus/blastxml_to_top_descr.xml --- a/tools/ncbi_blast_plus/blastxml_to_top_descr.xml Wed Feb 20 13:36:37 2013 -0500 +++ b/tools/ncbi_blast_plus/blastxml_to_top_descr.xml Wed Apr 17 10:53:58 2013 -0400 @@ -1,5 +1,6 @@ - + Make a table from BLAST XML + blastxml_to_top_descr.py --version blastxml_to_top_descr.py "${blastxml_file}" "${tabular_file}" ${topN}