aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorAlexander Kabui2022-01-13 19:07:22 +0300
committerBonfaceKilz2022-01-22 09:23:14 +0300
commite7d8432c16b0ab63e49d3bfcd29fc8a8cad8462d (patch)
treed9ba42d9a122f8e19faab7be4dd35cc9eceadbdf /gn3
parentadd01b2d71ba2b7a344feb719c3be9ec053a8aa5 (diff)
downloadgenenetwork3-e7d8432c16b0ab63e49d3bfcd29fc8a8cad8462d.tar.gz
process ctl plot data img
Diffstat (limited to 'gn3')
-rw-r--r--gn3/computations/ctl.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/gn3/computations/ctl.py b/gn3/computations/ctl.py
index 8f20b65..0dec3c4 100644
--- a/gn3/computations/ctl.py
+++ b/gn3/computations/ctl.py
@@ -4,22 +4,32 @@ from gn3.commands import run_cmd
from gn3.computations.wgcna import dump_wgcna_data
from gn3.computations.wgcna import compose_wgcna_cmd
+from gn3.computations.wgcna import process_image
+
+from gn3.settings import TMPDIR
def call_ctl_script(data):
"""function to call ctl script"""
-
+ data["imgDir"] = TMPDIR
temp_file_name = dump_wgcna_data(data)
cmd = compose_wgcna_cmd("ctl_analysis.R", temp_file_name)
try:
cmd_results = run_cmd(cmd)
- print(cmd_results)
- with open(temp_file_name,"r") as outputfile:
+ with open(temp_file_name, "r") as outputfile:
if cmd_results["code"] != 0:
return cmd_results
- return 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["ctl_plots"] = [process_image(ctl_plot).decode("ascii") for
+ clt_plot in output_file_data["ctl_plots"]]
+
+ return output_file_data
except Exception as e:
return str(e)