Mercurial > repos > peterjc > blastxml_to_top_descr
changeset 6:8a0771c5e236 draft
Uploaded v0.0.5, reports number of queries with hits in stdout (peek text).
author | peterjc |
---|---|
date | Wed, 17 Apr 2013 10:53:58 -0400 |
parents | 662fea0fe6b2 |
children | a7add03a44fd |
files | tools/ncbi_blast_plus/blastxml_to_top_descr.py tools/ncbi_blast_plus/blastxml_to_top_descr.txt tools/ncbi_blast_plus/blastxml_to_top_descr.xml |
diffstat | 3 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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
--- 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 @@ -<tool id="blastxml_to_top_descr" name="BLAST top hit descriptions" version="0.0.4"> +<tool id="blastxml_to_top_descr" name="BLAST top hit descriptions" version="0.0.5"> <description>Make a table from BLAST XML</description> + <version_command interpreter="python">blastxml_to_top_descr.py --version</version_command> <command interpreter="python"> blastxml_to_top_descr.py "${blastxml_file}" "${tabular_file}" ${topN} </command>