aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/templates/gn3_wgcna_results.html (renamed from wqflask/wqflask/templates/test_wgcna_results.html)35
-rw-r--r--wqflask/wqflask/views.py2
-rw-r--r--wqflask/wqflask/wgcna/gn3_wgcna.py13
3 files changed, 42 insertions, 8 deletions
diff --git a/wqflask/wqflask/templates/test_wgcna_results.html b/wqflask/wqflask/templates/gn3_wgcna_results.html
index 952f479e..8a31bf28 100644
--- a/wqflask/wqflask/templates/test_wgcna_results.html
+++ b/wqflask/wqflask/templates/gn3_wgcna_results.html
@@ -75,6 +75,12 @@
{% else %}
<div>
+ <div>
+ <h2 style="text-align:center;">Parameters used</h2>
+
+ <table id="summary" class="display" width="40vw" ></table>
+
+ </div>
<div >
<h2 style="text-align:center">Soft Thresholds </h2>
<div class="grid_container">
@@ -133,13 +139,34 @@
<script type="text/javascript">
-let results = {{results|safe}}
-
-let phenoModules = results["data"]["output"]["net_colors"]
+let phenoModules = {{results|safe}}["data"]["output"]["net_colors"]
let phenotypes = Object.keys(phenoModules)
let phenoMods = Object.values(phenoModules)
let {col_names,mod_dataset} = {{data|safe}}
+const summary = {
+ modules_found:phenoMods.length,
+ ...{{parameters|safe}}
+
+}
+
+ $("#summary").DataTable( {
+
+ data: Object.keys(summary).map((key)=>{
+ return [key,summary[key]]
+ }),
+ columns: [ {
+ title: "parameter",
+
+ },
+
+ {
+ title:" param_values"
+ }
+ ]
+ })
+
+
$('#eigens').DataTable( {
data: mod_dataset,
columns: col_names.map((name)=>{
@@ -162,4 +189,4 @@ let {col_names,mod_dataset} = {{data|safe}}
</script>
-{% endblock %} \ No newline at end of file
+{% endblock %}
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index b2cf95fb..31e31875 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -345,7 +345,7 @@ def wcgna_setup():
def wcgna_results():
"""call the gn3 api to get wgcna response data"""
results = run_wgcna(dict(request.form))
- return render_template("test_wgcna_results.html", **results)
+ return render_template("gn3_wgcna_results.html", **results)
@app.route("/ctl_setup", methods=('POST',))
def ctl_setup():
diff --git a/wqflask/wqflask/wgcna/gn3_wgcna.py b/wqflask/wqflask/wgcna/gn3_wgcna.py
index 7bf5c62b..ab7fe46c 100644
--- a/wqflask/wqflask/wgcna/gn3_wgcna.py
+++ b/wqflask/wqflask/wgcna/gn3_wgcna.py
@@ -76,8 +76,6 @@ def run_wgcna(form_data):
wgcna_api = f"{GN3_LOCAL_URL}/api/wgcna/run_wgcna"
- # parse form data
-
trait_dataset = fetch_trait_data(form_data)
form_data["minModuleSize"] = int(form_data["MinModuleSize"])
@@ -86,8 +84,10 @@ def run_wgcna(form_data):
try:
+ unique_strains = list(set(trait_dataset["sample_names"]))
+
response = requests.post(wgcna_api, json={
- "sample_names": list(set(trait_dataset["sample_names"])),
+ "sample_names": unique_strains,
"trait_names": trait_dataset["trait_names"],
"trait_sample_data": list(trait_dataset["input"].values()),
**form_data
@@ -98,8 +98,15 @@ def run_wgcna(form_data):
status_code = response.status_code
response = response.json()
+ parameters = {
+ "nstrains": len(unique_strains),
+ "nphe": len(trait_dataset["trait_names"]),
+ **{key: val for key, val in form_data.items() if key not in ["trait_list"]}
+ }
+
return {"error": response} if status_code != 200 else {
"error": 'null',
+ "parameters": parameters,
"results": response,
"data": process_wgcna_data(response["data"]),
"image": process_image(response["data"])