commit/galaxy-central: 3 new changesets
3 new changesets in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/c4c2e7dc5c02/ changeset: r4977:c4c2e7dc5c02 user: peterjc date: 2011-01-31 18:13:13 summary: Access path field from BLAST loc file, and store ID in database instead affected #: 5 files (1.1 KB) --- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml Tue Feb 01 20:07:17 2011 -0500 +++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml Mon Jan 31 17:13:13 2011 +0000 @@ -1,4 +1,4 @@ -<tool id="ncbi_blastn_wrapper" name="NCBI BLAST+ blastn" version="0.0.7"> +<tool id="ncbi_blastn_wrapper" name="NCBI BLAST+ blastn" version="0.0.8"><description>Search nucleotide database with nucleotide query sequence(s)</description><command> ## The command is a Cheetah template which allows some Python based syntax. @@ -6,7 +6,7 @@ blastn -query "$query" #if $db_opts.db_opts_selector == "db": - -db "$db_opts.database" + -db "${db_opts.database.fields.path}" #else: -subject "$db_opts.subject" #end if @@ -40,13 +40,10 @@ </param><when value="db"><param name="database" type="select" label="Nucleotide BLAST database"> - <!-- The BLAST loc file has three columns: - column 0 is an identifier (not used here, see legacy megablast wrapper), - column 1 is the caption (show this to the user), - column 2 is the database path (given to BLAST+) --><options from_file="blastdb.loc"> + <column name="value" index="0"/><column name="name" index="1"/> - <column name="value" index="2"/> + <column name="path" index="2"/></options></param><param name="subject" type="hidden" value="" /> --- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml Tue Feb 01 20:07:17 2011 -0500 +++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml Mon Jan 31 17:13:13 2011 +0000 @@ -1,4 +1,4 @@ -<tool id="ncbi_blastp_wrapper" name="NCBI BLAST+ blastp" version="0.0.7"> +<tool id="ncbi_blastp_wrapper" name="NCBI BLAST+ blastp" version="0.0.8"><description>Search protein database with protein query sequence(s)</description><command> ## The command is a Cheetah template which allows some Python based syntax. @@ -6,7 +6,7 @@ blastp -query "$query" #if $db_opts.db_opts_selector == "db": - -db "$db_opts.database" + -db "${db_opts.database.fields.path}" #else: -subject "$db_opts.subject" #end if @@ -41,13 +41,10 @@ </param><when value="db"><param name="database" type="select" label="Protein BLAST database"> - <!-- The BLAST loc file has three columns: - column 0 is an identifier (not used), - column 1 is the caption (show this to the user), - column 2 is the database path (given to BLAST+) --><options from_file="blastdb_p.loc"> + <column name="value" index="0"/><column name="name" index="1"/> - <column name="value" index="2"/> + <column name="path" index="2"/></options></param><param name="subject" type="hidden" value="" /> --- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml Tue Feb 01 20:07:17 2011 -0500 +++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml Mon Jan 31 17:13:13 2011 +0000 @@ -1,4 +1,4 @@ -<tool id="ncbi_blastx_wrapper" name="NCBI BLAST+ blastx" version="0.0.7"> +<tool id="ncbi_blastx_wrapper" name="NCBI BLAST+ blastx" version="0.0.8"><description>Search protein database with translated nucleotide query sequence(s)</description><command> ## The command is a Cheetah template which allows some Python based syntax. @@ -6,7 +6,7 @@ blastx -query "$query" #if $db_opts.db_opts_selector == "db": - -db "$db_opts.database" + -db "${db_opts.database.fields.path}" #else: -subject "$db_opts.subject" #end if @@ -40,13 +40,10 @@ </param><when value="db"><param name="database" type="select" label="Protein BLAST database"> - <!-- The BLAST loc file has three columns: - column 0 is an identifier (not used), - column 1 is the caption (show this to the user), - column 2 is the database path (given to BLAST+) --><options from_file="blastdb_p.loc"> + <column name="value" index="0"/><column name="name" index="1"/> - <column name="value" index="2"/> + <column name="path" index="2"/></options></param><param name="subject" type="hidden" value="" /> --- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml Tue Feb 01 20:07:17 2011 -0500 +++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml Mon Jan 31 17:13:13 2011 +0000 @@ -1,4 +1,4 @@ -<tool id="ncbi_tblastn_wrapper" name="NCBI BLAST+ tblastn" version="0.0.7"> +<tool id="ncbi_tblastn_wrapper" name="NCBI BLAST+ tblastn" version="0.0.8"><description>Search translated nucleotide database with protein query sequence(s)</description><command> ## The command is a Cheetah template which allows some Python based syntax. @@ -6,7 +6,7 @@ tblastn -query "$query" #if $db_opts.db_opts_selector == "db": - -db "$db_opts.database" + -db "${db_opts.database.fields.path}" #else: -subject "$db_opts.subject" #end if @@ -40,13 +40,10 @@ </param><when value="db"><param name="database" type="select" label="Nucleotide BLAST database"> - <!-- The BLAST loc file has three columns: - column 0 is an identifier (not used here, see legacy megablast wrapper), - column 1 is the caption (show this to the user), - column 2 is the database path (given to BLAST+) --><options from_file="blastdb.loc"> + <column name="value" index="0"/><column name="name" index="1"/> - <column name="value" index="2"/> + <column name="path" index="2"/></options></param><param name="subject" type="hidden" value="" /> --- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml Tue Feb 01 20:07:17 2011 -0500 +++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml Mon Jan 31 17:13:13 2011 +0000 @@ -1,4 +1,4 @@ -<tool id="ncbi_tblastx_wrapper" name="NCBI BLAST+ tblastx" version="0.0.7"> +<tool id="ncbi_tblastx_wrapper" name="NCBI BLAST+ tblastx" version="0.0.8"><description>Search translated nucleotide database with translated nucleotide query sequence(s)</description><command> ## The command is a Cheetah template which allows some Python based syntax. @@ -6,7 +6,7 @@ tblastx -query "$query" #if $db_opts.db_opts_selector == "db": - -db "$db_opts.database" + -db "${db_opts.database.fields.path}" #else: -subject "$db_opts.subject" #end if @@ -39,13 +39,10 @@ </param><when value="db"><param name="database" type="select" label="Nucleotide BLAST database"> - <!-- The BLAST loc file has three columns: - column 0 is an identifier (not used here, see legacy megablast wrapper), - column 1 is the caption (show this to the user), - column 2 is the database path (given to BLAST+) --><options from_file="blastdb.loc"> + <column name="value" index="0"/><column name="name" index="1"/> - <column name="value" index="2"/> + <column name="path" index="2"/></options></param><param name="subject" type="hidden" value="" /> http://bitbucket.org/galaxy/galaxy-central/changeset/17c2a47f67e3/ changeset: r4978:17c2a47f67e3 user: peterjc date: 2011-02-01 11:52:50 summary: Use wrapper script to hide BLAST warnings on stderr (see issue 325) affected #: 6 files (1.7 KB) --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/ncbi_blast_plus/hide_stderr.py Tue Feb 01 10:52:50 2011 +0000 @@ -0,0 +1,44 @@ +#!/usr/bin/env python +"""A simple script to redirect stderr to stdout when the return code is zero. + +See https://bitbucket.org/galaxy/galaxy-central/issue/325/ + +Currently Galaxy ignores the return code from command line tools (even if it +is non-zero which by convention indicates an error) and treats any output on +stderr as an error (even though by convention stderr is used for errors or +warnings). + +This script runs the given command line, capturing all stdout and stderr in +memory, and gets the return code. For a zero return code, any stderr (which +should be warnings only) is added to the stdout. That way Galaxy believes +everything is fine. For a non-zero return code, we output stdout as is, and +any stderr, plus the return code to ensure there is some output on stderr. +That way Galaxy treats this as an error. + +Once issue 325 is fixed, this script will not be needed. +""" +import sys +import subprocess + +#Sadly passing the list directly to subprocess didn't seem to work. +words = [] +for w in sys.argv[1:]: + if " " in w: + words.append('"%s"' % w) + else: + words.append(w) +cmd = " ".join(words) +child = subprocess.Popen(cmd, shell=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) +#Use .communicate as can get deadlocks with .wait(), +stdout, stderr = child.communicate() +return_code = child.returncode + +if return_code: + sys.stdout.write(stdout) + sys.stderr.write(stderr) + sys.stderr.write("Return error code %i from command:\n" % return_code) + sys.stderr.write("%s\n" % cmd) +else: + sys.stdout.write(stdout) + sys.stdout.write(stderr) --- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml Mon Jan 31 17:13:13 2011 +0000 +++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml Tue Feb 01 10:52:50 2011 +0000 @@ -1,6 +1,6 @@ <tool id="ncbi_blastn_wrapper" name="NCBI BLAST+ blastn" version="0.0.8"><description>Search nucleotide database with nucleotide query sequence(s)</description> - <command> + <command interpreter="python">hide_stderr.py ## The command is a Cheetah template which allows some Python based syntax. ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces blastn --- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml Mon Jan 31 17:13:13 2011 +0000 +++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml Tue Feb 01 10:52:50 2011 +0000 @@ -1,6 +1,6 @@ <tool id="ncbi_blastp_wrapper" name="NCBI BLAST+ blastp" version="0.0.8"><description>Search protein database with protein query sequence(s)</description> - <command> + <command interpreter="python">hide_stderr.py ## The command is a Cheetah template which allows some Python based syntax. ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces blastp --- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml Mon Jan 31 17:13:13 2011 +0000 +++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml Tue Feb 01 10:52:50 2011 +0000 @@ -1,6 +1,6 @@ <tool id="ncbi_blastx_wrapper" name="NCBI BLAST+ blastx" version="0.0.8"><description>Search protein database with translated nucleotide query sequence(s)</description> - <command> + <command interpreter="python">hide_stderr.py ## The command is a Cheetah template which allows some Python based syntax. ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces blastx --- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml Mon Jan 31 17:13:13 2011 +0000 +++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml Tue Feb 01 10:52:50 2011 +0000 @@ -1,7 +1,7 @@ <tool id="ncbi_tblastn_wrapper" name="NCBI BLAST+ tblastn" version="0.0.8"><description>Search translated nucleotide database with protein query sequence(s)</description> - <command> -## The command is a Cheetah template which allows some Python based syntax. + <command interpreter="python">hide_stderr.py +# The command is a Cheetah template which allows some Python based syntax. ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces tblastn -query "$query" --- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml Mon Jan 31 17:13:13 2011 +0000 +++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml Tue Feb 01 10:52:50 2011 +0000 @@ -1,6 +1,6 @@ <tool id="ncbi_tblastx_wrapper" name="NCBI BLAST+ tblastx" version="0.0.8"><description>Search translated nucleotide database with translated nucleotide query sequence(s)</description> - <command> + <command interpreter="python">hide_stderr.py ## The command is a Cheetah template which allows some Python based syntax. ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces tblastx http://bitbucket.org/galaxy/galaxy-central/changeset/ca4a622b52ce/ changeset: r4979:ca4a622b52ce user: peterjc date: 2011-02-01 16:24:45 summary: Avoid using shell=True when we call subprocess to ensure if the Python script is killed, so too is the BLAST process affected #: 1 file (34 bytes) --- a/tools/ncbi_blast_plus/hide_stderr.py Tue Feb 01 10:52:50 2011 +0000 +++ b/tools/ncbi_blast_plus/hide_stderr.py Tue Feb 01 15:24:45 2011 +0000 @@ -20,16 +20,14 @@ import sys import subprocess -#Sadly passing the list directly to subprocess didn't seem to work. -words = [] -for w in sys.argv[1:]: - if " " in w: - words.append('"%s"' % w) - else: - words.append(w) -cmd = " ".join(words) -child = subprocess.Popen(cmd, shell=True, - stdout=subprocess.PIPE, stderr=subprocess.PIPE) +#Avoid using shell=True when we call subprocess to ensure if the Python +#script is killed, so too is the BLAST process. +try: + child = subprocess.Popen(sys.argv[1:], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) +except Exception, err: + sys.stderr.write("Error invoking command:\n%s\n\n%s\n" % (cmd, err)) + sys.exit(1) #Use .communicate as can get deadlocks with .wait(), stdout, stderr = child.communicate() return_code = child.returncode Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket