Mercurial > repos > peterjc > blast2go
changeset 10:8664c4c94764 draft default tip
v0.0.11 - Assorted packaging updates (overdue upload)
author | peterjc |
---|---|
date | Tue, 06 Dec 2022 16:29:50 +0000 |
parents | 887adf823bc0 |
children | |
files | tools/blast2go/README.rst tools/blast2go/blast2go.py tools/blast2go/blast2go.xml tools/blast2go/massage_xml_for_blast2go.py tools/blast2go/repository_dependencies.xml tools/blast2go/tool_dependencies.xml |
diffstat | 6 files changed, 55 insertions(+), 74 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/blast2go/README.rst Tue Dec 06 16:26:16 2022 +0000 +++ b/tools/blast2go/README.rst Tue Dec 06 16:29:50 2022 +0000 @@ -1,7 +1,7 @@ Galaxy wrapper for Blast2GO for pipelines, b2g4pipe =================================================== -This wrapper is copyright 2011-2015 by Peter Cock, The James Hutton Institute +This wrapper is copyright 2011-2017 by Peter Cock, The James Hutton Institute (formerly SCRI, Scottish Crop Research Institute), UK. All rights reserved. See the licence text below (MIT licence). @@ -24,22 +24,22 @@ Peter Cock, Bjoern Gruening, Konrad Paszkiewicz and Leighton Pritchard (2013). Galaxy tools and workflows for sequence analysis with applications in molecular plant pathology. PeerJ 1:e167 -http://dx.doi.org/10.7717/peerj.167 +https://doi.org/10.7717/peerj.167 S. Geotz et al. (2008). High-throughput functional annotation and data mining with the Blast2GO suite. Nucleic Acids Res. 36(10):3420-3435. -http://dx.doi.org/10.1093/nar/gkn176 +https://doi.org/10.1093/nar/gkn176 A. Conesa and S. Geotz (2008). Blast2GO: A Comprehensive Suite for Functional Analysis in Plant Genomics. International Journal of Plant Genomics. 619832. -http://dx.doi.org/10.1155/2008/619832 +https://doi.org/10.1155/2008/619832 A. Conesa et al. (2005). Blast2GO: A universal tool for annotation, visualization and analysis in functional genomics research. Bioinformatics 21:3674-3676. -http://dx.doi.org/10.1093/bioinformatics/bti610 +https://doi.org/10.1093/bioinformatics/bti610 See also http://www.blast2go.com/ @@ -164,8 +164,16 @@ of the Blast2GO command line tool. For now b2g4pipe v2.5 is still available as a free download. - Tool definition now embeds citation information. -v0.0.10 - Reorder XML elements (internal change only). +v0.0.10 - Python 3 ready + - Reorder XML elements (internal change only). - Planemo for Tool Shed upload (``.shed.yml``, internal change only). +v0.0.11 - Fix parameter help text which was not being displayed. + - PEP8 style updates to the Python script (internal change only). + - Use ``<command detect_errors="aggressive">`` (internal change only). + - Single quote command line arguments (internal change only). + - Python 3 compatible syntax. + - Record ``b2g4pipe_v2.5.zip`` SHA256 checksum, and download this via + the Galaxy package cache. ======= ====================================================================== @@ -195,7 +203,7 @@ $ planemo shed_upload --tar_only ~/repositories/galaxy_blast/tools/blast2go/ ... - $ tar -tzf shed_upload.tar.gz + $ tar -tzf shed_upload.tar.gz test-data/blastp_sample.blast2go.tabular test-data/blastp_sample.xml tool-data/blast2go.loc.sample
--- a/tools/blast2go/blast2go.py Tue Dec 06 16:26:16 2022 +0000 +++ b/tools/blast2go/blast2go.py Tue Dec 06 16:29:50 2022 +0000 @@ -26,9 +26,11 @@ This script is under version control here: https://github.com/peterjc/galaxy_blast/tree/master/blast2go """ -import sys +from __future__ import print_function + import os import subprocess +import sys # You may need to edit this to match your local setup, blast2go_dir = os.environ.get("B2G4PIPE", "/opt/b2g4pipe_v2.5/") @@ -41,7 +43,10 @@ sys.exit("Missing sister file massage_xml_for_blast2go.py") if len(sys.argv) != 4: - sys.exit("Require three arguments: XML filename, properties filename, output tabular filename") + sys.exit( + "Require three arguments: XML filename, " + "properties filename, output tabular filename" + ) xml_file, prop_file, tabular_file = sys.argv[1:] @@ -65,11 +70,14 @@ def run(cmd): + """Run the given command line string via subprocess.""" # Avoid using shell=True when we call subprocess to ensure if the Python # script is killed, so too is the child process. try: - child = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - except Exception, err: + child = subprocess.Popen( + cmd, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE + ) + except Exception as err: sys.exit("Error invoking command:\n%s\n\n%s\n" % (" ".join(cmd), err)) stdout, stderr = child.communicate() return_code = child.returncode @@ -91,7 +99,7 @@ error_msg = "No sequences processed!" if error_msg: - print error_msg + print(error_msg) sys.exit(error_msg) @@ -105,14 +113,21 @@ # We will have write access wherever the output should be, # so we'll ask Blast2GO to use that as the stem for its output # (it will append .annot to the filename) -cmd = ["java", "-cp", blast2go_classpath, "es.blast2go.prog.B2GAnnotPipe", - "-in", tmp_xml_file, - "-prop", prop_file, - "-out", tabular_file, # Used as base name for output files - "-annot", # Generate *.annot tabular file - # NOTE: For v2.3.5 must use -a, for v2.5 must use -annot instead - # "-img", # Generate images, feature not in v2.3.5 - ] +cmd = [ + "java", + "-cp", + blast2go_classpath, + "es.blast2go.prog.B2GAnnotPipe", + "-in", + tmp_xml_file, + "-prop", + prop_file, + "-out", + tabular_file, # Used as base name for output files + "-annot", # Generate *.annot tabular file + # NOTE: For v2.3.5 must use -a, for v2.5 must use -annot instead + # "-img", # Generate images, feature not in v2.3.5 +] # print " ".join(cmd) run(cmd) @@ -126,4 +141,4 @@ # Move the output file where Galaxy expects it to be: os.rename(out_file, tabular_file) -print "Done" +print("Done")
--- a/tools/blast2go/blast2go.xml Tue Dec 06 16:26:16 2022 +0000 +++ b/tools/blast2go/blast2go.xml Tue Dec 06 16:29:50 2022 +0000 @@ -1,19 +1,15 @@ -<tool id="blast2go" name="Blast2GO" version="0.0.10"> +<tool id="blast2go" name="Blast2GO" version="0.0.11" profile="16.10"> <description>Maps BLAST results to GO annotation terms</description> <requirements> <requirement type="package" version="2.5">b2g4pipe</requirement> + <requirement type="package" version="3.9">python</requirement> </requirements> - <stdio> - <!-- Wrapper ensures anything other than zero is an error --> - <exit_code range="1:" /> - <exit_code range=":-1" /> - </stdio> - <command interpreter="python"> - blast2go.py "${xml}" "${prop.fields.path}" "${tab}" + <command detect_errors="aggressive"> +python $__tool_directory__/blast2go.py '$xml' '${prop.fields.path}' '$tab' </command> <inputs> - <param name="xml" type="data" format="blastxml" label="BLAST XML results" description="You must have run BLAST against a protein database such as the NCBI non-redundant (NR) database. Use BLASTX for nucleotide queries, BLASTP for protein queries." /> - <param name="prop" type="select" label="Blast2GO settings" description="One or more configurations can be setup, such as using the Blast2GO team's server in Spain, or a local database."> + <param name="xml" type="data" format="blastxml" label="BLAST XML results" help="You must have run BLAST against a protein database such as the NCBI non-redundant (NR) database. Use BLASTX for nucleotide queries, BLASTP for protein queries." /> + <param name="prop" type="select" label="Blast2GO settings" help="One or more configurations can be setup, such as using the Blast2GO team's server in Spain, or a local database."> <options from_file="blast2go.loc"> <column name="value" index="0"/> <column name="name" index="1"/> @@ -92,22 +88,22 @@ Peter Cock, Bjoern Gruening, Konrad Paszkiewicz and Leighton Pritchard (2013). Galaxy tools and workflows for sequence analysis with applications in molecular plant pathology. PeerJ 1:e167 -http://dx.doi.org/10.7717/peerj.167 +https://doi.org/10.7717/peerj.167 S. Götz et al. (2008). High-throughput functional annotation and data mining with the Blast2GO suite. Nucleic Acids Res. 36(10):3420–3435. -http://dx.doi.org/10.1093/nar/gkn176 +https://doi.org/10.1093/nar/gkn176 A. Conesa and S. Götz (2008). Blast2GO: A Comprehensive Suite for Functional Analysis in Plant Genomics. International Journal of Plant Genomics. 619832. -http://dx.doi.org/10.1155/2008/619832 +https://doi.org/10.1155/2008/619832 A. Conesa et al. (2005). Blast2GO: A universal tool for annotation, visualization and analysis in functional genomics research. Bioinformatics 21:3674-3676. -http://dx.doi.org/10.1093/bioinformatics/bti610 +https://doi.org/10.1093/bioinformatics/bti610 See also http://www.blast2go.com/
--- a/tools/blast2go/massage_xml_for_blast2go.py Tue Dec 06 16:26:16 2022 +0000 +++ b/tools/blast2go/massage_xml_for_blast2go.py Tue Dec 06 16:29:50 2022 +0000 @@ -19,8 +19,8 @@ This script is under version control here: https://github.com/peterjc/galaxy_blast/tree/master/blast2go """ +import os import sys -import os def prepare_xml(original_xml, mangled_xml):
--- a/tools/blast2go/repository_dependencies.xml Tue Dec 06 16:26:16 2022 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -<?xml version="1.0" ?> -<repositories description="Requires BLAST XML and database datatype definitions."> - <repository name="blast_datatypes" owner="devteam" toolshed="https://toolshed.g2.bx.psu.edu" changeset_revision="01b38f20197e"/> -</repositories> \ No newline at end of file
--- a/tools/blast2go/tool_dependencies.xml Tue Dec 06 16:26:16 2022 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -<?xml version="1.0"?> -<tool_dependency> - <package name="b2g4pipe" version="2.5"> - <install version="1.0"> - <actions> - <!-- If used, download_by_url must be the first action --> - <!-- The ZIP file decompresses to give a folder b2g4pipe --> - <action type="download_by_url">http://www.blast2go.com/data/blast2go/b2g4pipe_v2.5.zip</action> - <!-- Galaxy moves into the unzipped folder b2g4pipe --> - <action type="shell_command"> -cp b2gPipe.properties Spain_2012_August.properties && -sed -i.bak "s/Dbacces.dbname=b2g_apr12/Dbacces.dbname=b2g_aug12/g" Spain_2012_August.properties && -sed -i.bak "s/Dbacces.dbhost=10.10.100.203/Dbacces.dbhost=publicdb.blast2go.com/g" Spain_2012_August.properties -rm Spain_2012_August.properties.bak - </action> - <action type="shell_command"> -cp b2gPipe.properties Spain_2011_June.properties && -sed -i.bak "s/Dbacces.dbname=b2g_apr12/Dbacces.dbname=b2g_jun11/g" Spain_2011_June.properties && -sed -i.bak "s/Dbacces.dbhost=10.10.100.203/Dbacces.dbhost=publicdb.blast2go.com/g" Spain_2011_June.properties -rm Spain_2011_June.properties.bak - </action> - <action type="move_directory_files"><source_directory>.</source_directory><destination_directory>$INSTALL_DIR/</destination_directory></action> - <!-- Set environment variable $B2G4PIPE so Python script knows where to look --> - <action type="set_environment"> - <environment_variable name="B2G4PIPE" action="set_to">$INSTALL_DIR</environment_variable> - </action> - </actions> - </install> - <readme> -Downloads b2g4pipe v2.5 - </readme> - </package> -</tool_dependency> -