Mercurial > repos > peterjc > effectivet3
changeset 5:1ea715da1879 draft
Uploaded v0.0.13, embed citation, relax test for floating point differences
author | peterjc |
---|---|
date | Tue, 25 Nov 2014 08:28:24 -0500 |
parents | f7ce32e13bc6 |
children | 0f6eb4a75000 |
files | tools/effectiveT3/README.rst tools/effectiveT3/effectiveT3.py tools/effectiveT3/effectiveT3.xml tools/effectiveT3/tool_dependencies.xml |
diffstat | 4 files changed, 44 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/effectiveT3/README.rst Wed Sep 18 06:11:36 2013 -0400 +++ b/tools/effectiveT3/README.rst Tue Nov 25 08:28:24 2014 -0500 @@ -33,7 +33,7 @@ Manual Installation =================== -You can change the path by setting the environment variable EFFECTIVET3 to the +You can change the path by setting the environment variable ``$EFFECTIVET3`` to the relevant folder, but by default it expects the following files to be installed at these locations:: @@ -45,23 +45,23 @@ To install the wrapper copy or move the following files under the Galaxy tools folder, e.g. in a tools/effectiveT3 folder: -* effectiveT3.xml (the Galaxy tool definition) -* effectiveT3.py (the Python wrapper script) -* README.rst (this file) +* ``effectiveT3.xml`` (the Galaxy tool definition) +* ``effectiveT3.py`` (the Python wrapper script) +* ``README.rst`` (this file) -Also copy effectiveT3.loc.sample to effectiveT3.loc in the tool-data folder -(and edit if appropriate, e.g. to add or remove a model). +Also copy ``effectiveT3.loc.sample`` to ``effectiveT3.loc`` in the ``tool-data`` +folder (and edit if appropriate, e.g. to add or remove a model). -You will also need to modify the tools_conf.xml file to tell Galaxy to offer the +You will also need to modify the ``tools_conf.xml`` file to tell Galaxy to offer the tool. If you are using other protein analysis tools like TMHMM or SignalP, put it next to them. Just add the line:: <tool file="effectiveT3/effectiveT3.xml" /> -If you wish to run the unit tests, also add this to tools_conf.xml.sample -and move/copy the test-data files under Galaxy's test-data folder. Then:: +If you wish to run the unit tests, also move/copy the ``test-data/`` files +under Galaxy's ``test-data/`` folder. Then:: - $ ./run_functional_tests.sh -id effectiveT3 + $ ./run_tests.sh -id effectiveT3 That's it. @@ -84,6 +84,9 @@ - Use reStructuredText for this README file. - Updated citation information (Cock et al. 2013). - Development moved to GitHub, https://github.com/peterjc/pico_galaxy +v0.0.13 - Relax unit test to allow for small floating point score difference. + - Tool definition now embeds citation information. + - Fixed error handling in ``effectiveT3.py``. ======= ======================================================================
--- a/tools/effectiveT3/effectiveT3.py Wed Sep 18 06:11:36 2013 -0400 +++ b/tools/effectiveT3/effectiveT3.py Tue Nov 25 08:28:24 2014 -0500 @@ -15,13 +15,13 @@ import os import subprocess -#The Galaxy auto-install via tool_dependencies.xml will set this environment variable +# The Galaxy auto-install via tool_dependencies.xml will set this environment variable effectiveT3_dir = os.environ.get("EFFECTIVET3", "/opt/EffectiveT3/") effectiveT3_jar = os.path.join(effectiveT3_dir, "TTSS_GUI-1.0.1.jar") if "-v" in sys.argv or "--version" in sys.argv: - #TODO - Get version of the JAR file dynamically? - print "Wrapper v0.0.11, TTSS_GUI-1.0.1.jar" + # TODO - Get version of the JAR file dynamically? + print("Wrapper v0.0.13, TTSS_GUI-1.0.1.jar") sys.exit(0) def stop_err(msg, error_level=1): @@ -51,12 +51,12 @@ or line.startswith("Id; Description; Score;"): continue assert line.count(";") >= 3, repr(line) - #Normally there will just be three semi-colons, however the - #original FASTA file's ID or description might have had - #semi-colons in it as well, hence the following hackery: + # Normally there will just be three semi-colons, however the + # original FASTA file's ID or description might have had + # semi-colons in it as well, hence the following hackery: try: id_descr, score, effective = line.rstrip("\r\n").rsplit(";",2) - #Cope when there was no FASTA description + # Cope when there was no FASTA description if "; " not in id_descr and id_descr.endswith(";"): id = id_descr[:-1] descr = "" @@ -74,20 +74,21 @@ return count, positive, errors def run(cmd): - #Avoid using shell=True when we call subprocess to ensure if the Python - #script is killed, so too is the child process. + # 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: stop_err("Error invoking command:\n%s\n\n%s\n" % (" ".join(cmd), err)) - #Use .communicate as can get deadlocks with .wait(), + # Use .communicate as can get deadlocks with .wait(), stdout, stderr = child.communicate() return_code = child.returncode if return_code: + cmd_str= " ".join(cmd) # doesn't quote spaces etc if stderr and stdout: - stop_err("Return code %i from command:\n%s\n\n%s\n\n%s" % (return_code, err, stdout, stderr)) + stop_err("Return code %i from command:\n%s\n\n%s\n\n%s" % (return_code, cmd_str, stdout, stderr)) else: - stop_err("Return code %i from command:\n%s\n%s" % (return_code, err, stderr)) + stop_err("Return code %i from command:\n%s\n%s" % (return_code, cmd_str, stderr)) if not os.path.isdir(effectiveT3_dir): stop_err("Effective T3 folder not found: %r" % effectiveT3_dir) @@ -106,10 +107,10 @@ sys.stderr.write("Main JAR was found: %r\n" % effectiveT3_jar) stop_err("Effective T3 model JAR file not found: %r" % effectiveT3_model) -#We will have write access whereever the output should be, +# We will have write access whereever the output should be, temp_file = os.path.abspath(tabular_file + ".tmp") -#Use absolute paths since will change current directory... +# Use absolute paths since will change current directory... tabular_file = os.path.abspath(tabular_file) fasta_file = os.path.abspath(fasta_file) @@ -121,7 +122,7 @@ "-q"] try: - #Must run from directory above the module subfolder: + # Must run from directory above the module subfolder: os.chdir(effectiveT3_dir) except: stop_err("Could not change to Effective T3 folder: %s" % effectiveT3_dir) @@ -141,11 +142,11 @@ os.remove(temp_file) if errors: - print "%i sequences, %i positive, %i errors" \ - % (count, positive, errors) + print("%i sequences, %i positive, %i errors" + % (count, positive, errors)) else: - print "%i/%i sequences positive" % (positive, count) + print("%i/%i sequences positive" % (positive, count)) if count and count==errors: - #Galaxy will still allow them to see the output file + # Galaxy will still allow them to see the output file stop_err("All your sequences gave an error code")
--- a/tools/effectiveT3/effectiveT3.xml Wed Sep 18 06:11:36 2013 -0400 +++ b/tools/effectiveT3/effectiveT3.xml Tue Nov 25 08:28:24 2014 -0500 @@ -1,4 +1,4 @@ -<tool id="effectiveT3" name="Effective T3" version="0.0.12"> +<tool id="effectiveT3" name="Effective T3" version="0.0.13"> <description>Find bacterial effectors in protein sequences</description> <requirements> <requirement type="package" version="1.0.1">effectiveT3</requirement> @@ -47,12 +47,12 @@ <param name="fasta_file" value="four_human_proteins.fasta" ftype="fasta" /> <param name="module" value="animal" /> <param name="type" value="selective" /> - <output name="tabular_file" file="four_human_proteins.effectiveT3.tabular" ftype="tabular" /> + <output name="tabular_file" file="four_human_proteins.effectiveT3.tabular" ftype="tabular" lines_diff="2"/> </test> <test> <param name="fasta_file" value="empty.fasta" ftype="fasta" /> <param name="module" value="plant" /> - <param name="type" value="sensistive" /> + <param name="type" value="sensitive" /> <output name="tabular_file" file="empty_effectiveT3.tabular" ftype="tabular" /> </test> </tests> @@ -99,4 +99,9 @@ This wrapper is available to install into other Galaxy Instances via the Galaxy Tool Shed at http://toolshed.g2.bx.psu.edu/view/peterjc/effectivet3 </help> + <citations> + <citation type="doi">10.7717/peerj.167</citation> + <citation type="doi">10.1093/nar/gkq1154</citation> + <citation type="doi">10.1371/journal.ppat.1000376</citation> + </citations> </tool>
--- a/tools/effectiveT3/tool_dependencies.xml Wed Sep 18 06:11:36 2013 -0400 +++ b/tools/effectiveT3/tool_dependencies.xml Tue Nov 25 08:28:24 2014 -0500 @@ -9,13 +9,13 @@ </action> <!-- Main JAR file --> <action type="shell_command">wget http://effectors.org/download/version/TTSS_GUI-1.0.1.jar</action> - <!-- If using action type download_file will need to move the file, + <!-- If using action type download_file will need to move the file, <action type="move_file"><source>TTSS_GUI-1.0.1.jar</source><destination>$INSTALL_DIR/</destination></action> - --> + --> <!-- Three model JAR files --> <action type="make_directory">$INSTALL_DIR/module</action> <action type="shell_command">wget http://effectors.org/download/module/TTSS_ANIMAL-1.0.1.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> <action type="shell_command">wget http://effectors.org/download/module/TTSS_PLANT-1.0.1.jar</action> <action type="move_file"><source>TTSS_PLANT-1.0.1.jar</source><destination>$INSTALL_DIR/module/</destination></action> <action type="shell_command">wget http://effectors.org/download/module/TTSS_STD-1.0.1.jar</action>