annotate tools/mira4_0/mira4.py @ 4:1713289d9908 draft default tip

v0.0.11 tweak for use with bioconda dependencies
author peterjc
date Thu, 10 Aug 2017 11:09:10 -0400
parents 4eb32a3d67d1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
1 #!/usr/bin/env python
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
2 """A simple wrapper script to call MIRA and collect its output.
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
3 """
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
5 from __future__ import print_function
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
6
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
7 import os
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
8 import shutil
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
9 import subprocess
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
10 import sys
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
11 import tempfile
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
12 import time
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
13
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
14 from optparse import OptionParser
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
15
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
16 # Do we need any PYTHONPATH magic?
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
17 from mira4_make_bam import make_bam
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
18
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
19 WRAPPER_VER = "0.0.11" # Keep in sync with the XML file
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
20
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
21
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
22 def get_version(mira_binary):
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
23 """Run MIRA to find its version number."""
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
24 # At the commend line I would use: mira -v | head -n 1
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
25 # however there is some pipe error when doing that here.
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
26 cmd = [mira_binary, "-v"]
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
27 try:
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
28 child = subprocess.Popen(cmd, universal_newlines=True,
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
29 stdout=subprocess.PIPE,
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
30 stderr=subprocess.STDOUT)
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
31 except Exception as err:
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
32 sys.stderr.write("Error invoking command:\n%s\n\n%s\n" % (" ".join(cmd), err))
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
33 sys.exit(1)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
34 ver, tmp = child.communicate()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
35 del child
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
36 return ver.split("\n", 1)[0].strip()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
37
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
38
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
39 # Parse Command Line
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
40 usage = """Galaxy MIRA4 wrapper script v%s - use as follows:
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
41
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
42 $ python mira4.py ...
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
43
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
44 This will run the MIRA binary and collect its output files as directed.
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
45 """ % WRAPPER_VER
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
46 parser = OptionParser(usage=usage)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
47 parser.add_option("-m", "--manifest", dest="manifest",
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
48 default=None, metavar="FILE",
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
49 help="MIRA manifest filename")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
50 parser.add_option("--maf", dest="maf",
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
51 default="-", metavar="FILE",
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
52 help="MIRA MAF output filename")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
53 parser.add_option("--bam", dest="bam",
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
54 default="-", metavar="FILE",
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
55 help="Unpadded BAM output filename")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
56 parser.add_option("--fasta", dest="fasta",
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
57 default="-", metavar="FILE",
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
58 help="Unpadded FASTA output filename")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
59 parser.add_option("--log", dest="log",
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
60 default="-", metavar="FILE",
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
61 help="MIRA logging output filename")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
62 parser.add_option("-v", "--version", dest="version",
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
63 default=False, action="store_true",
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
64 help="Show version and quit")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
65 options, args = parser.parse_args()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
66 manifest = options.manifest
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
67 out_maf = options.maf
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
68 out_bam = options.bam
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
69 out_fasta = options.fasta
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
70 out_log = options.log
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
71
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
72 if "MIRA4" in os.environ:
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
73 mira_path = os.environ["MIRA4"]
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
74 mira_binary = os.path.join(mira_path, "mira")
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
75 if not os.path.isfile(mira_binary):
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
76 sys.exit("Missing mira under $MIRA4, %r\nFolder contained: %s"
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
77 % (mira_binary, ", ".join(os.listdir(mira_path))))
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
78 mira_convert = os.path.join(mira_path, "miraconvert")
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
79 if not os.path.isfile(mira_convert):
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
80 sys.exit("Missing miraconvert under $MIRA4, %r\nFolder contained: %s"
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
81 % (mira_convert, ", ".join(os.listdir(mira_path))))
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
82 else:
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
83 sys.stderr.write("DEBUG: Since $MIRA4 is not set, assuming mira binaries are on $PATH.\n")
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
84 mira_path = None
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
85 mira_binary = "mira"
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
86 mira_convert = "miraconvert"
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
87
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
88 mira_ver = get_version(mira_binary)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
89 if not mira_ver.strip().startswith("4.0"):
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
90 sys.exit("This wrapper is for MIRA V4.0, not:\n%s\n%s" % (mira_ver, mira_binary))
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
91 mira_convert_ver = get_version(mira_convert)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
92 if not mira_convert_ver.strip().startswith("4.0"):
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
93 sys.exit("This wrapper is for MIRA V4.0, not:\n%s\n%s" % (mira_ver, mira_convert))
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
94 if options.version:
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
95 print("%s, MIRA wrapper version %s" % (mira_ver, WRAPPER_VER))
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
96 if mira_ver != mira_convert_ver:
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
97 print("WARNING: miraconvert %s" % mira_convert_ver)
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
98 sys.exit(0)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
99
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
100 if not manifest:
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
101 sys.exit("Manifest is required")
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
102 elif not os.path.isfile(manifest):
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
103 sys.exit("Missing input MIRA manifest file: %r" % manifest)
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
104
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
105
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
106 try:
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
107 threads = int(os.environ.get("GALAXY_SLOTS", "1"))
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
108 except ValueError:
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
109 threads = 1
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
110 assert 1 <= threads, threads
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
111
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
112
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
113 def override_temp(manifest):
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
114 """Override ``-DI:trt=/tmp`` in manifest with environment variable.
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
115
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
116 Currently MIRA 4 does not allow envronment variables like ``$TMP``
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
117 inside the manifest, which is a problem if you need to override
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
118 the default at run time.
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
119
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
120 The tool XML will ``/tmp`` and we replace that here with
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
121 ``tempfile.gettempdir()`` which will respect $TMPDIR, $TEMP, $TMP
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
122 as explained in the Python standard library documentation:
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
123 http://docs.python.org/2/library/tempfile.html#tempfile.tempdir
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
124
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
125 By default MIRA 4 would write its temporary files within the output
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
126 folder, which is a problem if that is a network drive.
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
127 """
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
128 handle = open(manifest, "r")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
129 text = handle.read()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
130 handle.close()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
131
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
132 # At time of writing, this is at the end of a file,
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
133 # but could be followed by a space in future...
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
134 text = text.replace("-DI:trt=/tmp", "-DI:trt=" + tempfile.gettempdir())
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
135
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
136 # Want to try to ensure this gets written to disk before MIRA attempts
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
137 # to open it - any networked file system may impose a delay...
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
138 handle = open(manifest, "w")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
139 handle.write(text)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
140 handle.flush()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
141 os.fsync(handle.fileno())
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
142 handle.close()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
143
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
144
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
145 def log_manifest(manifest):
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
146 """Write the manifest file to stderr."""
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
147 sys.stderr.write("\n%s\nManifest file\n%s\n" % ("=" * 60, "=" * 60))
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
148 with open(manifest) as h:
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
149 for line in h:
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
150 sys.stderr.write(line)
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
151 sys.stderr.write("\n%s\nEnd of manifest\n%s\n" % ("=" * 60, "=" * 60))
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
152
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
153
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
154 def collect_output(temp, name, handle):
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
155 """Moves files to the output filenames (global variables)."""
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
156 f = "%s/%s_assembly/%s_d_results" % (temp, name, name)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
157 if not os.path.isdir(f):
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
158 log_manifest(manifest)
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
159 sys.exit("Missing output folder")
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
160 if not os.listdir(f):
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
161 log_manifest(manifest)
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
162 sys.exit("Empty output folder")
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
163 missing = []
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
164
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
165 old_maf = "%s/%s_out.maf" % (f, name)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
166 if not os.path.isfile(old_maf):
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
167 # Triggered extractLargeContigs.sh?
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
168 old_maf = "%s/%s_LargeContigs_out.maf" % (f, name)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
169
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
170 # De novo or single strain mapping,
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
171 old_fasta = "%s/%s_out.unpadded.fasta" % (f, name)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
172 ref_fasta = "%s/%s_out.padded.fasta" % (f, name)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
173 if not os.path.isfile(old_fasta):
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
174 # Mapping (StrainX versus reference) or de novo
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
175 old_fasta = "%s/%s_out_StrainX.unpadded.fasta" % (f, name)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
176 ref_fasta = "%s/%s_out_StrainX.padded.fasta" % (f, name)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
177 if not os.path.isfile(old_fasta):
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
178 old_fasta = "%s/%s_out_ReferenceStrain.unpadded.fasta" % (f, name)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
179 ref_fasta = "%s/%s_out_ReferenceStrain.padded.fasta" % (f, name)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
180
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
181 missing = False
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
182 for old, new in [(old_maf, out_maf),
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
183 (old_fasta, out_fasta)]:
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
184 if not os.path.isfile(old):
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
185 missing = True
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
186 elif not new or new == "-":
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
187 handle.write("Ignoring %s\n" % old)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
188 else:
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
189 handle.write("Capturing %s\n" % old)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
190 shutil.move(old, new)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
191 if missing:
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
192 log_manifest(manifest)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
193 sys.stderr.write("Contents of %r:\n" % f)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
194 for filename in sorted(os.listdir(f)):
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
195 sys.stderr.write("%s\n" % filename)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
196
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
197 # For mapping mode, probably most people would expect a BAM file
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
198 # using the reference FASTA file...
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
199 if out_bam and out_bam != "-":
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
200 if out_maf and out_maf != "-":
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
201 msg = make_bam(mira_convert, out_maf, ref_fasta, out_bam, handle)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
202 else:
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
203 # Not collecting the MAF file, use original location
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
204 msg = make_bam(mira_convert, old_maf, ref_fasta, out_bam, handle)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
205 if msg:
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
206 sys.exit(msg)
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
207
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
208
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
209 def clean_up(temp, name):
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
210 folder = "%s/%s_assembly" % (temp, name)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
211 if os.path.isdir(folder):
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
212 shutil.rmtree(folder)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
213
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
214
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
215 # TODO - Run MIRA in /tmp or a configurable directory?
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
216 # Currently Galaxy puts us somewhere safe like:
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
217 # /opt/galaxy-dist/database/job_working_directory/846/
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
218 temp = "."
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
219
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
220 name = "MIRA"
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
221
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
222 override_temp(manifest)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
223
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
224 start_time = time.time()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
225 cmd_list = [mira_binary, "-t", str(threads), manifest]
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
226 cmd = " ".join(cmd_list)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
227
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
228 assert os.path.isdir(temp)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
229 d = "%s_assembly" % name
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
230 # This can fail on my development machine if stale folders exist
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
231 # under Galaxy's .../database/job_working_directory/ tree:
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
232 assert not os.path.isdir(d), "Path %r already exists:\n%s" % (d, os.path.abspath(d))
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
233 try:
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
234 # Check path access
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
235 os.mkdir(d)
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
236 except Exception as err:
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
237 log_manifest(manifest)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
238 sys.stderr.write("Error making directory %s\n%s" % (d, err))
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
239 sys.exit(1)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
240
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
241 # print(os.path.abspath("."))
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
242 # print(cmd)
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
243
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
244 if out_log and out_log != "-":
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
245 handle = open(out_log, "w")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
246 else:
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
247 handle = open(os.devnull, "w")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
248 handle.write("======================== MIRA manifest (instructions) ========================\n")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
249 m = open(manifest, "rU")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
250 for line in m:
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
251 handle.write(line)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
252 m.close()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
253 del m
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
254 handle.write("\n")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
255 handle.write("============================ Starting MIRA now ===============================\n")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
256 handle.flush()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
257 try:
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
258 # Run MIRA
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
259 child = subprocess.Popen(cmd_list,
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
260 stdout=handle,
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
261 stderr=subprocess.STDOUT)
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
262 except Exception as err:
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
263 log_manifest(manifest)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
264 sys.stderr.write("Error invoking command:\n%s\n\n%s\n" % (cmd, err))
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
265 # TODO - call clean up?
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
266 handle.write("Error invoking command:\n%s\n\n%s\n" % (cmd, err))
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
267 handle.close()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
268 sys.exit(1)
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
269 # Use .communicate as can get deadlocks with .wait(),
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
270 stdout, stderr = child.communicate()
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
271 assert not stdout and not stderr # Should be empty as sent to handle
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
272 run_time = time.time() - start_time
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
273 return_code = child.returncode
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
274 handle.write("\n")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
275 handle.write("============================ MIRA has finished ===============================\n")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
276 handle.write("MIRA took %0.2f hours\n" % (run_time / 3600.0))
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
277 if return_code:
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
278 print("MIRA took %0.2f hours" % (run_time / 3600.0))
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
279 handle.write("Return error code %i from command:\n" % return_code)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
280 handle.write(cmd + "\n")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
281 handle.close()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
282 clean_up(temp, name)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
283 log_manifest(manifest)
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
284 sys.stderr.write("Return error code %i from command:\n" % return_code)
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
285 sys.stderr.write(cmd + "\n")
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
286 sys.exit(return_code)
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
287 handle.flush()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
288
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
289 if os.path.isfile("MIRA_assembly/MIRA_d_results/ec.log"):
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
290 handle.write("\n")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
291 handle.write("====================== Extract Large Contigs failed ==========================\n")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
292 e = open("MIRA_assembly/MIRA_d_results/ec.log", "rU")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
293 for line in e:
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
294 handle.write(line)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
295 e.close()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
296 handle.write("============================ (end of ec.log) =================================\n")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
297 handle.flush()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
298
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
299 # print("Collecting output...")
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
300 start_time = time.time()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
301 collect_output(temp, name, handle)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
302 collect_time = time.time() - start_time
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
303 handle.write("MIRA took %0.2f hours; collecting output %0.2f minutes\n"
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
304 % (run_time / 3600.0, collect_time / 60.0))
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
305 print("MIRA took %0.2f hours; collecting output %0.2f minutes\n"
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
306 % (run_time / 3600.0, collect_time / 60.0))
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
307
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
308 if os.path.isfile("MIRA_assembly/MIRA_d_results/ec.log"):
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
309 # Treat as an error, but doing this AFTER collect_output
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
310 sys.stderr.write("Extract Large Contigs failed\n")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
311 handle.write("Extract Large Contigs failed\n")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
312 handle.close()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
313 sys.exit(1)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
314
4
1713289d9908 v0.0.11 tweak for use with bioconda dependencies
peterjc
parents: 2
diff changeset
315 # print "Cleaning up..."
2
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
316 clean_up(temp, name)
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
317
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
318 handle.write("\nDone\n")
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
319 handle.close()
4eb32a3d67d1 v0.0.8 - renamed folder, added note about mirabait
peterjc
parents:
diff changeset
320 print("Done")