diff options
author | Alexander Kabui | 2021-12-06 16:13:46 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-12-13 15:48:00 +0300 |
commit | 9cea1a8d757461ea2359f4c72afa96c7180e417f (patch) | |
tree | 7e57cf5fb2392455b3a37a1fc6b64a402d859b4b | |
parent | 99d9c213f1c825af5b5bf6007521894b29131ba8 (diff) | |
download | genenetwork2-9cea1a8d757461ea2359f4c72afa96c7180e417f.tar.gz |
parse powers to use from form data
-rw-r--r-- | wqflask/wqflask/wgcna/gn3_wgcna.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/wqflask/wqflask/wgcna/gn3_wgcna.py b/wqflask/wqflask/wgcna/gn3_wgcna.py index 15728f22..6692a890 100644 --- a/wqflask/wqflask/wgcna/gn3_wgcna.py +++ b/wqflask/wqflask/wgcna/gn3_wgcna.py @@ -6,7 +6,7 @@ import requests from types import SimpleNamespace from utility.helper_functions import get_trait_db_obs -from utility.tools import GN_SERVER_URL +from utility.tools import GN3_LOCAL_URL def fetch_trait_data(requestform): @@ -75,13 +75,21 @@ def process_image(response): def run_wgcna(form_data): """function to run wgcna""" - wgcna_api = f"{GN_SERVER_URL}api/wgcna/run_wgcna" + 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"]) + + + + form_data["SoftThresholds"] = [int(threshold.strip()) + for threshold in form_data['SoftThresholds'].rstrip().split(",")] + + + response = requests.post(wgcna_api, json={ "sample_names": list(set(trait_dataset["sample_names"])), "trait_names": trait_dataset["trait_names"], @@ -91,6 +99,7 @@ def run_wgcna(form_data): } ).json() + return { "results": response, "data": process_wgcna_data(response["data"]), |