Mercurial > repos > galaxyp > scaffold
comparison scaffold_wrapper.py @ 1:0d0cbb69a03f draft
Uploaded
author | galaxyp |
---|---|
date | Fri, 26 Sep 2014 15:10:34 -0400 |
parents | e9981e6af666 |
children |
comparison
equal
deleted
inserted
replaced
0:e9981e6af666 | 1:0d0cbb69a03f |
---|---|
45 proc = subprocess.Popen(args=command, shell=True, stderr=tmp_stderr.fileno(), stdout=tmp_stdout.fileno(), stdin=stdin, env=os.environ) | 45 proc = subprocess.Popen(args=command, shell=True, stderr=tmp_stderr.fileno(), stdout=tmp_stdout.fileno(), stdin=stdin, env=os.environ) |
46 returncode = proc.wait() | 46 returncode = proc.wait() |
47 if returncode != 0: | 47 if returncode != 0: |
48 raise Exception("Program returned with non-zero exit code %d. stderr: %s" % (returncode, read_stderr())) | 48 raise Exception("Program returned with non-zero exit code %d. stderr: %s" % (returncode, read_stderr())) |
49 finally: | 49 finally: |
50 print open(tmp_stderr_name, "r").read(64000) | 50 print((open(tmp_stderr_name, "r").read(64000))) |
51 print open(tmp_stdout_name, "r").read(64000) | 51 print((open(tmp_stdout_name, "r").read(64000))) |
52 | 52 |
53 | 53 |
54 def delete_file(path): | 54 def delete_file(path): |
55 if os.path.exists(path): | 55 if os.path.exists(path): |
56 try: | 56 try: |
150 | 150 |
151 | 151 |
152 def build_samples(samples_file): | 152 def build_samples(samples_file): |
153 group_data = parse_groups(samples_file, group_parts=["sample", "mudpit", "category"], input_parts=["name", "path", "ext"]) | 153 group_data = parse_groups(samples_file, group_parts=["sample", "mudpit", "category"], input_parts=["name", "path", "ext"]) |
154 samples_description = "" | 154 samples_description = "" |
155 for sample_name, sample_data in group_data.iteritems(): | 155 for sample_name, sample_data in list(group_data.items()): |
156 files = sample_data["inputs"] | 156 files = sample_data["inputs"] |
157 mudpit = sample_data["group_data"]["mudpit"] | 157 mudpit = sample_data["group_data"]["mudpit"] |
158 category = sample_data["group_data"]["category"] | 158 category = sample_data["group_data"]["category"] |
159 samples_description += """<BiologicalSample database="database" name="%s" mudpit="%s" category="%s">\n""" % (sample_name, mudpit, category) | 159 samples_description += """<BiologicalSample database="database" name="%s" mudpit="%s" category="%s">\n""" % (sample_name, mudpit, category) |
160 for (name, path, ext) in files: | 160 for (name, path, ext) in files: |
305 output_path = options.output | 305 output_path = options.output |
306 template_parameters["output_path"] = output_path | 306 template_parameters["output_path"] = output_path |
307 | 307 |
308 # Prepare and create driver file | 308 # Prepare and create driver file |
309 driver_contents = Template(template).substitute(template_parameters) | 309 driver_contents = Template(template).substitute(template_parameters) |
310 print driver_contents | 310 print(driver_contents) |
311 driver_path = os.path.abspath("driver.xml") | 311 driver_path = os.path.abspath("driver.xml") |
312 open(driver_path, "w").write(driver_contents) | 312 open(driver_path, "w").write(driver_contents) |
313 | 313 |
314 # Run Scaffold | 314 # Run Scaffold |
315 execute("ScaffoldBatch3 '%s'" % driver_path) | 315 execute("ScaffoldBatch3 '%s'" % driver_path) |