diff options
-rw-r--r-- | gn3/computations/wgcna.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index fd508fa..0fb56e8 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -3,8 +3,9 @@ import os import json import uuid -from gn3.settings import TMPDIR +import subprocess +from gn3.settings import TMPDIR from gn3.commands import run_cmd @@ -20,6 +21,16 @@ def dump_wgcna_data(request_data: dict): return temp_file_path +def stream_cmd_output(socket, cmd: str): + """function to stream in realtime""" + # xtodo syncing and closing /edge cases + + results = subprocess.Popen( + cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) + for line in iter(results.stdout.readline, b""): + line = line.decode("utf-8").rstrip() + + def compose_wgcna_cmd(rscript_path: str, temp_file_path: str): """function to componse wgcna cmd""" # (todo):issue relative paths to abs paths |