Previous changeset 9:5573d802e431 (2013-09-18) Next changeset 11:e59904c855ae (2014-04-30) |
Commit message:
Uploaded v0.0.9, correct path in dependency installation; renamed folder |
added:
tools/mira3/README.rst tools/mira3/mira.py tools/mira3/mira.xml tools/mira3/tool_dependencies.xml |
removed:
tools/mira_3_4/README.rst tools/mira_3_4/mira.py tools/mira_3_4/mira.xml tools/mira_3_4/tool_dependencies.xml |
b |
diff -r 5573d802e431 -r a2fb1e67bd11 tools/mira3/README.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/mira3/README.rst Thu Jan 30 13:21:21 2014 -0500 |
b |
@@ -0,0 +1,125 @@ +Galaxy wrapper for the MIRA assembly program (v3.4) +=================================================== + +This tool is copyright 2011-2013 by Peter Cock, The James Hutton Institute +(formerly SCRI, Scottish Crop Research Institute), UK. All rights reserved. +See the licence text below (MIT licence). + +This tool is a short Python script (to collect the MIRA output and move it +to where Galaxy expects the files, and convert MIRA's TCS file into a tab +separated file for use in Galaxy). + +It is available from the Galaxy Tool Shed at: +http://toolshed.g2.bx.psu.edu/view/peterjc/mira_assembler + + +Automated Installation +====================== + +This should be straightforward, Galaxy should automatically download and +install the precompiled binary for MIRA v3.4.0 for the Galaxy wrapper, +and run any tests. + + +Manual Installation +=================== + +There are just two Galaxy files to install: + +* mira.py (the Python script) +* mira.xml (the Galaxy tool definition) + +The suggested location is a new tools/mira3 folder. You will also need to +modify the tools_conf.xml file to tell Galaxy to offer the tool, and also do +this to tools_conf.xml.sample in order to run any tests:: + + <tool file="mira3/mira.xml" /> + +You will also need to install MIRA, we used version 3.4.1.1. See: + +* http://chevreux.org/projects_mira.html +* http://sourceforge.net/projects/mira-assembler/ + +WARNING: This tool was initially developed to construct viral genome assembly +and mapping pipelines, for which the run time and memory requirements are +negligible. For larger tasks, be aware that MIRA can require vast amounts +of RAM and run-times of over a week are possible. This tool wrapper makes +no attempt to spot and reject such large jobs. + + +History +======= + +======= ====================================================================== +Version Changes +------- ---------------------------------------------------------------------- +v0.0.1 - Initial version (working prototype, using MIRA 3.2.1) +v0.0.2 - Improve capture of stdout/stderr (should see it as it runs) +v0.0.3 - Support Ion Torrent reads, now requires MIRA 3.4.0 or later + (some other switches changed, e.g. -OUT rrol to rrot, which + means the wrapper no longer works with MIRA 3.2.x) + - The contig summary file (TCS file) was removed in MIRA 3.4 + - Report all missing output files (not just first missing one) +v0.0.4 - Fix problem with backbone arguments inroduced in v0.0.3 +v0.0.5 - Implement the <version_command> tag to record the wrapper + version and the MIRA version being used. + - Check using MIRA 3.4 (later versions have a different API) +v0.0.6 - Tell MIRA to use /tmp for temporary files + - Tell MIRA to ignore long read names (otherwise it aborts) +v0.0.7 - Automated installation of the 64 bit Linux MIRA binary. +v0.0.8 - Basic unit test added (but commented out due to Galaxy issue). + - Link to Tool Shed added to help text and this documentation. + - Use reStructuredText for this README file. + - Adopted standard MIT licence. + - Updated citation information (Cock et al. 2013). + - Development moved to GitHub, https://github.com/peterjc/pico_galaxy +v0.0.9 - Renamed folder mira_assembler to mira3 (see also MIRA 4 wrapper). + - Correct path issue in automated dependency installation +======= ====================================================================== + + +Developers +========== + +This script and related tools were initially developed on the following hg branch: +http://bitbucket.org/peterjc/galaxy-central/src/tools + +Development has now moved to a dedicated GitHub repository: +https://github.com/peterjc/pico_galaxy/tree/master/tools/mira_3_4 + +For making the "Galaxy Tool Shed" http://toolshed.g2.bx.psu.edu/ tarball use +the following command from the Galaxy root folder:: + + $ tar -czf mira3_wrapper.tar.gz tools/mira3/README.rst tools/mira3/mira.xml tools/mira3/mira.py tools/mira3/tool_dependencies.xml test-data/tvc_mini.fastq test-data/tvc_contigs.fasta + +Check this worked:: + + $ tar -tzf mira3_wrapper.tar.gz + tools/mira3/README.rst + tools/mira3/mira.xml + tools/mira3/mira.py + tools/mira3/tool_dependencies.xml + test-data/tvc_mini.fastq + test-data/tvc_contigs.fasta + + +Licence (MIT) +============= + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. |
b |
diff -r 5573d802e431 -r a2fb1e67bd11 tools/mira3/mira.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/mira3/mira.py Thu Jan 30 13:21:21 2014 -0500 |
[ |
@@ -0,0 +1,125 @@ +#!/usr/bin/env python +"""A simple wrapper script to call MIRA and collect its output. +""" +import os +import sys +import subprocess +import shutil +import time + +WRAPPER_VER = "0.0.5" #Keep in sync with the XML file + +def stop_err(msg, err=1): + sys.stderr.write(msg+"\n") + sys.exit(err) + + +def get_version(): + """Run MIRA to find its version number""" + # At the commend line I would use: mira -v | head -n 1 + # however there is some pipe error when doing that here. + cmd = ["mira", "-v"] + try: + child = subprocess.Popen(cmd, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + except Exception, err: + sys.stderr.write("Error invoking command:\n%s\n\n%s\n" % (" ".join(cmd), err)) + sys.exit(1) + ver, tmp = child.communicate() + del child + return ver.split("\n", 1)[0] + + +mira_ver = get_version() +if "V3.4." not in mira_ver: + stop_err("This wrapper is for MIRA V3.4, not %s" % mira_ver) +if "-v" in sys.argv: + print "MIRA wrapper version %s," % WRAPPER_VER + print mira_ver + sys.exit(0) + + +def collect_output(temp, name): + n3 = (temp, name, name, name) + f = "%s/%s_assembly/%s_d_results" % (temp, name, name) + if not os.path.isdir(f): + stop_err("Missing output folder") + if not os.listdir(f): + stop_err("Empty output folder") + missing = [] + for old, new in [("%s/%s_out.unpadded.fasta" % (f, name), out_fasta), + ("%s/%s_out.unpadded.fasta.qual" % (f, name), out_qual), + ("%s/%s_out.wig" % (f, name), out_wig), + ("%s/%s_out.caf" % (f, name), out_caf), + ("%s/%s_out.ace" % (f, name), out_ace)]: + if not os.path.isfile(old): + missing.append(os.path.splitext(old)[-1]) + else: + shutil.move(old, new) + if missing: + stop_err("Missing output files: %s" % ", ".join(missing)) + +def clean_up(temp, name): + folder = "%s/%s_assembly" % (temp, name) + if os.path.isdir(folder): + shutil.rmtree(folder) + +#TODO - Run MIRA in /tmp or a configurable directory? +#Currently Galaxy puts us somewhere safe like: +#/opt/galaxy-dist/database/job_working_directory/846/ +temp = "." +name, out_fasta, out_qual, out_ace, out_caf, out_wig, out_log = sys.argv[1:8] + +start_time = time.time() +cmd_list =sys.argv[8:] +cmd = " ".join(cmd_list) + +assert os.path.isdir(temp) +d = "%s_assembly" % name +assert not os.path.isdir(d), "Path %s already exists" % d +try: + #Check path access + os.mkdir(d) +except Exception, err: + sys.stderr.write("Error making directory %s\n%s" % (d, err)) + sys.exit(1) + +#print os.path.abspath(".") +#print cmd + +handle = open(out_log, "w") +try: + #Run MIRA + child = subprocess.Popen(cmd_list, + stdout=handle, + stderr=subprocess.STDOUT) +except Exception, err: + sys.stderr.write("Error invoking command:\n%s\n\n%s\n" % (cmd, err)) + #TODO - call clean up? + handle.write("Error invoking command:\n%s\n\n%s\n" % (cmd, err)) + handle.close() + sys.exit(1) +#Use .communicate as can get deadlocks with .wait(), +stdout, stderr = child.communicate() +assert not stdout and not stderr #Should be empty as sent to handle +run_time = time.time() - start_time +return_code = child.returncode +handle.write("\n\nMIRA took %0.2f minutes\n" % (run_time / 60.0)) +print "MIRA took %0.2f minutes" % (run_time / 60.0) +if return_code: + handle.write("Return error code %i from command:\n" % return_code) + handle.write(cmd + "\n") + handle.close() + clean_up(temp, name) + stop_err("Return error code %i from command:\n%s" % (return_code, cmd), + return_code) +handle.close() + +#print "Collecting output..." +collect_output(temp, name) + +#print "Cleaning up..." +clean_up(temp, name) + +print "Done" |
b |
diff -r 5573d802e431 -r a2fb1e67bd11 tools/mira3/mira.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/mira3/mira.xml Thu Jan 30 13:21:21 2014 -0500 |
b |
b'@@ -0,0 +1,191 @@\n+<tool id="mira_assembler" name="Assemble with MIRA v3.4" version="0.0.8">\n+ <description>Takes Sanger, Roche, Illumina, and Ion Torrent data</description>\n+ <requirements>\n+ <requirement type="binary">mira</requirement>\n+ <requirement type="package" version="3.4.1.1">MIRA</requirement>\n+ </requirements>\n+ <version_command interpreter="python">mira.py -v</version_command>\n+ <command interpreter="python">mira.py mira $out_fasta $out_qual $out_ace $out_caf $out_wig $out_log\n+##Give the wrapper script list of output filenames, then the mira command...\n+mira --job=$job_method,$job_type,$job_quality\n+\n+##Input files\n+#if $condBackbone.use == "true":\n+ ## Can this be linked to job_method as well? If mapping we need the backbone...\n+ -SB:lb=1:bft=fasta -FN:bbin=${condBackbone.filename}\n+#end if\n+#if $condSanger.use == "true":\n+ SANGER_SETTINGS\n+ ## Not easy in Galaxy to add sanger to --job, so use load_sequence_data(lsd) instead\n+ ## I expect hard trimmed FASTQ files with no NCBI traceinfo XML file\n+ -LR:lsd=1:mxti=0:ft=fastq -FN:fqi=${condSanger.filename}\n+#end if\n+#if $condRoche.use == "true":\n+ 454_SETTINGS\n+ ## Not easy in Galaxy to add 454 to --job, so use load_sequence_data(lsd) instead\n+ ## I expect hard trimmed FASTQ files with no NCBI traceinfo XML file\n+ -LR:lsd=1:mxti=0:ft=fastq -FN:fqi=${condRoche.filename}\n+#end if\n+#if $condIllumina.use == "true":\n+ SOLEXA_SETTINGS\n+ ## Not easy in Galaxy to add solexa to --job, so use load_sequence_data(lsd) instead\n+ -LR:lsd=1:ft=fastq -FN:fqi=${condIllumina.filename}\n+ ##TODO - Look at -LR FASTQ qual offset (fqqo)\n+#end if\n+#if $condIonTorrent.use == "true":\n+ IONTOR_SETTINGS\n+ ## Not easy in Galaxy to add iontor to --job, so use load_sequence_data(lsd) instead\n+ ## I expect hard trimmed FASTQ files with no NCBI traceinfo XML file\n+ -LR:lsd=1:mxti=0:ft=fastq -FN:fqi=${condIonTorrent.filename}\n+#end if\n+\n+##Output files\n+COMMON_SETTINGS\n+\n+##ignore warnings about long read names\n+-MI:somrnl=0\n+\n+##Explicitly request the FASTA (+QUAL), CAF, ACE, WIG output\n+##Explicitly disable formats we won\'t use like MAF (reduce IO)\n+-OUT:orf=1:orc=1:ora=1:orw=1:orm=0:org=0:ors=0\n+\n+##remove_rollover_tmps, remove_tmp_directory\n+-OUT:rrot=1:rtd=1\n+\n+##put mira temp directory on local storage \n+-DI:trt=/tmp\n+\n+ </command>\n+ <inputs>\n+ <param name="job_method" type="select" label="Assembly method" help="Mapping mode requires backbone/reference sequence(s)">\n+ <option value="denovo">De novo</option>\n+ <option value="mapping">Mapping</option>\n+ </param>\n+ <param name="job_type" type="select" label="Assembly type">\n+ <option value="genome">Genome</option>\n+ <option value="est">EST (transcriptome)</option>\n+ </param>\n+ <param name="job_quality" type="select" label="Assembly quality grade">\n+ <option value="accurate">Accurate</option>\n+ <option value="normal">Normal (deprecated)</option>\n+ <option value="draft">Draft</option>\n+ </param>\n+ <!-- Backbone -->\n+ <conditional name="condBackbone">\n+ <param name="use" type="select" label="Backbones/reference chromosomes?" help="Required for mapping, optional for de novo assembly.">\n+ <option value="false">No</option>\n+ <option value="true">Yes</option>\n+ </param>\n+ <when value="false" />\n+ <when value="true">\n+ <!-- MIRA also allows CAF and GenBank, but Galaxy doesn\'t define those (yet) -->\n+ <param name="filename" type="data" format="fasta" label="Backbone/reference sequences" help="FASTA format" />\n+ </when>\n+ </conditional>\n+ <!-- Sanger -->\n+ <conditional name="condSanger">\n+ <param name="use" type="select" label="S'..b'th sff_extract, but will need linker sequences -->\n+ <param name="filename" type="data" format="fastq" label="Roche 454 reads file" help="FASTQ format" />\n+ </when>\n+ </conditional>\n+ <!-- Illumina -->\n+ <conditional name="condIllumina">\n+ <param name="use" type="select" label="Solexa/Illumina reads?">\n+ <option value="false">No</option>\n+ <option value="true">Yes</option>\n+ </param>\n+ <when value="false" />\n+ <when value="true">\n+ <param name="filename" type="data" format="fastq" label="Solexa/Illumina reads file" help="FASTQ format" />\n+ </when>\n+ </conditional>\n+ <!-- Ion Torrent -->\n+ <conditional name="condIonTorrent">\n+ <param name="use" type="select" label="Ion Torrent reads?">\n+ <option value="false">No</option>\n+ <option value="true">Yes</option>\n+ </param>\n+ <when value="false" />\n+ <when value="true">\n+ <!-- TODO? Support SFF files directly, e.g. with sff_extract -->\n+ <param name="filename" type="data" format="fastq" label="Ion Torrent reads file" help="FASTQ format" />\n+ </when>\n+ </conditional>\n+ </inputs>\n+ <outputs>\n+ <data name="out_fasta" format="fasta" label="MIRA contigs (FASTA)" />\n+ <data name="out_qual" format="qual454" label="MIRA contigs (QUAL)" />\n+ <data name="out_caf" format="txt" label="MIRA contigs (CAF)" />\n+ <data name="out_ace" format="txt" label="MIRA contigs (ACE)" />\n+ <data name="out_wig" format="wig" label="MIRA coverage (Wiggle)" />\n+ <data name="out_log" format="txt" label="MIRA log" />\n+ </outputs>\n+ <tests>\n+ <!-- Based on the MIRA v3.4.1.1 bundled minidemo/estdemo2 which uses\n+ strain data and miraSearchESTSNPs. Here we just assemble it. --> \n+<!--\n+Commenting out test until Galaxy framework is fixed,\n+https://trello.com/c/zSTrfDOB/820-disambiguated-conditional-parameters-not-supported-in-unit-tests\n+ <test>\n+ <param name="job_method" value="denovo" />\n+ <param name="job_type" value="est" />\n+ <param name="job_qual" value="accurate" />\n+ <param name="condBackbone.use" value="false" />\n+ <param name="condSanger.use" value="true" />\n+ <param name="condSanger.filename" value="tvc_mini.fastq" ftype="fastq" />\n+ <param name="condRoche.use" value="false" />\n+ <param name="condIllumina.use" value="false" /> \n+ <param name="condIonTorrent.use" value="false" />\n+ <output name="out_fasta" file="tvc_contigs.fasta" ftype="fasta" />\n+\t</test>\n+-->\n+ </tests>\n+ <help>\n+\n+**What it does**\n+\n+Runs MIRA v3.4, collects the output, and throws away all the temporary files.\n+\n+MIRA is an open source assembly tool capable of handling sequence data from\n+a range of platforms (Sanger capillary, Solexa/Illumina, Roche 454 and also\n+Ion Torrent).\n+\n+It is particularly suited to small genomes such as bacteria.\n+\n+**Citation**\n+\n+If you use this Galaxy tool in work leading to a scientific publication please\n+cite the following papers:\n+\n+Peter J.A. Cock, Bj\xc3\xb6rn A. Gr\xc3\xbcning, Konrad Paszkiewicz and Leighton Pritchard (2013).\n+Galaxy tools and workflows for sequence analysis with applications\n+in molecular plant pathology. PeerJ 1:e167\n+http://dx.doi.org/10.7717/peerj.167\n+\n+Bastien Chevreux, Thomas Wetter and S\xc3\xa1ndor Suhai (1999).\n+Genome Sequence Assembly Using Trace Signals and Additional Sequence Information.\n+Computer Science and Biology: Proceedings of the German Conference on Bioinformatics (GCB) 99, pp. 45-56.\n+http://www.bioinfo.de/isb/gcb99/talks/chevreux/main.html\n+\n+This wrapper is available to install into other Galaxy Instances via the Galaxy\n+Tool Shed at http://toolshed.g2.bx.psu.edu/view/peterjc/mira_assembler \n+\n+ </help>\n+</tool>\n' |
b |
diff -r 5573d802e431 -r a2fb1e67bd11 tools/mira3/tool_dependencies.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/mira3/tool_dependencies.xml Thu Jan 30 13:21:21 2014 -0500 |
b |
@@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<tool_dependency> + <package name="MIRA" version="3.4.1.1"> + <install version="1.0"> + <actions> + <!-- Sourceforge doesn't offer nice clean download URLs which is a shame --> + <action type="download_by_url">http://downloads.sourceforge.net/project/mira-assembler/MIRA/stable/mira_3.4.1.1_prod_linux-gnu_x86_64_static.tar.bz2</action> + <action type="move_directory_files"> + <source_directory>bin</source_directory> + <destination_directory>$INSTALL_DIR</destination_directory> + </action> + <action type="set_environment"> + <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR</environment_variable> + </action> + </actions> + </install> + <readme> +Downloads MIRA v3.4 from Sourceforge, requesting Bastien's precompiled binaries +for 64bit Linux (x86_64). He also has binaries for 32bit Linux, which we could +use once the Galaxy installation framework allow that kind of flexibility. + +http://chevreux.org/projects_mira.html +http://sourceforge.net/projects/mira-assembler/ + </readme> + </package> +</tool_dependency> + |
b |
diff -r 5573d802e431 -r a2fb1e67bd11 tools/mira_3_4/README.rst --- a/tools/mira_3_4/README.rst Wed Sep 18 06:22:19 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,123 +0,0 @@ -Galaxy tool to wrap the MIRA sequence assembly program (v3.4) -============================================================= - -This tool is copyright 2011-2013 by Peter Cock, The James Hutton Institute -(formerly SCRI, Scottish Crop Research Institute), UK. All rights reserved. -See the licence text below (MIT licence). - -This tool is a short Python script (to collect the MIRA output and move it -to where Galaxy expects the files, and convert MIRA's TCS file into a tab -separated file for use in Galaxy). - -It is available from the Galaxy Tool Shed at: -http://toolshed.g2.bx.psu.edu/view/peterjc/mira_assembler - - -Automated Installation -====================== - -This should be straightforward, Galaxy should automatically download and -install the precompiled binary for MIRA v3.4.0 for the Galaxy wrapper, -and run any tests. - - -Manual Installation -=================== - -There are just two Galaxy files to install: - -* mira.py (the Python script) -* mira.xml (the Galaxy tool definition) - -The suggested location is a new tools/mira_3_4 folder. You will also need to -modify the tools_conf.xml file to tell Galaxy to offer the tool, and also do -this to tools_conf.xml.sample in order to run any tests:: - - <tool file="mira_3_4/mira.xml" /> - -You will also need to install MIRA, we used version 3.4.1.1. See: - -* http://chevreux.org/projects_mira.html -* http://sourceforge.net/projects/mira-assembler/ - -WARNING: This tool was developed to construct viral genome assembly and -mapping pipelines, for which the run time and memory requirements are -negligible. For larger tasks, be aware that MIRA can require vast amounts -of RAM and run-times of over a week are possible. This tool wrapper makes -no attempt to spot and reject such large jobs. - - -History -======= - -======= ====================================================================== -Version Changes -------- ---------------------------------------------------------------------- -v0.0.1 - Initial version (working prototype, using MIRA 3.2.1) -v0.0.2 - Improve capture of stdout/stderr (should see it as it runs) -v0.0.3 - Support Ion Torrent reads, now requires MIRA 3.4.0 or later - (some other switches changed, e.g. -OUT rrol to rrot, which - means the wrapper no longer works with MIRA 3.2.x) - - The contig summary file (TCS file) was removed in MIRA 3.4 - - Report all missing output files (not just first missing one) -v0.0.4 - Fix problem with backbone arguments inroduced in v0.0.3 -v0.0.5 - Implement the <version_command> tag to record the wrapper - version and the MIRA version being used. - - Check using MIRA 3.4 (later versions have a different API) -v0.0.6 - Tell MIRA to use /tmp for temporary files - - Tell MIRA to ignore long read names (otherwise it aborts) -v0.0.7 - Automated installation of the 64 bit Linux MIRA binary. -v0.0.8 - Basic unit test added (but commented out due to Galaxy issue). - - Link to Tool Shed added to help text and this documentation. - - Use reStructuredText for this README file. - - Adopted standard MIT licence. - - Updated citation information (Cock et al. 2013). - - Development moved to GitHub, https://github.com/peterjc/pico_galaxy -======= ====================================================================== - - -Developers -========== - -This script and related tools were initially developed on the following hg branch: -http://bitbucket.org/peterjc/galaxy-central/src/tools - -Development has now moved to a dedicated GitHub repository: -https://github.com/peterjc/pico_galaxy/tree/master/tools/mira_3_4 - -For making the "Galaxy Tool Shed" http://toolshed.g2.bx.psu.edu/ tarball use -the following command from the Galaxy root folder:: - - $ tar -czf mira_wrapper.tar.gz tools/mira_3_4/README.rst tools/mira_3_4/mira.xml tools/mira_3_4/mira.py tools/mira_3_4/tool_dependencies.xml test-data/tvc_mini.fastq test-data/tvc_contigs.fasta - -Check this worked:: - - $ tar -tzf mira_wrapper.tar.gz - tools/mira_3_4/README.rst - tools/mira_3_4/mira.xml - tools/mira_3_4/mira.py - tools/mira_3_4/tool_dependencies.xml - test-data/tvc_mini.fastq - test-data/tvc_contigs.fasta - - -Licence (MIT) -============= - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. |
b |
diff -r 5573d802e431 -r a2fb1e67bd11 tools/mira_3_4/mira.py --- a/tools/mira_3_4/mira.py Wed Sep 18 06:22:19 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,124 +0,0 @@ -#!/usr/bin/env python -"""A simple wrapper script to call MIRA and collect its output. -""" -import os -import sys -import subprocess -import shutil -import time - -WRAPPER_VER = "0.0.5" #Keep in sync with the XML file - -def stop_err(msg, err=1): - sys.stderr.write(msg+"\n") - sys.exit(err) - - -def get_version(): - """Run MIRA to find its version number""" - # At the commend line I would use: mira -v | head -n 1 - # however there is some pipe error when doing that here. - try: - child = subprocess.Popen(["mira", "-v"], - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) - except Exception, err: - sys.stderr.write("Error invoking command:\n%s\n\n%s\n" % (" ".join(cmd), err)) - sys.exit(1) - ver, tmp = child.communicate() - del child - return ver.split("\n", 1)[0] - - -mira_ver = get_version() -if "V3.4." not in mira_ver: - stop_err("This wrapper is for MIRA V3.4, not %s" % mira_ver) -if "-v" in sys.argv: - print "MIRA wrapper version %s," % WRAPPER_VER - print mira_ver - sys.exit(0) - - -def collect_output(temp, name): - n3 = (temp, name, name, name) - f = "%s/%s_assembly/%s_d_results" % (temp, name, name) - if not os.path.isdir(f): - stop_err("Missing output folder") - if not os.listdir(f): - stop_err("Empty output folder") - missing = [] - for old, new in [("%s/%s_out.unpadded.fasta" % (f, name), out_fasta), - ("%s/%s_out.unpadded.fasta.qual" % (f, name), out_qual), - ("%s/%s_out.wig" % (f, name), out_wig), - ("%s/%s_out.caf" % (f, name), out_caf), - ("%s/%s_out.ace" % (f, name), out_ace)]: - if not os.path.isfile(old): - missing.append(os.path.splitext(old)[-1]) - else: - shutil.move(old, new) - if missing: - stop_err("Missing output files: %s" % ", ".join(missing)) - -def clean_up(temp, name): - folder = "%s/%s_assembly" % (temp, name) - if os.path.isdir(folder): - shutil.rmtree(folder) - -#TODO - Run MIRA in /tmp or a configurable directory? -#Currently Galaxy puts us somewhere safe like: -#/opt/galaxy-dist/database/job_working_directory/846/ -temp = "." -name, out_fasta, out_qual, out_ace, out_caf, out_wig, out_log = sys.argv[1:8] - -start_time = time.time() -cmd_list =sys.argv[8:] -cmd = " ".join(cmd_list) - -assert os.path.isdir(temp) -d = "%s_assembly" % name -assert not os.path.isdir(d), "Path %s already exists" % d -try: - #Check path access - os.mkdir(d) -except Exception, err: - sys.stderr.write("Error making directory %s\n%s" % (d, err)) - sys.exit(1) - -#print os.path.abspath(".") -#print cmd - -handle = open(out_log, "w") -try: - #Run MIRA - child = subprocess.Popen(cmd_list, - stdout=handle, - stderr=subprocess.STDOUT) -except Exception, err: - sys.stderr.write("Error invoking command:\n%s\n\n%s\n" % (cmd, err)) - #TODO - call clean up? - handle.write("Error invoking command:\n%s\n\n%s\n" % (cmd, err)) - handle.close() - sys.exit(1) -#Use .communicate as can get deadlocks with .wait(), -stdout, stderr = child.communicate() -assert not stdout and not stderr #Should be empty as sent to handle -run_time = time.time() - start_time -return_code = child.returncode -handle.write("\n\nMIRA took %0.2f minutes\n" % (run_time / 60.0)) -print "MIRA took %0.2f minutes" % (run_time / 60.0) -if return_code: - handle.write("Return error code %i from command:\n" % return_code) - handle.write(cmd + "\n") - handle.close() - clean_up(temp, name) - stop_err("Return error code %i from command:\n%s" % (return_code, cmd), - return_code) -handle.close() - -#print "Collecting output..." -collect_output(temp, name) - -#print "Cleaning up..." -clean_up(temp, name) - -print "Done" |
b |
diff -r 5573d802e431 -r a2fb1e67bd11 tools/mira_3_4/mira.xml --- a/tools/mira_3_4/mira.xml Wed Sep 18 06:22:19 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
b'@@ -1,191 +0,0 @@\n-<tool id="mira_assembler" name="Assemble with MIRA v3.4" version="0.0.8">\n- <description>Takes Sanger, Roche, Illumina, and Ion Torrent data</description>\n- <requirements>\n- <requirement type="python-module">Bio</requirement>\n- <requirement type="binary">mira</requirement>\n- <requirement type="package" version="3.4.1.1">MIRA</requirement>\n- </requirements>\n- <version_command interpreter="python">mira.py -v</version_command>\n- <command interpreter="python">mira.py mira $out_fasta $out_qual $out_ace $out_caf $out_wig $out_log\n-##Give the wrapper script list of output filenames, then the mira command...\n-mira --job=$job_method,$job_type,$job_quality\n-\n-##Input files\n-#if $condBackbone.use == "true":\n- ## Can this be linked to job_method as well? If mapping we need the backbone...\n- -SB:lb=1:bft=fasta -FN:bbin=${condBackbone.filename}\n-#end if\n-#if $condSanger.use == "true":\n- SANGER_SETTINGS\n- ## Not easy in Galaxy to add sanger to --job, so use load_sequence_data(lsd) instead\n- ## I expect hard trimmed FASTQ files with no NCBI traceinfo XML file\n- -LR:lsd=1:mxti=0:ft=fastq -FN:fqi=${condSanger.filename}\n-#end if\n-#if $condRoche.use == "true":\n- 454_SETTINGS\n- ## Not easy in Galaxy to add 454 to --job, so use load_sequence_data(lsd) instead\n- ## I expect hard trimmed FASTQ files with no NCBI traceinfo XML file\n- -LR:lsd=1:mxti=0:ft=fastq -FN:fqi=${condRoche.filename}\n-#end if\n-#if $condIllumina.use == "true":\n- SOLEXA_SETTINGS\n- ## Not easy in Galaxy to add solexa to --job, so use load_sequence_data(lsd) instead\n- -LR:lsd=1:ft=fastq -FN:fqi=${condIllumina.filename}\n- ##TODO - Look at -LR FASTQ qual offset (fqqo)\n-#end if\n-#if $condIonTorrent.use == "true":\n- IONTOR_SETTINGS\n- ## Not easy in Galaxy to add iontor to --job, so use load_sequence_data(lsd) instead\n- ## I expect hard trimmed FASTQ files with no NCBI traceinfo XML file\n- -LR:lsd=1:mxti=0:ft=fastq -FN:fqi=${condIonTorrent.filename}\n-#end if\n-\n-##Output files\n-COMMON_SETTINGS\n-\n-##ignore warnings about long read names\n--MI:somrnl=0\n-\n-##Explicitly request the FASTA (+QUAL), CAF, ACE, WIG output\n-##Explicitly disable formats we won\'t use like MAF (reduce IO)\n--OUT:orf=1:orc=1:ora=1:orw=1:orm=0:org=0:ors=0\n-\n-##remove_rollover_tmps, remove_tmp_directory\n--OUT:rrot=1:rtd=1\n-\n-##put mira temp directory on local storage \n--DI:trt=/tmp\n-\n- </command>\n- <inputs>\n- <param name="job_method" type="select" label="Assembly method" help="Mapping mode requires backbone/reference sequence(s)">\n- <option value="denovo">De novo</option>\n- <option value="mapping">Mapping</option>\n- </param>\n- <param name="job_type" type="select" label="Assembly type">\n- <option value="genome">Genome</option>\n- <option value="est">EST (transcriptome)</option>\n- </param>\n- <param name="job_quality" type="select" label="Assembly quality grade">\n- <option value="accurate">Accurate</option>\n- <option value="normal">Normal (deprecated)</option>\n- <option value="draft">Draft</option>\n- </param>\n- <!-- Backbone -->\n- <conditional name="condBackbone">\n- <param name="use" type="select" label="Backbones/reference chromosomes?" help="Required for mapping, optional for de novo assembly.">\n- <option value="false">No</option>\n- <option value="true">Yes</option>\n- </param>\n- <when value="false" />\n- <when value="true">\n- <!-- MIRA also allows CAF and GenBank, but Galaxy doesn\'t define those (yet) -->\n- <param name="filename" type="data" format="fasta" label="Backbone/reference sequences" help="FASTA format" />\n- </when>\n- </conditional>\n- <!-- Sanger -->\n- <conditional name="cond'..b' <when value="true">\n- <!-- TODO? Support SFF files directly, e.g. with sff_extract, but will need linker sequences -->\n- <param name="filename" type="data" format="fastq" label="Roche 454 reads file" help="FASTQ format" />\n- </when>\n- </conditional>\n- <!-- Illumina -->\n- <conditional name="condIllumina">\n- <param name="use" type="select" label="Solexa/Illumina reads?">\n- <option value="false">No</option>\n- <option value="true">Yes</option>\n- </param>\n- <when value="false" />\n- <when value="true">\n- <param name="filename" type="data" format="fastq" label="Solexa/Illumina reads file" help="FASTQ format" />\n- </when>\n- </conditional>\n- <!-- Ion Torrent -->\n- <conditional name="condIonTorrent">\n- <param name="use" type="select" label="Ion Torrent reads?">\n- <option value="false">No</option>\n- <option value="true">Yes</option>\n- </param>\n- <when value="false" />\n- <when value="true">\n- <!-- TODO? Support SFF files directly, e.g. with sff_extract -->\n- <param name="filename" type="data" format="fastq" label="Ion Torrent reads file" help="FASTQ format" />\n- </when>\n- </conditional>\n- </inputs>\n- <outputs>\n- <data name="out_fasta" format="fasta" label="MIRA contigs (FASTA)" />\n- <data name="out_qual" format="qual454" label="MIRA contigs (QUAL)" />\n- <data name="out_caf" format="txt" label="MIRA contigs (CAF)" />\n- <data name="out_ace" format="txt" label="MIRA contigs (ACE)" />\n- <data name="out_wig" format="wig" label="MIRA coverage (Wiggle)" />\n- <data name="out_log" format="txt" label="MIRA log" />\n- </outputs>\n- <tests>\n- <!-- Based on the MIRA v3.4.1.1 bundled minidemo/estdemo2 which uses\n- strain data and miraSearchESTSNPs. Here we just assemble it. --> \n-<!--\n-Commenting out test until Galaxy framework is fixed,\n-https://trello.com/c/zSTrfDOB/820-disambiguated-conditional-parameters-not-supported-in-unit-tests\n- <test>\n- <param name="job_method" value="denovo" />\n- <param name="job_type" value="est" />\n- <param name="job_qual" value="accurate" />\n- <param name="condBackbone.use" value="false" />\n- <param name="condSanger.use" value="true" />\n- <param name="condSanger.filename" value="tvc_mini.fastq" ftype="fastq" />\n- <param name="condRoche.use" value="false" />\n- <param name="condIllumina.use" value="false" /> \n- <param name="condIonTorrent.use" value="false" />\n- <output name="out_fasta" file="tvc_contigs.fasta" ftype="fasta" />\n-\t</test>\n--->\n- </tests>\n- <help>\n-\n-**What it does**\n-\n-Runs MIRA v3.4, collects the output, and throws away all the temporary files.\n-\n-MIRA is an open source assembly tool capable of handling sequence data from\n-a range of platforms (Sanger capillary, Solexa/Illumina, Roche 454 and also\n-Ion Torrent).\n-\n-It is particularly suited to small genomes such as bacteria.\n-\n-**Citation**\n-\n-If you use this Galaxy tool in work leading to a scientific publication please\n-cite the following papers:\n-\n-Peter J.A. Cock, Bj\xc3\xb6rn A. Gr\xc3\xbcning, Konrad Paszkiewicz and Leighton Pritchard (2013).\n-Galaxy tools and workflows for sequence analysis with applications\n-in molecular plant pathology. PeerJ 1:e167\n-http://dx.doi.org/10.7717/peerj.167\n-\n-Chevreux et al. (1999).\n-Genome Sequence Assembly Using Trace Signals and Additional Sequence Information.\n-Computer Science and Biology: Proceedings of the German Conference on Bioinformatics (GCB) 99, pp. 45-56.\n-\n-This wrapper is available to install into other Galaxy Instances via the Galaxy\n-Tool Shed at http://toolshed.g2.bx.psu.edu/view/peterjc/mira_assembler \n-\n- </help>\n-</tool>\n' |
b |
diff -r 5573d802e431 -r a2fb1e67bd11 tools/mira_3_4/tool_dependencies.xml --- a/tools/mira_3_4/tool_dependencies.xml Wed Sep 18 06:22:19 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<tool_dependency> - <package name="MIRA" version="3.4.1.1"> - <install version="1.0"> - <actions> - <!-- Sourceforge doesn't offer nice clean download URLs which is a shame --> - <action type="download_by_url">http://downloads.sourceforge.net/project/mira-assembler/MIRA/stable/mira_3.4.1.1_prod_linux-gnu_x86_64_static.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmira-assembler%2Ffiles%2FMIRA%2Fstable%2F&ts=1366819213&use_mirror=kent</action> - <!-- Currently we only need the main binary itself, mira --> - <action type="move_file"><source>mira_3.4.1.1_prod_linux-gnu_x86_64_static/bin/mira</source><destination>$INSTALL_DIR/</destination></action> - <action type="set_environment"> - <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR</environment_variable> - </action> - </actions> - </install> - <readme> -Downloads MIRA v3.4 from Sourceforge, requesting Bastien's precompiled binaries -for 64bit Linux (x86_64). He also has binaries for 32bit Linux, which we could -use if/when the Galaxy installation framework allow that kind of flexibility. - -http://chevreux.org/projects_mira.html -http://sourceforge.net/projects/mira-assembler/ - </readme> - </package> -</tool_dependency> - |