aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/templates/gn3_wgcna_results.html21
-rw-r--r--wqflask/wqflask/wgcna/gn3_wgcna.py13
2 files changed, 13 insertions, 21 deletions
diff --git a/wqflask/wqflask/templates/gn3_wgcna_results.html b/wqflask/wqflask/templates/gn3_wgcna_results.html
index 3a517954..8a31bf28 100644
--- a/wqflask/wqflask/templates/gn3_wgcna_results.html
+++ b/wqflask/wqflask/templates/gn3_wgcna_results.html
@@ -139,30 +139,15 @@
<script type="text/javascript">
-let results = {{results|safe}}
-
-let parameters = {{parameters|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}}
-
-let {MinModuleSize,TOMtype,corType,mergeCutHeight} = parameters
-
const summary = {
-
- strain_numbers:6,
-
- nphe:12,
-
modules_found:phenoMods.length,
- MinModuleSize,
- TOMtype,
- corType,
- mergeCutHeight
-
+ ...{{parameters|safe}}
+
}
$("#summary").DataTable( {
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"])