aboutsummaryrefslogtreecommitdiff
path: root/gn3/api/wgcna.py
diff options
context:
space:
mode:
authorBonfaceKilz2021-09-28 11:21:07 +0300
committerGitHub2021-09-28 11:21:07 +0300
commit674dc56b9df38e7cf1bbc65a2fc6bf3cc16f7231 (patch)
treef35b34525843542aca50c4f22c6b62ca59d1a057 /gn3/api/wgcna.py
parent0cbb6ecde0315b7d6f021cb17406f5e5197e8a05 (diff)
parent16235188d4ee2ad21a667832baf6cbbea6d8856a (diff)
downloadgenenetwork3-674dc56b9df38e7cf1bbc65a2fc6bf3cc16f7231.tar.gz
Merge pull request #38 from genenetwork/feature/wgcna_analysis
script for wgcna analysis
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