Previous changeset 9:512530020360 (2017-05-16) Next changeset 11:ed8c1babc166 (2024-03-12) |
Commit message:
"Update all the pico_galaxy tools on main Tool Shed" |
modified:
tools/effectiveT3/README.rst tools/effectiveT3/effectiveT3.py tools/effectiveT3/effectiveT3.xml tools/effectiveT3/tool_dependencies.xml |
b |
diff -r 512530020360 -r a46d7861c32c tools/effectiveT3/README.rst --- a/tools/effectiveT3/README.rst Tue May 16 09:17:17 2017 -0400 +++ b/tools/effectiveT3/README.rst Fri Apr 16 22:34:56 2021 +0000 |
b |
@@ -10,12 +10,12 @@ Jehl, Arnold and Rattei. Effective - a database of predicted secreted bacterial proteins Nucleic Acids Research, 39(Database issue), D591-5, 2011. -http://dx.doi.org/10.1093/nar/gkq1154 +https://doi.org/10.1093/nar/gkq1154 Arnold, Brandmaier, Kleine, Tischler, Heinz, Behrens, Niinikoski, Mewes, Horn and Rattei. Sequence-based prediction of type III secreted proteins. PLoS Pathog. 5(4):e1000376, 2009. -http://dx.doi.org/10.1371/journal.ppat.1000376 +https://doi.org/10.1371/journal.ppat.1000376 http://effectors.org/ @@ -98,6 +98,9 @@ - Minor internal changes to Python script for error reporting & style. v0.0.18 - Use ``<command detect_errors="aggressive">`` (internal change only). - Single quote command line arguments (internal change only). +v0.0.19 - Python 3 compatible exception handling. +v0.0.20 - Work with Effective T3 as installed by BioConda (which provides a + wrapper script which can be used to find the main JAR file folder). ======= ====================================================================== |
b |
diff -r 512530020360 -r a46d7861c32c tools/effectiveT3/effectiveT3.py --- a/tools/effectiveT3/effectiveT3.py Tue May 16 09:17:17 2017 -0400 +++ b/tools/effectiveT3/effectiveT3.py Fri Apr 16 22:34:56 2021 +0000 |
[ |
b'@@ -12,20 +12,33 @@\n tab separated output for use in Galaxy.\n """\n import os\n+\n+# We want to be able to use shutil.which, but need Python 3.3+\n+# import shutil\n import subprocess\n import sys\n \n-# The Galaxy auto-install via tool_dependencies.xml will set this environment variable\n-effective_t3_dir = os.environ.get("EFFECTIVET3", "/opt/EffectiveT3/")\n-effective_t3_jar = os.path.join(effective_t3_dir, "TTSS_GUI-1.0.1.jar")\n+# The Galaxy auto-install via tool_dependencies.xml will set the\n+# environment variable $EFFECTIVET3 pointing at the folder with\n+# the JAR file.\n+#\n+# The BioConda recipe will put a wrapper script on the $PATH,\n+# which we can use to find the JAR file.\n+#\n+# We fall back on /opt/EffectiveT3/\n+#\n+effective_t3_jarname = "TTSS_GUI-1.0.1.jar"\n \n if "-v" in sys.argv or "--version" in sys.argv:\n # TODO - Get version of the JAR file dynamically?\n- print("Wrapper v0.0.17, TTSS_GUI-1.0.1.jar")\n+ print("Wrapper v0.0.20, for %s" % effective_t3_jarname)\n sys.exit(0)\n \n if len(sys.argv) != 5:\n- sys.exit("Require four arguments: model, threshold, input protein FASTA file & output tabular file")\n+ sys.exit(\n+ "Require four arguments: model, threshold, input protein "\n+ "FASTA file & output tabular file"\n+ )\n \n model, threshold, fasta_file, tabular_file = sys.argv[1:]\n \n@@ -33,7 +46,9 @@\n sys.exit("Input FASTA file not found: %s" % fasta_file)\n \n if threshold not in ["selective", "sensitive"] and not threshold.startswith("cutoff="):\n- sys.exit("Threshold should be selective, sensitive, or cutoff=..., not %r" % threshold)\n+ sys.exit(\n+ "Threshold should be selective, sensitive, or cutoff=..., not %r" % threshold\n+ )\n \n \n def clean_tabular(raw_handle, out_handle):\n@@ -42,7 +57,11 @@\n positive = 0\n errors = 0\n for line in raw_handle:\n- if not line or line.startswith("#") or line.startswith("Id; Description; Score;"):\n+ if (\n+ not line\n+ or line.startswith("#")\n+ or line.startswith("Id; Description; Score;")\n+ ):\n continue\n assert line.count(";") >= 3, repr(line)\n # Normally there will just be three semi-colons, however the\n@@ -73,8 +92,10 @@\n # Avoid using shell=True when we call subprocess to ensure if the Python\n # script is killed, so too is the child process.\n try:\n- child = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n- except Exception, err:\n+ child = subprocess.Popen(\n+ cmd, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE\n+ )\n+ except Exception as err:\n sys.exit("Error invoking command:\\n%s\\n\\n%s\\n" % (" ".join(cmd), err))\n # Use .communicate as can get deadlocks with .wait(),\n stdout, stderr = child.communicate()\n@@ -82,41 +103,141 @@\n if return_code or stderr.startswith("Exception in thread"):\n cmd_str = " ".join(cmd) # doesn\'t quote spaces etc\n if stderr and stdout:\n- sys.exit("Return code %i from command:\\n%s\\n\\n%s\\n\\n%s" % (return_code, cmd_str, stdout, stderr))\n+ sys.exit(\n+ "Return code %i from command:\\n%s\\n\\n%s\\n\\n%s"\n+ % (return_code, cmd_str, stdout, stderr)\n+ )\n else:\n- sys.exit("Return code %i from command:\\n%s\\n%s" % (return_code, cmd_str, stderr))\n+ sys.exit(\n+ "Return code %i from command:\\n%s\\n%s" % (return_code, cmd_str, stderr)\n+ )\n \n \n-if not os.path.isdir(effective_t3_dir):\n- sys.exit("Effective T3 folder not found: %r" % effective_t3_dir)\n+try:\n+ from shutil import which\n+except ImportError:\n+ # Likely running on Python 2, use backport:\n+ def which(cmd, mode=os.F_OK | os.X_OK, path=None):\n+ """Python implementation of command line tool which.\n+\n+ Given a command, mode, and a PATH string, return the path which\n+ conforms to the given mode on the PATH, or None if ther'..b'))]\n+ # If it does match, only test that one, otherwise we have to try\n+ # others.\n+ files = [cmd] if matches else [cmd + ext.lower() for ext in pathext]\n+ else:\n+ # On other platforms you don\'t have things like PATHEXT to tell you\n+ # what file suffixes are executable, so just pass on cmd as-is.\n+ files = [cmd]\n+\n+ seen = set()\n+ for dir in path:\n+ dir = os.path.normcase(dir)\n+ if dir not in seen:\n+ seen.add(dir)\n+ for thefile in files:\n+ name = os.path.join(dir, thefile)\n+ if _access_check(name, mode):\n+ return name\n+ return None\n+\n+\n+# Try in order the following to find the JAR file:\n+# - Location of any wrapper script, e.g. from BioConda installation\n+# - The $EFFECTIVET3 env var, e.g. old-style Galaxy tool installation\n+# - The /opt/EffectiveT3/ folder.\n+effective_t3_jar = None\n+effective_t3_dir = None\n+dirs = ["/opt/EffectiveT3/"]\n+if "EFFECTIVET3" in os.environ:\n+ dirs.insert(0, os.environ.get("EFFECTIVET3"))\n+if which("effectivet3"):\n+ # Assuming this is a BioConda installed wrapper for effective T3,\n+ # this will get the directory of the wrapper script which is where\n+ # the JAR file will be:\n+ dirs.insert(0, os.path.split(os.path.realpath(which("effectivet3")))[0])\n+for effective_t3_dir in dirs:\n+ effective_t3_jar = os.path.join(effective_t3_dir, effective_t3_jarname)\n+ if os.path.isfile(effective_t3_jar):\n+ # Good\n+ break\n+ effective_t3_jar = None\n+if not effective_t3_dir or not effective_t3_jar:\n+ sys.exit("Effective T3 JAR file %r not found in %r" % (effective_t3_jarname, dirs))\n \n if not os.path.isdir(os.path.join(effective_t3_dir, "module")):\n- sys.exit("Effective T3 module folder not found: %r" % os.path.join(effective_t3_dir, "module"))\n+ sys.exit(\n+ "Effective T3 module folder not found: %r"\n+ % os.path.join(effective_t3_dir, "module")\n+ )\n \n effective_t3_model = os.path.join(effective_t3_dir, "module", model)\n if not os.path.isfile(effective_t3_model):\n- sys.stderr.write("Contents of %r is %s\\n"\n- % (os.path.join(effective_t3_dir, "module"),\n- ", ".join(repr(p) for p in os.listdir(os.path.join(effective_t3_dir, "module")))))\n+ sys.stderr.write(\n+ "Contents of %r is %s\\n"\n+ % (\n+ os.path.join(effective_t3_dir, "module"),\n+ ", ".join(\n+ repr(p) for p in os.listdir(os.path.join(effective_t3_dir, "module"))\n+ ),\n+ )\n+ )\n sys.stderr.write("Main JAR was found: %r\\n" % effective_t3_jar)\n sys.exit("Effective T3 model JAR file not found: %r" % effective_t3_model)\n \n-# We will have write access whereever the output should be,\n-temp_file = os.path.abspath(tabular_file + ".tmp")\n+# We will have write access wherever the output should be,\n+if tabular_file == "/dev/stdout":\n+ temp_file = os.path.abspath("effectivet3_tabular_output.tmp")\n+else:\n+ temp_file = os.path.abspath(tabular_file + ".tmp")\n \n # Use absolute paths since will change current directory...\n tabular_file = os.path.abspath(tabular_file)\n fasta_file = os.path.abspath(fasta_file)\n \n-cmd = ["java", "-jar", effective_t3_jar,\n- "-f", fasta_file,\n- "-m", model,\n- "-t", threshold,\n- "-o", temp_file,\n- "-q"]\n+cmd = [\n+ "java",\n+ "-jar",\n+ effective_t3_jar,\n+ "-f",\n+ fasta_file,\n+ "-m",\n+ model,\n+ "-t",\n+ threshold,\n+ "-o",\n+ temp_file,\n+ "-q",\n+]\n \n try:\n # Must run from directory above the module subfolder:\n@@ -139,8 +260,7 @@\n os.remove(temp_file)\n \n if errors:\n- print("%i sequences, %i positive, %i errors"\n- % (count, positive, errors))\n+ print("%i sequences, %i positive, %i errors" % (count, positive, errors))\n else:\n print("%i/%i sequences positive" % (positive, count))\n \n' |
b |
diff -r 512530020360 -r a46d7861c32c tools/effectiveT3/effectiveT3.xml --- a/tools/effectiveT3/effectiveT3.xml Tue May 16 09:17:17 2017 -0400 +++ b/tools/effectiveT3/effectiveT3.xml Fri Apr 16 22:34:56 2021 +0000 |
b |
@@ -1,4 +1,4 @@ -<tool id="effectiveT3" name="Effective T3" version="0.0.18"> +<tool id="effectiveT3" name="Effective T3" version="0.0.20"> <description>Find bacterial effectors in protein sequences</description> <requirements> <requirement type="package" version="1.0.1">effectiveT3</requirement> @@ -16,7 +16,7 @@ '$fasta_file' '$tabular_file' </command> <inputs> - <param name="fasta_file" type="data" format="fasta" label="FASTA file of protein sequences"/> + <param name="fasta_file" type="data" format="fasta" label="FASTA file of protein sequences"/> <param name="module" type="select" display="radio" label="Classification module"> <options from_file="effectiveT3.loc"> <column name="value" index="0"/> @@ -62,7 +62,7 @@ </test> </tests> <help> - + **What it does** This calls the command line Effective T3 v1.0.1 tool for prediction of bacterial effector proteins. @@ -87,17 +87,17 @@ Peter J.A. Cock, Björn A. Grüning, 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 Jehl, Arnold and Rattei (2011). Effective - a database of predicted secreted bacterial proteins Nucleic Acids Research, 39(Database issue), D591-5. -http://dx.doi.org/10.1093/nar/gkq1154 +https://doi.org/10.1093/nar/gkq1154 Arnold, Brandmaier, Kleine, Tischler, Heinz, Behrens, Niinikoski, Mewes, Horn and Rattei (2009). Sequence-based prediction of type III secreted proteins. PLoS Pathog. 5(4):e1000376. -http://dx.doi.org/10.1371/journal.ppat.1000376 +https://doi.org/10.1371/journal.ppat.1000376 See also http://effectors.org/ |
b |
diff -r 512530020360 -r a46d7861c32c tools/effectiveT3/tool_dependencies.xml --- a/tools/effectiveT3/tool_dependencies.xml Tue May 16 09:17:17 2017 -0400 +++ b/tools/effectiveT3/tool_dependencies.xml Fri Apr 16 22:34:56 2021 +0000 |
b |
@@ -11,7 +11,7 @@ <action type="make_directory">$INSTALL_DIR/module</action> <!-- Original URL http://effectors.csb.univie.ac.at/sites/eff/files/others/TTSS_ANIMAL-1.0.1.jar --> <action type="download_file" sha256sum="3d9cd8e805387d2dfa855076b3d5f7f97334aa612288075111329fb036c94e34" target_filename="TTSS_ANIMAL-1.0.1.jar">https://depot.galaxyproject.org/software/TTSS_ANIMAL/TTSS_ANIMAL_1.0.1_src_all.jar</action> - <action type="move_file"><source>TTSS_ANIMAL-1.0.1.jar</source><destination>$INSTALL_DIR/module/</destination></action> + <action type="move_file"><source>TTSS_ANIMAL-1.0.1.jar</source><destination>$INSTALL_DIR/module/</destination></action> <!-- Original URL http://effectors.csb.univie.ac.at/sites/eff/files/others/TTSS_PLANT-1.0.1.jar --> <action type="download_file" sha256sum="593f0052ace030c2fa16cf336f3916a21bc2addbaefdfa149b084b1425e42a13" target_filename="TTSS_PLANT-1.0.1.jar">https://depot.galaxyproject.org/software/TTSS_PLANT/TTSS_PLANT_1.0.1_src_all.jar</action> <action type="move_file"><source>TTSS_PLANT-1.0.1.jar</source><destination>$INSTALL_DIR/module/</destination></action> |