aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorzsloan2021-05-17 21:54:42 +0000
committerzsloan2021-05-17 21:54:42 +0000
commit7ed84670c0d13de38b578a4e4177b2529ff3fb40 (patch)
treea78d5123d3739b46dc19f87369bc5a08f6ca5b2f /gn3
parentea9d9d6454783a6af07384a66f204e199035e5bd (diff)
downloadgenenetwork3-7ed84670c0d13de38b578a4e4177b2529ff3fb40.tar.gz
Read in kwargs fromrequest and pass the command, tmpdir, and kwargs to generate_rqtl_cmd which returns the actual command and output path
Diffstat (limited to 'gn3')
-rw-r--r--gn3/api/rqtl.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/gn3/api/rqtl.py b/gn3/api/rqtl.py
index 8dd4bb7..82cf34f 100644
--- a/gn3/api/rqtl.py
+++ b/gn3/api/rqtl.py
@@ -2,8 +2,12 @@ import os
from flask import Blueprint
from flask import current_app
+from flask import jsonify
from flask import request
+from gn3.computations.rqtl import generate_rqtl_cmd
+from gn3.computations.gemma import do_paths_exist
+
rqtl = Blueprint("rqtl", __name__)
@rqtl.route("/compute", methods=["POST"])
@@ -16,4 +20,18 @@ def compute():
if not do_paths_exist([genofile, phenofile]):
raise FileNotFoundError
- return current_app.config.get("RQTL_WRAPPER_CMD") \ No newline at end of file
+ kwarg_list = ["addcovar", "model", "method", "interval", "nperm", "scale", "control_marker"]
+
+ rqtl_kwargs = {"geno": genofile, "pheno": phenofile}
+ for kwarg in kwarg_list:
+ if kwarg in request.form:
+ rqtl_kwargs[kwarg] = request.form[kwarg]
+
+ results = generate_rqtl_cmd(
+ rqtl_wrapper_cmd = current_app.config.get("RQTL_WRAPPER_CMD"),
+ output_dir = current_app.config.get('TMPDIR'),
+ rqtl_wrapper_kwargs = rqtl_kwargs
+ )
+
+ return jsonify(results)
+