aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabui2021-10-09 22:04:17 +0300
committerAlexander Kabui2021-10-09 22:04:17 +0300
commitc9ae69a30a972f47232f8457e9e1b8cd514f9832 (patch)
treeaafb8b3c7b5124151a606484f7dade4813f7ef0f
parent1b77d2417ba71ad7e2274429dd20c9272cb0f582 (diff)
downloadgenenetwork2-c9ae69a30a972f47232f8457e9e1b8cd514f9832.tar.gz
add function to process trait sample data
-rw-r--r--wqflask/wqflask/wgcna/gn3_wgcna.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/wqflask/wqflask/wgcna/gn3_wgcna.py b/wqflask/wqflask/wgcna/gn3_wgcna.py
index f7ed4cef..9ab6b3e0 100644
--- a/wqflask/wqflask/wgcna/gn3_wgcna.py
+++ b/wqflask/wqflask/wgcna/gn3_wgcna.py
@@ -1,6 +1,7 @@
"""module contains code to consume gn3-wgcna api
and process data to be rendered by datatables
"""
+from utility.helper_functions import get_trait_db_obs
def fetch_trait_data(requestform):
@@ -13,6 +14,49 @@ def fetch_trait_data(requestform):
return process_dataset(db_obj.trait_list)
+def process_dataset(trait_list):
+ """process datasets and strains"""
+
+ input_data = {}
+ traits = []
+ strains = []
+
+ # xtodo unique traits and strains
+
+ for trait in trait_list:
+ traits.append(trait[0].name)
+
+ input_data[trait[0].name] = {}
+ for strain in trait[0].data:
+ strains.append(strain)
+ input_data[trait[0].name][strain] = trait[0].data[strain].value
+
+ return {
+ "wgcna_input": input_data
+ }
+
+ def process_dataset(trait_list):
+ """process datasets and strains"""
+
+ input_data = {}
+ traits = []
+ strains = []
+
+ # xtodo unique traits and strains
+
+ for trait in trait_list:
+ traits.append(trait[0].name)
+
+ input_data[trait[0].name] = {}
+ for strain in trait[0].data:
+ strains.append(strain)
+ input_data[trait[0].name][strain] = trait[0].data[strain].value
+
+ return {
+ "wgcna_input": input_data
+ }
+
+
def process_wgcna_data(response):
"""function for processing modeigene genes
for create row data for datataba"""