about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPjotr Prins2024-04-03 13:24:32 +0200
committerFrederick Muriuki Muriithi2024-09-12 07:40:04 -0500
commit9d221ad285e4d41e0a83af88bef8f221356848ba (patch)
treeaef89f20b2b8d87641a134a0c59f064a98a0cd44
parente10b62f88432856019540074fd19b6acdb70d4ad (diff)
downloadgenenetwork3-9d221ad285e4d41e0a83af88bef8f221356848ba.tar.gz
Replace TMPDIR/output with TMPDIR/gn3 so it is clear where it comes from
-rw-r--r--gn3/api/rqtl.py4
-rw-r--r--gn3/computations/rqtl.py12
-rw-r--r--gn3/computations/wgcna.py10
3 files changed, 13 insertions, 13 deletions
diff --git a/gn3/api/rqtl.py b/gn3/api/rqtl.py
index bd50900..dd9078f 100644
--- a/gn3/api/rqtl.py
+++ b/gn3/api/rqtl.py
@@ -46,8 +46,8 @@ run the rqtl_wrapper script and return the results as JSON
 
     rqtl_output = {}
     if not os.path.isfile(os.path.join(current_app.config.get("TMPDIR"),
-                                       "output", rqtl_cmd.get('output_file'))):
-        os.system(__pk__(rqtl_cmd.get('rqtl_cmd')))
+                                       "gn3", rqtl_cmd.get('output_file'))):
+        os.system(rqtl_cmd.get('rqtl_cmd'))
 
     if "pairscan" in rqtl_bool_kwargs:
         rqtl_output['results'] = process_rqtl_pairscan(rqtl_cmd.get('output_file'), genofile)
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 {