# HG changeset patch # User peterjc # Date 1495128968 14400 # Node ID 56b421d598059d64ab0dc9ef57c9b05b6bfd00d5 # Parent fd95aaef881836be9ce3dc8990156fae0da49c30 planemo upload for repository https://github.com/peterjc/galaxy_mira/tree/master/tools/mira4_0 commit fd979d17340cde155de176604744831d9597c6b6 diff -r fd95aaef8818 -r 56b421d59805 tools/mira4_0/README.rst --- a/tools/mira4_0/README.rst Wed Feb 10 09:07:39 2016 -0500 +++ b/tools/mira4_0/README.rst Thu May 18 13:36:08 2017 -0400 @@ -1,7 +1,7 @@ Galaxy wrapper for the MIRA assembly program (v4.0) =================================================== -This tool is copyright 2011-2015 by Peter Cock, The James Hutton Institute +This tool is copyright 2011-2016 by Peter Cock, The James Hutton Institute (formerly SCRI, Scottish Crop Research Institute), UK. All rights reserved. See the licence text below (MIT licence). @@ -21,7 +21,7 @@ ====================== This should be straightforward. Via the Tool Shed, Galaxy should automatically -install the ``mira`` datatype, samtools, and download and install the precompiled +install the 'mira' datatype, samtools, and download and install the precompiled binary for MIRA v4.0.2 for the Galaxy wrapper, and run any tests. For MIRA 4, the Galaxy wrapper has been split in two, allowing separate @@ -106,7 +106,11 @@ - MIRA 4.0.2 dependency now declared via dedicated Tool Shed package. v0.0.8 - Renamed folder now have a MIRA 4.9.x wrapper (internal change only). v0.0.9 - Additional unit tests now covering ``miraconvert``. - - Was missing ``mirabait`` wrapper since move to using Planemo. + - Re-include missing ``mirabait`` wrapper (accidentally left out when + changed to using Planemo for uploading to the Tool Shed). +v0.0.10 - Python 3 compatible syntax (internal change only). + - Use ```` (internal change only). + - Single quote command line arguments (internal change only). ======= ====================================================================== diff -r fd95aaef8818 -r 56b421d59805 tools/mira4_0/mira4.py --- a/tools/mira4_0/mira4.py Wed Feb 10 09:07:39 2016 -0500 +++ b/tools/mira4_0/mira4.py Thu May 18 13:36:08 2017 -0400 @@ -1,22 +1,26 @@ #!/usr/bin/env python """A simple wrapper script to call MIRA and collect its output. """ + +from __future__ import print_function + import os -import sys +import shutil import subprocess -import shutil +import sys +import tempfile import time -import tempfile + from optparse import OptionParser -#Do we need any PYTHONPATH magic? +# Do we need any PYTHONPATH magic? from mira4_make_bam import make_bam -WRAPPER_VER = "0.0.4" #Keep in sync with the XML file +WRAPPER_VER = "0.0.10" # Keep in sync with the XML file def get_version(mira_binary): - """Run MIRA to find its version number""" + """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_binary, "-v"] @@ -24,14 +28,15 @@ child = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - except Exception, err: + except Exception as 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].strip() -#Parse Command Line + +# Parse Command Line usage = """Galaxy MIRA4 wrapper script v%s - use as follows: $ python mira4.py ... @@ -84,9 +89,9 @@ if not mira_convert_ver.strip().startswith("4.0"): sys.exit("This wrapper is for MIRA V4.0, not:\n%s\n%s" % (mira_ver, mira_convert)) if options.version: - print "%s, MIRA wrapper version %s" % (mira_ver, WRAPPER_VER) + print("%s, MIRA wrapper version %s" % (mira_ver, WRAPPER_VER)) if mira_ver != mira_convert_ver: - print "WARNING: miraconvert %s" % mira_convert_ver + print("WARNING: miraconvert %s" % mira_convert_ver) sys.exit(0) if not manifest: @@ -121,12 +126,12 @@ text = handle.read() handle.close() - #At time of writing, this is at the end of a file, - #but could be followed by a space in future... + # At time of writing, this is at the end of a file, + # but could be followed by a space in future... text = text.replace("-DI:trt=/tmp", "-DI:trt=" + tempfile.gettempdir()) - #Want to try to ensure this gets written to disk before MIRA attempts - #to open it - any networked file system may impose a delay... + # Want to try to ensure this gets written to disk before MIRA attempts + # to open it - any networked file system may impose a delay... handle = open(manifest, "w") handle.write(text) handle.flush() @@ -136,11 +141,11 @@ def log_manifest(manifest): """Write the manifest file to stderr.""" - sys.stderr.write("\n%s\nManifest file\n%s\n" % ("="*60, "="*60)) + sys.stderr.write("\n%s\nManifest file\n%s\n" % ("=" * 60, "=" * 60)) with open(manifest) as h: for line in h: sys.stderr.write(line) - sys.stderr.write("\n%s\nEnd of manifest\n%s\n" % ("="*60, "="*60)) + sys.stderr.write("\n%s\nEnd of manifest\n%s\n" % ("=" * 60, "=" * 60)) def collect_output(temp, name, handle): @@ -156,20 +161,19 @@ old_maf = "%s/%s_out.maf" % (f, name) if not os.path.isfile(old_maf): - #Triggered extractLargeContigs.sh? + # Triggered extractLargeContigs.sh? old_maf = "%s/%s_LargeContigs_out.maf" % (f, name) - #De novo or single strain mapping, + # De novo or single strain mapping, old_fasta = "%s/%s_out.unpadded.fasta" % (f, name) ref_fasta = "%s/%s_out.padded.fasta" % (f, name) if not os.path.isfile(old_fasta): - #Mapping (StrainX versus reference) or de novo + # Mapping (StrainX versus reference) or de novo old_fasta = "%s/%s_out_StrainX.unpadded.fasta" % (f, name) ref_fasta = "%s/%s_out_StrainX.padded.fasta" % (f, name) if not os.path.isfile(old_fasta): old_fasta = "%s/%s_out_ReferenceStrain.unpadded.fasta" % (f, name) ref_fasta = "%s/%s_out_ReferenceStrain.padded.fasta" % (f, name) - missing = False for old, new in [(old_maf, out_maf), @@ -187,25 +191,27 @@ for filename in sorted(os.listdir(f)): sys.stderr.write("%s\n" % filename) - #For mapping mode, probably most people would expect a BAM file - #using the reference FASTA file... + # For mapping mode, probably most people would expect a BAM file + # using the reference FASTA file... if out_bam and out_bam != "-": if out_maf and out_maf != "-": msg = make_bam(mira_convert, out_maf, ref_fasta, out_bam, handle) else: - #Not collecting the MAF file, use original location + # Not collecting the MAF file, use original location msg = make_bam(mira_convert, old_maf, ref_fasta, out_bam, handle) if msg: sys.exit(msg) + 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/ + +# 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 = "MIRA" @@ -218,19 +224,19 @@ assert os.path.isdir(temp) d = "%s_assembly" % name -#This can fail on my development machine if stale folders exist -#under Galaxy's .../database/job_working_directory/ tree: +# This can fail on my development machine if stale folders exist +# under Galaxy's .../database/job_working_directory/ tree: assert not os.path.isdir(d), "Path %r already exists:\n%s" % (d, os.path.abspath(d)) try: - #Check path access + # Check path access os.mkdir(d) -except Exception, err: +except Exception as err: log_manifest(manifest) sys.stderr.write("Error making directory %s\n%s" % (d, err)) sys.exit(1) -#print os.path.abspath(".") -#print cmd +# print(os.path.abspath(".")) +# print(cmd) if out_log and out_log != "-": handle = open(out_log, "w") @@ -246,27 +252,27 @@ handle.write("============================ Starting MIRA now ===============================\n") handle.flush() try: - #Run MIRA + # Run MIRA child = subprocess.Popen(cmd_list, stdout=handle, stderr=subprocess.STDOUT) -except Exception, err: +except Exception as err: log_manifest(manifest) sys.stderr.write("Error invoking command:\n%s\n\n%s\n" % (cmd, err)) - #TODO - call clean up? + # 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(), +# 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 +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") handle.write("============================ MIRA has finished ===============================\n") handle.write("MIRA took %0.2f hours\n" % (run_time / 3600.0)) if return_code: - print "MIRA took %0.2f hours" % (run_time / 3600.0) + print("MIRA took %0.2f hours" % (run_time / 3600.0)) handle.write("Return error code %i from command:\n" % return_code) handle.write(cmd + "\n") handle.close() @@ -274,7 +280,7 @@ log_manifest(manifest) sys.stderr.write("Return error code %i from command:\n" % return_code) sys.stderr.write(cmd + "\n") - sys.exit(eturn_code) + sys.exit(return_code) handle.flush() if os.path.isfile("MIRA_assembly/MIRA_d_results/ec.log"): @@ -287,21 +293,23 @@ handle.write("============================ (end of ec.log) =================================\n") handle.flush() -#print "Collecting output..." +# print("Collecting output...") start_time = time.time() collect_output(temp, name, handle) collect_time = time.time() - start_time -handle.write("MIRA took %0.2f hours; collecting output %0.2f minutes\n" % (run_time / 3600.0, collect_time / 60.0)) -print("MIRA took %0.2f hours; collecting output %0.2f minutes\n" % (run_time / 3600.0, collect_time / 60.0)) +handle.write("MIRA took %0.2f hours; collecting output %0.2f minutes\n" + % (run_time / 3600.0, collect_time / 60.0)) +print("MIRA took %0.2f hours; collecting output %0.2f minutes\n" + % (run_time / 3600.0, collect_time / 60.0)) if os.path.isfile("MIRA_assembly/MIRA_d_results/ec.log"): - #Treat as an error, but doing this AFTER collect_output + # Treat as an error, but doing this AFTER collect_output sys.stderr.write("Extract Large Contigs failed\n") handle.write("Extract Large Contigs failed\n") handle.close() sys.exit(1) -#print "Cleaning up..." +# print "Cleaning up..." clean_up(temp, name) handle.write("\nDone\n") diff -r fd95aaef8818 -r 56b421d59805 tools/mira4_0/mira4_bait.py --- a/tools/mira4_0/mira4_bait.py Wed Feb 10 09:07:39 2016 -0500 +++ b/tools/mira4_0/mira4_bait.py Thu May 18 13:36:08 2017 -0400 @@ -1,13 +1,16 @@ #!/usr/bin/env python """A simple wrapper script to call MIRA4's mirabait and collect its output. """ + +from __future__ import print_function + import os +import shutil +import subprocess import sys -import subprocess -import shutil import time -WRAPPER_VER = "0.0.5" #Keep in sync with the XML file +WRAPPER_VER = "0.0.10" # Keep in sync with the XML file def get_version(mira_binary): @@ -19,20 +22,21 @@ child = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - except Exception, err: + except Exception as 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 - #Workaround for -v not working in mirabait 4.0RC4 + # Workaround for -v not working in mirabait 4.0RC4 if "invalid option" in ver.split("\n", 1)[0]: for line in ver.split("\n", 1): if " version " in line: line = line.split() - return line[line.index("version")+1].rstrip(")") + return line[line.index("version") + 1].rstrip(")") sys.exit("Could not determine MIRA version:\n%s" % ver) return ver.split("\n", 1)[0] + try: mira_path = os.environ["MIRA4"] except KeyError: @@ -45,7 +49,7 @@ if not mira_ver.strip().startswith("4.0"): sys.exit("This wrapper is for MIRA V4.0, not:\n%s" % mira_ver) if "-v" in sys.argv or "--version" in sys.argv: - print "%s, MIRA wrapper version %s" % (mira_ver, WRAPPER_VER) + print("%s, MIRA wrapper version %s" % (mira_ver, WRAPPER_VER)) sys.exit(0) @@ -67,42 +71,42 @@ if output_choice == "pos": pass elif output_choice == "neg": - #Invert the selection... + # Invert the selection... cmd_list.insert(1, "-i") else: sys.exit("Output choice should be 'pos' or 'neg', not %r" % output_choice) if strand_choice == "both": pass elif strand_choice == "fwd": - #Ingore reverse strand... + # Ingore reverse strand... cmd_list.insert(1, "-r") else: sys.exit("Strand choice should be 'both' or 'fwd', not %r" % strand_choice) cmd = " ".join(cmd_list) -#print cmd +# print cmd start_time = time.time() try: - #Run MIRA + # Run MIRA child = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) -except Exception, err: +except Exception as err: sys.stderr.write("Error invoking command:\n%s\n\n%s\n" % (cmd, err)) sys.exit(1) -#Use .communicate as can get deadlocks with .wait(), +# Use .communicate as can get deadlocks with .wait(), stdout, stderr = child.communicate() -assert stderr is None # Due to way we ran with subprocess +assert stderr is None # Due to way we ran with subprocess run_time = time.time() - start_time return_code = child.returncode -print "mirabait took %0.2f minutes" % (run_time / 60.0) +print("mirabait took %0.2f minutes" % (run_time / 60.0)) if return_code: sys.stderr.write(stdout) sys.exit("Return error code %i from command:\n%s" % (return_code, cmd), return_code) -#Capture output +# Capture output out_tmp = out_file_stem + "." + format if not os.path.isfile(out_tmp): sys.stderr.write(stdout) diff -r fd95aaef8818 -r 56b421d59805 tools/mira4_0/mira4_bait.xml --- a/tools/mira4_0/mira4_bait.xml Wed Feb 10 09:07:39 2016 -0500 +++ b/tools/mira4_0/mira4_bait.xml Thu May 18 13:36:08 2017 -0400 @@ -1,21 +1,17 @@ - + Filter reads using kmer matches - mirabait MIRA - - - - - - mira4_bait.py --version - -mira4_bait.py $input_reads.ext $output_choice $strand_choice $kmer_length $min_occurence "$bait_file" "$input_reads" "$output_reads" + +python $__tool_directory__/mira4_bait.py --version + + +python $__tool_directory__/mira4_bait.py $input_reads.ext $output_choice $strand_choice $kmer_length $min_occurence '$bait_file' '$input_reads' '$output_reads' - - + + @@ -32,7 +28,7 @@ + label="$input_reads.name #if str($output_choice)=='pos' then 'matching' else 'excluding matches to' # $bait_file.name"/> diff -r fd95aaef8818 -r 56b421d59805 tools/mira4_0/mira4_convert.py --- a/tools/mira4_0/mira4_convert.py Wed Feb 10 09:07:39 2016 -0500 +++ b/tools/mira4_0/mira4_convert.py Thu May 18 13:36:08 2017 -0400 @@ -3,31 +3,36 @@ This focuses on the miraconvert binary. """ + +from __future__ import print_function + import os -import sys +import shutil import subprocess -import shutil +import sys + from optparse import OptionParser + try: from io import BytesIO except ImportError: - #Should we worry about Python 2.5 or older? + # Should we worry about Python 2.5 or older? from StringIO import StringIO as BytesIO -#Do we need any PYTHONPATH magic? +# Do we need any PYTHONPATH magic? from mira4_make_bam import depad -WRAPPER_VER = "0.0.7" # Keep in sync with the XML file +WRAPPER_VER = "0.0.10" # Keep in sync with the XML file 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: + except Exception as err: sys.exit("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: @@ -37,6 +42,7 @@ else: sys.exit("Return code %i from command:\n%s\n%s" % (return_code, cmd_str, stderr)) + def get_version(mira_binary): """Run MIRA to find its version number""" # At the commend line I would use: mira -v | head -n 1 @@ -46,14 +52,15 @@ child = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - except Exception, err: + except Exception as 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].strip() -#Parse Command Line + +# Parse Command Line usage = """Galaxy MIRA4 wrapper script v%s - use as follows: $ python mira4_convert.py ... @@ -136,13 +143,14 @@ sys.exit("Negative %s setting, %r" % (name, value)) return i + min_length = check_min_int(options.min_length, "minimum length") min_cover = check_min_int(options.min_cover, "minimum cover") min_reads = check_min_int(options.min_reads, "minimum reads") -#TODO - Run MIRA in /tmp or a configurable directory? -#Currently Galaxy puts us somewhere safe like: -#/opt/galaxy-dist/database/job_working_directory/846/ +# 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 = "." @@ -159,7 +167,7 @@ if out_bam: cmd_list.append("samnbb") if not out_fasta: - #Need this for samtools depad + # Need this for samtools depad out_fasta = os.path.join(temp, "depadded.fasta") if out_fasta: cmd_list.append("fasta") @@ -169,20 +177,22 @@ cmd_list.append("cstats") run(cmd_list) + def collect(old, new): if not os.path.isfile(old): sys.exit("Missing expected output file %s" % old) shutil.move(old, new) + if out_maf: collect(os.path.join(temp, "converted.maf"), out_maf) if out_fasta: - #Can we look at the MAF file to see if there are multiple strains? + # Can we look at the MAF file to see if there are multiple strains? old = os.path.join(temp, "converted_AllStrains.unpadded.fasta") if os.path.isfile(old): collect(old, out_fasta) else: - #Might the output be filtered down to zero contigs? + # Might the output be filtered down to zero contigs? old = os.path.join(temp, "converted.fasta") if not os.path.isfile(old): sys.exit("Missing expected output FASTA file") @@ -212,7 +222,7 @@ sys.exit(1) h.close() if out_fasta == os.path.join(temp, "depadded.fasta"): - #Not asked for by Galaxy, no longer needed + # Not asked for by Galaxy, no longer needed os.remove(out_fasta) if min_length or min_cover or min_reads: diff -r fd95aaef8818 -r 56b421d59805 tools/mira4_0/mira4_de_novo.xml --- a/tools/mira4_0/mira4_de_novo.xml Wed Feb 10 09:07:39 2016 -0500 +++ b/tools/mira4_0/mira4_de_novo.xml Thu May 18 13:36:08 2017 -0400 @@ -1,29 +1,24 @@ - + Takes Sanger, Roche 454, Solexa/Illumina, Ion Torrent and PacBio reads - mira - miraconvert MIRA - samtools samtools - - - - - - mira4.py --version - mira4.py ---manifest "$manifest" + +python $__tool_directory__/mira4.py --version + + +python $__tool_directory__/mira4.py +--manifest '$manifest' #if str($maf_wanted)=="true": ---maf "$out_maf" +--maf '$out_maf' #end if #if str($bam_wanted)=="true": ---bam "$out_bam" +--bam '$out_bam' #end if ---fasta "$out_fasta" ---log "$out_log" +--fasta '$out_fasta' +--log '$out_log' @@ -133,7 +128,7 @@ - diff -r fd95aaef8818 -r 56b421d59805 tools/mira4_0/mira4_make_bam.py --- a/tools/mira4_0/mira4_make_bam.py Wed Feb 10 09:07:39 2016 -0500 +++ b/tools/mira4_0/mira4_make_bam.py Thu May 18 13:36:08 2017 -0400 @@ -1,37 +1,40 @@ #!/usr/bin/env python """Wrapper script using miraconvert & samtools to get BAM from MIRA. """ + import os -import sys import shutil import subprocess +import sys import tempfile + def run(cmd, log_handle): try: child = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - except Exception, err: + except Exception as err: sys.stderr.write("Error invoking command:\n%s\n\n%s\n" % (cmd, err)) - #TODO - call clean up? + # TODO - call clean up? log_handle.write("Error invoking command:\n%s\n\n%s\n" % (cmd, err)) sys.exit(1) - #Use .communicate as can get deadlocks with .wait(), + # Use .communicate as can get deadlocks with .wait(), stdout, stderr = child.communicate() - assert not stderr #Should be empty as sent to stdout + assert not stderr # Should be empty as sent to stdout if len(stdout) > 10000: - #miraconvert can be very verbose (is holding stdout in RAM a problem?) + # miraconvert can be very verbose (is holding stdout in RAM a problem?) stdout = stdout.split("\n") stdout = stdout[:10] + ["...", "", "..."] + stdout[-10:] stdout = "\n".join(stdout) log_handle.write(stdout) return child.returncode + def depad(fasta_file, sam_file, bam_file, log_handle): log_handle.write("\n================= Converting MIRA assembly from SAM to BAM ===================\n") - #Also doing SAM to (uncompressed) BAM during depad - bam_stem = bam_file + ".tmp" # Have write permissions and want final file in this folder + # Also doing SAM to (uncompressed) BAM during depad + bam_stem = bam_file + ".tmp" # Have write permissions and want final file in this folder cmd = 'samtools depad -S -u -T "%s" "%s" | samtools sort - "%s"' % (fasta_file, sam_file, bam_stem) return_code = run(cmd, log_handle) if return_code: @@ -48,7 +51,7 @@ return "samtools indexing of BAM file failed to produce BAI file" shutil.move(bam_stem + ".bam", bam_file) - os.remove(bam_stem + ".bam.bai") #Let Galaxy handle that... + os.remove(bam_stem + ".bam.bai") # Let Galaxy handle that... def make_bam(mira_convert, maf_file, fasta_file, bam_file, log_handle): @@ -71,7 +74,7 @@ if not os.path.isfile(sam_file): return "Conversion from MIRA to SAM failed" - #Also doing SAM to (uncompressed) BAM during depad + # Also doing SAM to (uncompressed) BAM during depad msg = depad(fasta_file, sam_file, bam_file, log_handle) if msg: return msg @@ -79,7 +82,8 @@ os.remove(sam_file) os.rmdir(tmp_dir) - return None #Good :) + return None # Good :) + if __name__ == "__main__": mira_convert, maf_file, fasta_file, bam_file = sys.argv[1:] diff -r fd95aaef8818 -r 56b421d59805 tools/mira4_0/mira4_mapping.xml --- a/tools/mira4_0/mira4_mapping.xml Wed Feb 10 09:07:39 2016 -0500 +++ b/tools/mira4_0/mira4_mapping.xml Thu May 18 13:36:08 2017 -0400 @@ -1,28 +1,23 @@ - + Maps Sanger, Roche 454, Solexa/Illumina, Ion Torrent and PacBio reads - mira - miraconvert MIRA - samtools samtools - - - - - - mira4.py --version - mira4.py ---manifest "$manifest" + +python $__tool_directory__/mira4.py --version + + +python $__tool_directory__/mira4.py +--manifest '$manifest' #if str($maf_wanted) == "true": ---maf "$out_maf" +--maf '$out_maf' #end if #if str($bam_wanted) == "true": ---bam "$out_bam" +--bam '$out_bam' #end if ---fasta "$out_fasta" ---log "$out_log" +--fasta '$out_fasta' +--log '$out_log' @@ -121,7 +116,7 @@ - @@ -158,7 +153,7 @@ - diff -r fd95aaef8818 -r 56b421d59805 tools/mira4_0/mira4_validator.py --- a/tools/mira4_0/mira4_validator.py Wed Feb 10 09:07:39 2016 -0500 +++ b/tools/mira4_0/mira4_validator.py Thu May 18 13:36:08 2017 -0400 @@ -1,5 +1,6 @@ -#Called from the Galaxy Tool XML file -#import sys +# Called from the Galaxy Tool XML file +# import sys + def validate_input(trans, error_map, param_values, page_param_map): """Validates the min_size/max_size user input, before execution.""" @@ -13,41 +14,41 @@ min_size = str(segments["min_size"]).strip() max_size = str(segments["max_size"]).strip() - #sys.stderr.write("DEBUG min_size=%r, max_size=%r\n" % (min_size, max_size)) + # sys.stderr.write("DEBUG min_size=%r, max_size=%r\n" % (min_size, max_size)) - #Somehow Galaxy seems to turn an empty field into string "None"... - if min_size=="None": + # Somehow Galaxy seems to turn an empty field into string "None"... + if min_size == "None": min_size = "" - if max_size=="None": + if max_size == "None": max_size = "" - if min_size=="" and max_size=="": - #Both missing is good + if min_size == "" and max_size == "": + # Both missing is good pass - elif min_size=="": + elif min_size == "": err["min_size"] = "Minimum size required if maximum size given" - elif max_size=="": + elif max_size == "": err["max_size"] = "Maximum size required if minimum size given" - + if min_size: try: min_size_int = int(min_size) if min_size_int < 0: err["min_size"] = "Minumum size must not be negative (%i)" % min_size_int - min_size = None # Avoid doing comparison below + min_size = None # Avoid doing comparison below except ValueError: err["min_size"] = "Minimum size is not an integer (%s)" % min_size - min_size = None # Avoid doing comparison below + min_size = None # Avoid doing comparison below if max_size: try: max_size_int = int(max_size) - if max_size_int< 0: + if max_size_int < 0: err["max_size"] = "Maximum size must not be negative (%i)" % max_size_int - max_size = None # Avoid doing comparison below + max_size = None # Avoid doing comparison below except ValueError: err["max_size"] = "Maximum size is not an integer (%s)" % max_size - max_size = None # Avoid doing comparison below + max_size = None # Avoid doing comparison below if min_size and max_size and min_size_int > max_size_int: msg = "Minimum size must be less than maximum size (%i vs %i)" % (min_size_int, max_size_int) @@ -55,10 +56,10 @@ err["max_size"] = msg if err: - err_list.append({"segments":err}) + err_list.append({"segments": err}) else: err_list.append(dict()) if any(err_list): - #Return an error map only if any readgroup gave errors + # Return an error map only if any readgroup gave errors error_map["read_group"] = err_list diff -r fd95aaef8818 -r 56b421d59805 tools/mira4_0/repository_dependencies.xml --- a/tools/mira4_0/repository_dependencies.xml Wed Feb 10 09:07:39 2016 -0500 +++ b/tools/mira4_0/repository_dependencies.xml Thu May 18 13:36:08 2017 -0400 @@ -1,4 +1,4 @@ - + diff -r fd95aaef8818 -r 56b421d59805 tools/mira4_0/tool_dependencies.xml --- a/tools/mira4_0/tool_dependencies.xml Wed Feb 10 09:07:39 2016 -0500 +++ b/tools/mira4_0/tool_dependencies.xml Thu May 18 13:36:08 2017 -0400 @@ -1,9 +1,9 @@ - + - +