diff options
author | Alexander Kabui | 2021-10-09 22:04:17 +0300 |
---|---|---|
committer | Alexander Kabui | 2021-10-09 22:04:17 +0300 |
commit | c9ae69a30a972f47232f8457e9e1b8cd514f9832 (patch) | |
tree | aafb8b3c7b5124151a606484f7dade4813f7ef0f /wqflask | |
parent | 1b77d2417ba71ad7e2274429dd20c9272cb0f582 (diff) | |
download | genenetwork2-c9ae69a30a972f47232f8457e9e1b8cd514f9832.tar.gz |
add function to process trait sample data
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/wgcna/gn3_wgcna.py | 44 |
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""" |