comparison tools/mira4/mira4.py @ 11:02350bef2e99 draft

Uploaded v0.0.2 preview 3, correction regression in URL
author peterjc
date Tue, 10 Dec 2013 06:29:13 -0500
parents 302d13490b23
children a6a56440567c
comparison
equal deleted inserted replaced
10:79759fdec6cb 11:02350bef2e99
55 print "%s, MIRA wrapper version %s" % (mira_ver, WRAPPER_VER) 55 print "%s, MIRA wrapper version %s" % (mira_ver, WRAPPER_VER)
56 if mira_ver != mira_convert_ver: 56 if mira_ver != mira_convert_ver:
57 print "WARNING: miraconvert %s" % mira_convert_ver 57 print "WARNING: miraconvert %s" % mira_convert_ver
58 sys.exit(0) 58 sys.exit(0)
59 59
60 def fix_threads(manifest): 60
61 """Tweak the manifest to alter the number of threads.""" 61 try:
62 try: 62 threads = int(os.environ.get("GALAXY_SLOTS", "1"))
63 threads = int(os.environ.get("GALAXY_SLOTS", "1")) 63 except ValueError:
64 except ValueError: 64 threads = 1
65 threads = 1 65 assert 1 <= threads, threads
66 assert 1 <= threads 66
67 if threads == 1:
68 #Nothing to do...
69 return
70
71 handle = open(manifest)
72 text = handle.read()
73 handle.close()
74
75 text = text.replace(" -GE:not=1 ", " -GE:not=%i " % threads)
76
77 handle = open(manifest, "w")
78 handle.write(text)
79 handle.flush()
80 handle.close()
81 67
82 def log_manifest(manifest): 68 def log_manifest(manifest):
83 """Write the manifest file to stderr.""" 69 """Write the manifest file to stderr."""
84 sys.stderr.write("\n%s\nManifest file\n%s\n" % ("="*60, "="*60)) 70 sys.stderr.write("\n%s\nManifest file\n%s\n" % ("="*60, "="*60))
85 with open(manifest) as h: 71 with open(manifest) as h:
148 temp = "." 134 temp = "."
149 #name, out_fasta, out_qual, out_ace, out_caf, out_wig, out_log = sys.argv[1:8] 135 #name, out_fasta, out_qual, out_ace, out_caf, out_wig, out_log = sys.argv[1:8]
150 name = "MIRA" 136 name = "MIRA"
151 manifest, out_maf, out_bam, out_fasta, out_log = sys.argv[1:] 137 manifest, out_maf, out_bam, out_fasta, out_log = sys.argv[1:]
152 138
153 fix_threads(manifest)
154
155 start_time = time.time() 139 start_time = time.time()
156 #cmd_list =sys.argv[8:] 140 #cmd_list =sys.argv[8:]
157 cmd_list = [mira_binary, manifest] 141 cmd_list = [mira_binary, "-t", str(threads), manifest]
158 cmd = " ".join(cmd_list) 142 cmd = " ".join(cmd_list)
159 143
160 assert os.path.isdir(temp) 144 assert os.path.isdir(temp)
161 d = "%s_assembly" % name 145 d = "%s_assembly" % name
162 assert not os.path.isdir(d), "Path %s already exists" % d 146 assert not os.path.isdir(d), "Path %s already exists" % d