aboutsummaryrefslogtreecommitdiff
path: root/gn3/api/wgcna.py
diff options
context:
space:
mode:
authorzsloan2021-10-12 18:56:34 +0000
committerzsloan2021-10-12 18:56:34 +0000
commit0f396f4a1a753d449cf2975fc425d587d9350689 (patch)
treec9dac243dc05e5cb90ccb7f1d96fd599986bf60a /gn3/api/wgcna.py
parent976660ce9ef915426c7ce5ff9077b439e4102a2c (diff)
parent77c274b79c3ec01de60e90db3299763cb58f715b (diff)
downloadgenenetwork3-0f396f4a1a753d449cf2975fc425d587d9350689.tar.gz
Merge branch 'main' of https://github.com/genenetwork/genenetwork3 into feature/add_rqtl_pairscan
Diffstat (limited to 'gn3/api/wgcna.py')
-rw-r--r--gn3/api/wgcna.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/gn3/api/wgcna.py b/gn3/api/wgcna.py
new file mode 100644
index 0000000..fa044cf
--- /dev/null
+++ b/gn3/api/wgcna.py
@@ -0,0 +1,25 @@
+"""endpoint to run wgcna analysis"""
+from flask import Blueprint
+from flask import request
+from flask import current_app
+from flask import jsonify
+
+from gn3.computations.wgcna import call_wgcna_script
+
+wgcna = Blueprint("wgcna", __name__)
+
+
+@wgcna.route("/run_wgcna", methods=["POST"])
+def run_wgcna():
+ """run wgcna:output should be a json with a the data"""
+
+ wgcna_data = request.json
+
+ wgcna_script = current_app.config["WGCNA_RSCRIPT"]
+
+ results = call_wgcna_script(wgcna_script, wgcna_data)
+
+ if results.get("data") is None:
+ return jsonify(results), 401
+
+ return jsonify(results), 200