aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabui2021-10-09 21:55:08 +0300
committerAlexander Kabui2021-10-09 21:55:08 +0300
commit6578f6fa44dfa54bee29a16347bf3265ec6d76ad (patch)
tree6942cf04ae1d57ebfc2dd825862b4823b50a58f2
parent3af474a660d30bf618452bd44438a7cc768b8667 (diff)
downloadgenenetwork2-6578f6fa44dfa54bee29a16347bf3265ec6d76ad.tar.gz
add function to process gn3 wgcna output
-rw-r--r--wqflask/wqflask/wgcna/gn3_wgcna.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/wqflask/wqflask/wgcna/gn3_wgcna.py b/wqflask/wqflask/wgcna/gn3_wgcna.py
new file mode 100644
index 00000000..2657a099
--- /dev/null
+++ b/wqflask/wqflask/wgcna/gn3_wgcna.py
@@ -0,0 +1,27 @@
+"""module contains code to consume gn3-wgcna api
+and process data to be rendered by datatables
+"""
+
+
+
+def process_wgcna_data(response):
+ """function for processing modeigene genes
+ for create row data for datataba"""
+ mod_eigens = response["output"]["ModEigens"]
+
+ sample_names = response["input"]["sample_names"]
+
+ mod_dataset = [[sample] for sample in sample_names]
+
+ for _, mod_values in mod_eigens.items():
+ for (index, _sample) in enumerate(sample_names):
+ mod_dataset[index].append(round(mod_values[index], 3))
+
+ return {
+ "col_names": ["sample_names", *mod_eigens.keys()],
+ "mod_dataset": mod_dataset
+ }
+
+
+def process_image():
+ pass \ No newline at end of file