aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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"""