diff options
Diffstat (limited to 'gn3/computations/ctl.py')
-rw-r--r-- | gn3/computations/ctl.py | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/gn3/computations/ctl.py b/gn3/computations/ctl.py index a5c4565..238740f 100644 --- a/gn3/computations/ctl.py +++ b/gn3/computations/ctl.py @@ -15,22 +15,16 @@ def call_ctl_script(data): temp_file_name = dump_wgcna_data(data) cmd = compose_wgcna_cmd("ctl_analysis.R", temp_file_name) - try: - cmd_results = run_cmd(cmd) - with open(temp_file_name, "r") as outputfile: - if cmd_results["code"] != 0: - return cmd_results + cmd_results = run_cmd(cmd) + with open(temp_file_name, "r") as outputfile: + if cmd_results["code"] != 0: + return (cmd_results, None) + output_file_data = json.load(outputfile) - output_file_data = json.load(outputfile) + output_file_data["image_data"] = process_image( + output_file_data["image_loc"]).decode("ascii") - output_file_data["image_data"] = process_image( - output_file_data["image_loc"]).decode("ascii") - - output_file_data["ctl_plots"] = [process_image(ctl_plot).decode("ascii") for - ctl_plot in output_file_data["ctl_plots"]] - - return output_file_data - - except Exception as e: - return str(e) + output_file_data["ctl_plots"] = [process_image(ctl_plot).decode("ascii") for + ctl_plot in output_file_data["ctl_plots"]] + return (cmd_results, output_file_data) |