From 9d221ad285e4d41e0a83af88bef8f221356848ba Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Wed, 3 Apr 2024 13:24:32 +0200 Subject: Replace TMPDIR/output with TMPDIR/gn3 so it is clear where it comes from --- gn3/computations/rqtl.py | 12 ++++++------ gn3/computations/wgcna.py | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'gn3/computations') diff --git a/gn3/computations/rqtl.py b/gn3/computations/rqtl.py index b53efbd..589caa4 100644 --- a/gn3/computations/rqtl.py +++ b/gn3/computations/rqtl.py @@ -68,7 +68,7 @@ def process_rqtl_mapping(file_name: str) -> List: # Later I should probably redo this using csv.read to avoid the # awkwardness with removing quotes with [1:-1] - outdir = os.path.join(get_tmpdir(),"output") + outdir = os.path.join(get_tmpdir(),"gn3") if not os.path.isdir(outdir): os.mkdir(outdir) @@ -113,7 +113,7 @@ def pairscan_for_figure(file_name: str) -> Dict: figure_data = {} # Open the file with the actual results, written as a list of lists - outdir = os.path.join(get_tmpdir(),"output") + outdir = os.path.join(get_tmpdir(),"gn3") if not os.path.isdir(outdir): os.mkdir(outdir) @@ -132,7 +132,7 @@ def pairscan_for_figure(file_name: str) -> Dict: with open( os.path.join( current_app.config.get("TMPDIR", "/tmp"), - "output", + "gn3", "MAP_" + file_name, ), "r", @@ -163,7 +163,7 @@ def get_marker_list(map_file: str) -> List: marker_list = [] with open( os.path.join( - current_app.config.get("TMPDIR", "/tmp"), "output", map_file + current_app.config.get("TMPDIR", "/tmp"), "gn3", map_file ), "r", encoding="utf8", @@ -199,7 +199,7 @@ def generate_table_rows( table_data = [] with open( os.path.join( - current_app.config.get("TMPDIR", "/tmp"), "output", results_file + current_app.config.get("TMPDIR", "/tmp"), "gn3", results_file ), "r", encoding="utf8", @@ -318,7 +318,7 @@ def process_perm_output(file_name: str) -> Tuple[List, float, float]: suggestive and significant thresholds""" perm_results = [] - outdir = os.path.join(get_tmpdir(),"output") + outdir = os.path.join(get_tmpdir(),"gn3") if not os.path.isdir(outdir): os.mkdir(outdir) diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index 01d024b..e6fab26 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -29,18 +29,18 @@ def stream_cmd_output(socketio, request_data, cmd: str): """function to stream in realtime""" # xtodo syncing and closing /edge cases - socketio.emit("output", {"data": f"calling you script {cmd}"}, + socketio.emit("gn3", {"data": f"calling you script {cmd}"}, namespace="/", room=request_data["socket_id"]) with subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) as results: if results.stdout is not None: for line in iter(results.stdout.readline, b""): - socketio.emit("output", + socketio.emit("gn3", {"data": line.decode("utf-8").rstrip()}, namespace="/", room=request_data["socket_id"]) socketio.emit( - "output", {"data": + "gn3", {"data": "parsing the output results"}, namespace="/", room=request_data["socket_id"]) @@ -79,8 +79,8 @@ def call_wgcna_script(rscript_path: str, request_data: dict): return run_cmd_results output_file_data = json.load(outputfile) - output_file_data["output"]["image_data"] = process_image( - output_file_data["output"]["imageLoc"]).decode("ascii") + output_file_data["gn3"]["image_data"] = process_image( + output_file_data["gn3"]["imageLoc"]).decode("ascii") # json format only supports unicode string// to get image data reconvert return { -- cgit v1.2.3