From 9cea1a8d757461ea2359f4c72afa96c7180e417f Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Mon, 6 Dec 2021 16:13:46 +0300 Subject: parse powers to use from form data --- wqflask/wqflask/wgcna/gn3_wgcna.py | 13 +++++++++++-- 1 file 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"]), -- cgit v1.2.3