changeset 9:512530020360 draft

v0.0.18 Internal changes to command line handling
author peterjc
date Tue, 16 May 2017 09:17:17 -0400
parents 60a9b3f760cc
children a46d7861c32c
files tools/effectiveT3/README.rst tools/effectiveT3/effectiveT3.py tools/effectiveT3/effectiveT3.xml
diffstat 3 files changed, 19 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/tools/effectiveT3/README.rst	Wed Feb 01 09:22:21 2017 -0500
+++ b/tools/effectiveT3/README.rst	Tue May 16 09:17:17 2017 -0400
@@ -96,6 +96,8 @@
         - Catch java exception, e.g. if Java too old for ``TTSS-STD-2.0.1.jar``
 v0.0.17 - Update tool dependency definition to use cached URL.
         - 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).
 ======= ======================================================================
 
 
@@ -112,17 +114,17 @@
 Planemo commands (which requires you have set your Tool Shed access details in
 ``~/.planemo.yml`` and that you have access rights on the Tool Shed)::
 
-    $ planemo shed_update -t testtoolshed --check_diff ~/repositories/pico_galaxy/tools/effectiveT3/
+    $ planemo shed_update -t testtoolshed --check_diff tools/effectiveT3/
     ...
 
 or::
 
-    $ planemo shed_update -t toolshed --check_diff ~/repositories/pico_galaxy/tools/effectiveT3/
+    $ planemo shed_update -t toolshed --check_diff tools/effectiveT3/
     ...
 
 To just build and check the tar ball, use::
 
-    $ planemo shed_upload --tar_only  ~/repositories/pico_galaxy/tools/effectiveT3/
+    $ planemo shed_upload --tar_only tools/effectiveT3/
     ...
     $ tar -tzf shed_upload.tar.gz
     tool-data/effectiveT3.loc.sample
--- a/tools/effectiveT3/effectiveT3.py	Wed Feb 01 09:22:21 2017 -0500
+++ b/tools/effectiveT3/effectiveT3.py	Tue May 16 09:17:17 2017 -0400
@@ -11,9 +11,9 @@
 webservice), and reformats the semi-colon separated output into
 tab separated output for use in Galaxy.
 """
-import sys
 import os
 import subprocess
+import sys
 
 # The Galaxy auto-install via tool_dependencies.xml will set this environment variable
 effective_t3_dir = os.environ.get("EFFECTIVET3", "/opt/EffectiveT3/")
@@ -32,8 +32,7 @@
 if not os.path.isfile(fasta_file):
     sys.exit("Input FASTA file not found: %s" % fasta_file)
 
-if threshold not in ["selective", "sensitive"] \
-    and not threshold.startswith("cutoff="):
+if threshold not in ["selective", "sensitive"] and not threshold.startswith("cutoff="):
     sys.exit("Threshold should be selective, sensitive, or cutoff=..., not %r" % threshold)
 
 
@@ -43,8 +42,7 @@
     positive = 0
     errors = 0
     for line in raw_handle:
-        if not line or line.startswith("#") \
-            or line.startswith("Id; Description; Score;"):
+        if not line or line.startswith("#") or line.startswith("Id; Description; Score;"):
             continue
         assert line.count(";") >= 3, repr(line)
         # Normally there will just be three semi-colons, however the
@@ -71,6 +69,7 @@
 
 
 def run(cmd):
+    """Run the 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:
--- a/tools/effectiveT3/effectiveT3.xml	Wed Feb 01 09:22:21 2017 -0500
+++ b/tools/effectiveT3/effectiveT3.xml	Tue May 16 09:17:17 2017 -0400
@@ -1,22 +1,20 @@
-<tool id="effectiveT3" name="Effective T3" version="0.0.17">
+<tool id="effectiveT3" name="Effective T3" version="0.0.18">
     <description>Find bacterial effectors in protein sequences</description>
     <requirements>
         <requirement type="package" version="1.0.1">effectiveT3</requirement>
     </requirements>
-    <stdio>
-        <!-- Anything other than zero is an error -->
-        <exit_code range="1:" />
-        <exit_code range=":-1" />
-    </stdio>
-    <version_command interpreter="python">effectiveT3.py --version</version_command>
-    <command interpreter="python">
-effectiveT3.py $module.fields.path
+    <version_command>
+python $__tool_directory__/effectiveT3.py --version
+    </version_command>
+    <command detect_errors="aggressive">
+python $__tool_directory__/effectiveT3.py '$module.fields.path'
 #if $restrict.type=="cutoff":
-  cutoff=$restrict.cutoff
+  'cutoff=$restrict.cutoff'
 #else:
-  $restrict.type
+  '$restrict.type'
 #end if
-$fasta_file $tabular_file</command>
+'$fasta_file' '$tabular_file'
+    </command>
     <inputs>
         <param name="fasta_file" type="data" format="fasta" label="FASTA file of protein sequences"/> 
         <param name="module" type="select" display="radio" label="Classification module">