aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations
diff options
context:
space:
mode:
authorAlexander Kabui2022-03-25 15:50:29 +0300
committerAlexander Kabui2022-03-25 15:50:29 +0300
commit41a43b5797a8826cfbe5cc6674023705d98f8e1a (patch)
tree5ee99cee82a7a9b25d643d7b32c39f9b79fb29f3 /gn3/computations
parent63e3ce06406b90f148384a5f75bb14ba46ccc8b1 (diff)
downloadgenenetwork3-41a43b5797a8826cfbe5cc6674023705d98f8e1a.tar.gz
refactor code to generate cmd
Diffstat (limited to 'gn3/computations')
-rw-r--r--gn3/computations/wgcna.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py
index 01aaedb..ed7afc7 100644
--- a/gn3/computations/wgcna.py
+++ b/gn3/computations/wgcna.py
@@ -8,6 +8,7 @@ import base64
from gn3.settings import TMPDIR
+from gn3.settings import R_SCRIPTS
from gn3.commands import run_cmd
@@ -55,16 +56,18 @@ def process_image(image_loc: str) -> bytes:
return b""
-def compose_rscript_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}"'
+def compose_rscript_cmd(script_path: str,
+ file_name: str,
+ temp_file_path: str):
+
+ cmd = f'"Rscript {os.path.join(script_path,file_name)} {temp_file_path}"'
return cmd
def call_wgcna_script(rscript_path: str, request_data: dict):
"""function to call wgcna script"""
generated_file = dump_wgcna_data(request_data)
+
cmd = compose_rscript_cmd(rscript_path, generated_file)
# stream_cmd_output(request_data, cmd) disable streaming of data