aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabui2021-09-23 15:58:25 +0300
committerAlexander Kabui2021-09-23 15:58:25 +0300
commit0ca5f01422883d97e42dd37e59ffacdcf9a65af9 (patch)
tree999d1fbfa56ec1ff62877bd7760b2c041a2a1420
parent1c392b4b2786d196af6b882e80270b8cb839f554 (diff)
downloadgenenetwork3-0ca5f01422883d97e42dd37e59ffacdcf9a65af9.tar.gz
Return r error if returncode!=0
-rw-r--r--gn3/computations/wgcna.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py
index 689bc2d..e9b76e8 100644
--- a/gn3/computations/wgcna.py
+++ b/gn3/computations/wgcna.py
@@ -22,6 +22,7 @@ def dump_wgcna_data(request_data: dict):
def compose_wgcna_cmd(rscript_path: str, temp_file_path: str):
"""function to componse wgcna cmd"""
+ # (todo):issue relative paths to abs paths
cmd = f"Rscript ./scripts/{rscript_path} {temp_file_path}"
return cmd
@@ -33,8 +34,16 @@ def call_wgcna_script(rscript_path: str, request_data: dict):
try:
- run_cmd(cmd)
+ run_cmd_results = run_cmd(cmd)
+
with open(generated_file, "r") as outputfile:
- return results
+
+ if run_cmd_results["code"] != 0:
+ return run_cmd_results
+ return {
+ "data": json.load(outputfile),
+ **run_cmd_results
+ }
+ # return json.load(outputfile)
except Exception as error:
raise error