about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gn3/api/rqtl2.py9
-rw-r--r--gn3/computations/rqtl2.py1
2 files changed, 2 insertions, 8 deletions
diff --git a/gn3/api/rqtl2.py b/gn3/api/rqtl2.py
index dbbb536..c1cd496 100644
--- a/gn3/api/rqtl2.py
+++ b/gn3/api/rqtl2.py
@@ -17,7 +17,6 @@ rqtl2 = Blueprint("rqtl2", __name__)
 def compute():
     """Endpoint for computing QTL analysis using R/QTL2"""
     data = request.json
-    # main requirements for creating the cross
     required_keys = ["crosstype", "geno_data","pheno_data", "geno_codes"]
     valid, error = validate_required_keys(required_keys,data)
     if not valid:
@@ -32,18 +31,14 @@ def compute():
      output_file, log_file) = prepare_files(current_app.config.get("TMPDIR"))
     # write the input file with data required for creating the cross
     write_input_file(input_file, workspace_dir, data)
-    # check if the rscript cmd command  exist
     rqtl_path =Path(__file__).absolute().parent.parent.parent.joinpath("scripts/rqtl2_wrapper.R")
     if not rqtl_path.is_file():
         return jsonify({"error" : f"The script {rqtl_path} does not exists"}), 400
     rqtl2_cmd = compose_rqtl2_cmd(rqtl_path, input_file,
                                   output_file, workspace_dir,
                                   data, current_app.config)
-    # run the rscript in as a subprocess which capture stdout in the log file
     process_output = run_process(rqtl2_cmd.split(),log_file, run_id)
+    shutil.rmtree(workspace_dir, ignore_errors=True, onerror=None)
     if process_output["code"]!=0:
         return jsonify(process_output), 400
-    # TODO: process the results and return results to gn2
-    # rm the workspace directory
-    shutil.rmtree(workspace_dir, ignore_errors=True, onerror=None)
-    return process_output
+    return jsonify(process_output)
diff --git a/gn3/computations/rqtl2.py b/gn3/computations/rqtl2.py
index c64ca08..0022f61 100644
--- a/gn3/computations/rqtl2.py
+++ b/gn3/computations/rqtl2.py
@@ -9,7 +9,6 @@ def generate_rqtl2_files(data, workspace_dir):
     """Prepare data  and generate necessary CSV  files
     required to write to control_file
     """
-    # Map of file names to corresponding data keys in the provided dictionary
     file_to_name_map = {
         "geno_file": "geno_data",
         "pheno_file": "pheno_data",