From 60286e7b1eeb3880e94e8671fbcea34da56adfb5 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 29 Sep 2021 11:09:01 +0300 Subject: test template for gn3 wgcna --- wqflask/wqflask/templates/test_wgcna_results.html | 146 ++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 wqflask/wqflask/templates/test_wgcna_results.html diff --git a/wqflask/wqflask/templates/test_wgcna_results.html b/wqflask/wqflask/templates/test_wgcna_results.html new file mode 100644 index 00000000..37ea2aa0 --- /dev/null +++ b/wqflask/wqflask/templates/test_wgcna_results.html @@ -0,0 +1,146 @@ +{% extends "base.html" %} +{% block title %}WCGNA results{% endblock %} + +{% block content %} + + +
+ + +
+
+ {% for key, value in results["data"]["output"]["soft_threshold"].items()%} + +
+

{{key}}

+ {% for val in value %} +

{{val|round(3)}}

+ + {% endfor %} + +
+ {% endfor %} + +
+ +
+

Net colors

+
+ {% for key,value in results["data"]["output"]["net_colors"].items() %} +
+

{{key}}

+

{{value}}

+
+ + {% endfor %} + +
+ + +
+ + +
+

Module eigen genes

+ +
+ {% for strain in results["data"]["input"]["sample_names"]%} + {{strain}} + {% endfor %} + {% for mod,values in results["data"]["output"]["ModEigens"].items() %} + {{mod}} {{values}} + + {% endfor %} + +
+ +
+ + + dsffsdf + + + +
+
+ + + +
+ + + +{% endblock %} + -- cgit v1.2.3 From 167ec0df8d8d487832e6a0acaee3eac8963d9804 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Fri, 1 Oct 2021 05:34:20 +0300 Subject: add xterm web terminal --- wqflask/wqflask/templates/test_wgcna_results.html | 225 +++++++++++----------- 1 file changed, 116 insertions(+), 109 deletions(-) diff --git a/wqflask/wqflask/templates/test_wgcna_results.html b/wqflask/wqflask/templates/test_wgcna_results.html index 37ea2aa0..f95766ad 100644 --- a/wqflask/wqflask/templates/test_wgcna_results.html +++ b/wqflask/wqflask/templates/test_wgcna_results.html @@ -1,146 +1,153 @@ {% extends "base.html" %} {% block title %}WCGNA results{% endblock %} +{% block content %} + -{% block content %} - -
+.control_net_colors { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + align-items: center; + text-align: center; +} -
-
- {% for key, value in results["data"]["output"]["soft_threshold"].items()%} -
-

{{key}}

- {% for val in value %} -

{{val|round(3)}}

- - {% endfor %} - -
- {% endfor %} +.control_mod_eigens { + display: grid; + grid-template-columns: repeat(2, 200px); +} -
+#terminal { -
-

Net colors

-
- {% for key,value in results["data"]["output"]["net_colors"].items() %} -
-

{{key}}

-

{{value}}

-
- - {% endfor %} + max-width: 768px; -
- + margin: 10px; -
- - -
-

Module eigen genes

- -
- {% for strain in results["data"]["input"]["sample_names"]%} - {{strain}} - {% endfor %} - {% for mod,values in results["data"]["output"]["ModEigens"].items() %} - {{mod}} {{values}} - - {% endfor %} - -
- -
- - - dsffsdf - +} + +
+
+
+
+
+
+
+ {% for key, value in results["data"]["output"]["soft_threshold"].items()%} +
+

{{key}}

+ {% for val in value %} +

{{val|round(3)}}

+ {% endfor %} +
+ {% endfor %} +
+
+

Net colors

+
+ {% for key,value in results["data"]["output"]["net_colors"].items() %} +
+

{{key}}

+

{{value}}

+
+ {% endfor %} +
+
+
+

Module eigen genes

+
+ {% for strain in results["data"]["input"]["sample_names"]%} + {{strain}} + {% endfor %} + {% for mod,values in results["data"]["output"]["ModEigens"].items() %} + {{mod}} {{values}} + {% endfor %} +
+ + +
+
+
+ + -{% endblock %} + writeToTerminal({ cursorBlink: true, lineHeight: 1.2 }, "terminal")(terminal_output) + +{% endblock %} \ No newline at end of file -- cgit v1.2.3 From 18b50f56d614021d5727d546f3d6e360575e4468 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 5 Oct 2021 19:07:24 +0300 Subject: work on wgcna_setup form --- wqflask/wqflask/templates/wgcna_setup.html | 54 ++++++++++++++++-------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/wqflask/wqflask/templates/wgcna_setup.html b/wqflask/wqflask/templates/wgcna_setup.html index c5461497..44932389 100644 --- a/wqflask/wqflask/templates/wgcna_setup.html +++ b/wqflask/wqflask/templates/wgcna_setup.html @@ -2,8 +2,10 @@ {% block title %}WCGNA analysis{% endblock %} {% block content %} -

WGCNA analysis parameters

+
+
+

WGCNA analysis parameters

{% if request.form['trait_list'].split(",")|length < 4 %} {% else %} -
- -
- -
- -
+ + +
+ +
+
-
- -
- -
+
+
+ +
+
-
- -
- -
+
+ +
+ +
+
-
- -
- -
+
+
+ +
+
+
-
+
- + {% endif %}
+
{% endblock %} -- cgit v1.2.3 From 31071d78f2ffb0ae4c7e0b99e74c7729a1a36e9c Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 5 Oct 2021 19:49:50 +0300 Subject: move xterm code to setup --- wqflask/wqflask/templates/wgcna_setup.html | 140 +++++++++++++++++++---------- 1 file changed, 94 insertions(+), 46 deletions(-) diff --git a/wqflask/wqflask/templates/wgcna_setup.html b/wqflask/wqflask/templates/wgcna_setup.html index 44932389..4b13e54e 100644 --- a/wqflask/wqflask/templates/wgcna_setup.html +++ b/wqflask/wqflask/templates/wgcna_setup.html @@ -1,53 +1,101 @@ {% extends "base.html" %} {% block title %}WCGNA analysis{% endblock %} - -{% block content %} - +{% block content %} + + + + +
-
-

WGCNA analysis parameters

- {% if request.form['trait_list'].split(",")|length < 4 %} - - {% else %} -
- -
- -
- -
-
-
- -
- -
-
- -
- -
- -
-
-
- -
- +
+

WGCNA analysis parameters

+ {% if request.form['trait_list'].split(",")|length < 4 %} -
-
-
- -
+ {% else %} + + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+ + {% endif %} +
+
+
+
+
- - {% endif %}
-{% endblock %} + +{% endblock %} \ No newline at end of file -- cgit v1.2.3 From 6f739fccbb7cff9f05b53ff4775ecee0761c293b Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 5 Oct 2021 19:50:37 +0300 Subject: js formatting --- wqflask/wqflask/templates/wgcna_setup.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wqflask/wqflask/templates/wgcna_setup.html b/wqflask/wqflask/templates/wgcna_setup.html index 4b13e54e..34690f29 100644 --- a/wqflask/wqflask/templates/wgcna_setup.html +++ b/wqflask/wqflask/templates/wgcna_setup.html @@ -84,11 +84,11 @@ document.addEventListener('DOMContentLoaded', function() { // open socket connection - const socket = io(`${GN_SERVER_URL}`) + const socket = io(`${GN_SERVER_URL}`) // add namespace - socket.on("output",({data})=>{ + socket.on("output", ({ data }) => { - term.writeln(data) + term.writeln(data) }) } else { -- cgit v1.2.3 From 37c37996424e826187ac3eca9ed4cd11b9715736 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 5 Oct 2021 19:52:51 +0300 Subject: code format for wgcna results file --- wqflask/wqflask/templates/test_wgcna_results.html | 61 +++++++++-------------- 1 file changed, 23 insertions(+), 38 deletions(-) diff --git a/wqflask/wqflask/templates/test_wgcna_results.html b/wqflask/wqflask/templates/test_wgcna_results.html index f95766ad..9484595f 100644 --- a/wqflask/wqflask/templates/test_wgcna_results.html +++ b/wqflask/wqflask/templates/test_wgcna_results.html @@ -2,13 +2,17 @@ {% block title %}WCGNA results{% endblock %} {% block content %} + + +
@@ -122,32 +118,21 @@ let terminal_output = results.output let { output } = results.data let sft = output.soft_threshold - - + -{% endblock %} \ No newline at end of file +{% endblock %} +** \ No newline at end of file -- cgit v1.2.3 From 6b4b7a5774f42ff6be1fb5fde6ba1fef632cd1a4 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 6 Oct 2021 11:48:50 +0300 Subject: add datatable for eigengenes --- wqflask/wqflask/templates/test_wgcna_results.html | 80 ++++++++++++++++------- 1 file changed, 57 insertions(+), 23 deletions(-) diff --git a/wqflask/wqflask/templates/test_wgcna_results.html b/wqflask/wqflask/templates/test_wgcna_results.html index 9484595f..ac82647d 100644 --- a/wqflask/wqflask/templates/test_wgcna_results.html +++ b/wqflask/wqflask/templates/test_wgcna_results.html @@ -2,8 +2,17 @@ {% block title %}WCGNA results{% endblock %} {% block content %} + - + + + + + + + + +
@@ -104,11 +113,12 @@
-
- - CLuster dendogram - + {% if image["image_generated"] %} +
+
+ + {% endif %}
@@ -161,12 +171,5 @@ $(document).ready(function(){ } ); }) - - - - - - - {% endblock %} \ No newline at end of file -- cgit v1.2.3 From 6578f6fa44dfa54bee29a16347bf3265ec6d76ad Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Sat, 9 Oct 2021 21:55:08 +0300 Subject: add function to process gn3 wgcna output --- wqflask/wqflask/wgcna/gn3_wgcna.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 wqflask/wqflask/wgcna/gn3_wgcna.py 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 -- cgit v1.2.3 From ef80c72194dd8a0b8868ece15589e0a3cf04516f Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Sat, 9 Oct 2021 21:55:39 +0300 Subject: unittest for processing wgcna output --- wqflask/tests/unit/wqflask/wgcna/__init__.py | 0 wqflask/tests/unit/wqflask/wgcna/test_wgcna.py | 50 ++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 wqflask/tests/unit/wqflask/wgcna/__init__.py create mode 100644 wqflask/tests/unit/wqflask/wgcna/test_wgcna.py diff --git a/wqflask/tests/unit/wqflask/wgcna/__init__.py b/wqflask/tests/unit/wqflask/wgcna/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/wqflask/tests/unit/wqflask/wgcna/test_wgcna.py b/wqflask/tests/unit/wqflask/wgcna/test_wgcna.py new file mode 100644 index 00000000..8e947e2f --- /dev/null +++ b/wqflask/tests/unit/wqflask/wgcna/test_wgcna.py @@ -0,0 +1,50 @@ + +"""module contains for processing gn3 wgcna data""" +from unittest import TestCase + +from wqflask.wgcna.gn3_wgcna import process_wgcna_data + + +class DataProcessingTests(TestCase): + """class contains data processing tests""" + + def test_data_processing(self): + """test for parsing data for datatable""" + output = { + "input": { + "sample_names": ["BXD1", "BXD2", "BXD3", "BXD4", "BXD5", "BXD6"], + + }, + "output": { + "ModEigens": { + "MEturquoise": [ + 0.0646677768085351, + 0.137200224277058, + 0.63451113720732, + -0.544002665501479, + -0.489487590361863, + 0.197111117570427 + ], + "MEgrey": [ + 0.213, + 0.214, + 0.3141, + -0.545, + -0.423, + 0.156, + ] + }}} + + row_data = [['BXD1', 0.065, 0.213], + ['BXD2', 0.137, 0.214], + ['BXD3', 0.635, 0.314], + ['BXD4', -0.544, -0.545], + ['BXD5', -0.489, -0.423], + ['BXD6', 0.197, 0.156]] + + expected_results = { + "col_names": ["sample_names", "MEturquoise", "MEgrey"], + "mod_dataset": row_data + } + + self.assertEqual(process_wgcna_data(output), expected_results) -- cgit v1.2.3 From 599ac567990a3881dc3821ad226a18ce538d1a17 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Sat, 9 Oct 2021 21:58:36 +0300 Subject: add function to process image data --- wqflask/wqflask/wgcna/gn3_wgcna.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/wqflask/wqflask/wgcna/gn3_wgcna.py b/wqflask/wqflask/wgcna/gn3_wgcna.py index 2657a099..225bef22 100644 --- a/wqflask/wqflask/wgcna/gn3_wgcna.py +++ b/wqflask/wqflask/wgcna/gn3_wgcna.py @@ -3,7 +3,6 @@ and process data to be rendered by datatables """ - def process_wgcna_data(response): """function for processing modeigene genes for create row data for datataba""" @@ -23,5 +22,12 @@ def process_wgcna_data(response): } -def process_image(): - pass \ No newline at end of file +def process_image(response): + """function to process image check if byte string is empty""" + image_data = response["output"]["image_data"] + return ({ + "image_generated": True, + "image_data": image_data + } if image_data else { + "image_generated": False + }) -- cgit v1.2.3 From 1b77d2417ba71ad7e2274429dd20c9272cb0f582 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Sat, 9 Oct 2021 22:00:26 +0300 Subject: function to fetch trait data --- wqflask/wqflask/wgcna/gn3_wgcna.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wqflask/wqflask/wgcna/gn3_wgcna.py b/wqflask/wqflask/wgcna/gn3_wgcna.py index 225bef22..f7ed4cef 100644 --- a/wqflask/wqflask/wgcna/gn3_wgcna.py +++ b/wqflask/wqflask/wgcna/gn3_wgcna.py @@ -3,6 +3,16 @@ and process data to be rendered by datatables """ +def fetch_trait_data(requestform): + """fetch trait data""" + db_obj = SimpleNamespace() + get_trait_db_obs(db_obj, + [trait.strip() + for trait in requestform['trait_list'].split(',')]) + + return process_dataset(db_obj.trait_list) + + def process_wgcna_data(response): """function for processing modeigene genes for create row data for datataba""" -- cgit v1.2.3 From c9ae69a30a972f47232f8457e9e1b8cd514f9832 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Sat, 9 Oct 2021 22:04:17 +0300 Subject: add function to process trait sample data --- wqflask/wqflask/wgcna/gn3_wgcna.py | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) 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""" -- cgit v1.2.3 From 585cd45c56ae4bc444336815cbde791b0c0d2e7b Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Sat, 9 Oct 2021 22:11:50 +0300 Subject: add function to call wgcna api --- wqflask/wqflask/wgcna/gn3_wgcna.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/wqflask/wqflask/wgcna/gn3_wgcna.py b/wqflask/wqflask/wgcna/gn3_wgcna.py index 9ab6b3e0..520f3d04 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 typing import SimpleNamespace from utility.helper_functions import get_trait_db_obs @@ -85,3 +86,33 @@ def process_image(response): } if image_data else { "image_generated": False }) + + +def run_wgcna(form_data): + """function to run wgcna""" + + wgcna_api = f"{GN3_URL}/api/wgcna/run_wgcna" + + # parse form data + + trait_dataset = fetch_trait_data(form_data) + + response = requests.post(wgcna_api, { + "socket_id": form_data.get("socket_id"), # streaming disabled + "sample_names": list(set(strains)), + "trait_names": form_traits, + "trait_sample_data": form_strains, + "TOMtype": form_data["TOMtype"], + "minModuleSize": int(form_data["MinModuleSize"]), + "corType": form_data["corType"] + + } + ).json() + + if response.status_code == 200: + return { + {"results": response, + "data": process_wgcna_data(response), + "image": process_image(response) + } + } -- cgit v1.2.3 From 9a17787cab82fe1c89dc68521eca9e6c8bb1dbb6 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Sun, 10 Oct 2021 01:44:45 +0300 Subject: pep8 formatting fix for parsing response data --- wqflask/wqflask/wgcna/gn3_wgcna.py | 66 ++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 38 deletions(-) diff --git a/wqflask/wqflask/wgcna/gn3_wgcna.py b/wqflask/wqflask/wgcna/gn3_wgcna.py index 520f3d04..96510223 100644 --- a/wqflask/wqflask/wgcna/gn3_wgcna.py +++ b/wqflask/wqflask/wgcna/gn3_wgcna.py @@ -1,10 +1,18 @@ """module contains code to consume gn3-wgcna api and process data to be rendered by datatables """ -from typing import SimpleNamespace + +import requests +from types import SimpleNamespace from utility.helper_functions import get_trait_db_obs +def validate_form(requestform): + return { + "" + } + + def fetch_trait_data(requestform): """fetch trait data""" db_obj = SimpleNamespace() @@ -31,30 +39,14 @@ def process_dataset(trait_list): for strain in trait[0].data: strains.append(strain) input_data[trait[0].name][strain] = trait[0].data[strain].value + # "sample_names": list(set(strains)), + # "trait_names": form_traits, + # "trait_sample_data": form_strains, 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 + "input": input_data, + "trait_names": traits, + "sample_names": strains } @@ -91,28 +83,26 @@ def process_image(response): def run_wgcna(form_data): """function to run wgcna""" + GN3_URL = "http://127.0.0.1:8081" + wgcna_api = f"{GN3_URL}/api/wgcna/run_wgcna" # parse form data trait_dataset = fetch_trait_data(form_data) + form_data["minModuleSize"] = int(form_data["MinModuleSize"]) - response = requests.post(wgcna_api, { - "socket_id": form_data.get("socket_id"), # streaming disabled - "sample_names": list(set(strains)), - "trait_names": form_traits, - "trait_sample_data": form_strains, - "TOMtype": form_data["TOMtype"], - "minModuleSize": int(form_data["MinModuleSize"]), - "corType": form_data["corType"] + response = requests.post(wgcna_api, json={ + "sample_names": list(set(trait_dataset["sample_names"])), + "trait_names": trait_dataset["trait_names"], + "trait_sample_data": list(trait_dataset["input"].values()), + **form_data } ).json() - if response.status_code == 200: - return { - {"results": response, - "data": process_wgcna_data(response), - "image": process_image(response) - } - } + return { + "results": response, + "data": process_wgcna_data(response["data"]), + "image": process_image(response["data"]) + } -- cgit v1.2.3 From b8a2b58cbf5bb96d86d59da7e72a9cb5f874fc41 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Sun, 10 Oct 2021 01:47:50 +0300 Subject: call run_wgcna in views && render test template --- wqflask/wqflask/views.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 44560427..a462b31a 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -39,8 +39,8 @@ from gn3.db.phenotypes import Probeset from gn3.db.phenotypes import Publication from gn3.db.phenotypes import PublishXRef from gn3.db.phenotypes import probeset_mapping -from gn3.db.traits import get_trait_csv_sample_data -from gn3.db.traits import update_sample_data +# from gn3.db.traits import get_trait_csv_sample_data +# from gn3.db.traits import update_sample_data from flask import current_app @@ -77,6 +77,7 @@ from wqflask.correlation_matrix import show_corr_matrix from wqflask.correlation import corr_scatter_plot # from wqflask.wgcna import wgcna_analysis # from wqflask.ctl import ctl_analysis +from wqflask.wgcna.gn3_wgcna import run_wgcna from wqflask.snp_browser import snp_browser from wqflask.search_results import SearchResultPage from wqflask.export_traits import export_search_results_csv @@ -365,18 +366,11 @@ def wcgna_setup(): return render_template("wgcna_setup.html", **request.form) -# @app.route("/wgcna_results", methods=('POST',)) -# def wcgna_results(): -# logger.info("In wgcna, request.form is:", request.form) -# logger.info(request.url) -# # Start R, load the package and pointers and create the analysis -# wgcna = wgcna_analysis.WGCNA() -# # Start the analysis, a wgcnaA object should be a separate long running thread -# wgcnaA = wgcna.run_analysis(request.form) -# # After the analysis is finished store the result -# result = wgcna.process_results(wgcnaA) -# # Display them using the template -# return render_template("wgcna_results.html", **result) +@app.route("/wgcna_results", methods=('POST',)) +def wcgna_results(): + """call the gn3 api to get wgcna response data""" + results = run_wgcna(dict(request.form)) + return render_template("test_wgcna_results.html", **results) @app.route("/ctl_setup", methods=('POST',)) -- cgit v1.2.3 From f07d5014a3d6756199bd206b4251f6d3b48bf165 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Sun, 10 Oct 2021 01:49:14 +0300 Subject: pep8 formatting && remove unused functions --- wqflask/wqflask/wgcna/gn3_wgcna.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/wqflask/wqflask/wgcna/gn3_wgcna.py b/wqflask/wqflask/wgcna/gn3_wgcna.py index 96510223..c4cc2e7f 100644 --- a/wqflask/wqflask/wgcna/gn3_wgcna.py +++ b/wqflask/wqflask/wgcna/gn3_wgcna.py @@ -7,12 +7,6 @@ from types import SimpleNamespace from utility.helper_functions import get_trait_db_obs -def validate_form(requestform): - return { - "" - } - - def fetch_trait_data(requestform): """fetch trait data""" db_obj = SimpleNamespace() -- cgit v1.2.3 From 63a161e2a6d3863720aa6814f1060bed22c22a39 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Sun, 10 Oct 2021 01:54:51 +0300 Subject: enable wgcna in gn2 toolbar --- wqflask/wqflask/templates/tool_buttons.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/templates/tool_buttons.html b/wqflask/wqflask/templates/tool_buttons.html index 3f9d8211..3ee5be19 100644 --- a/wqflask/wqflask/templates/tool_buttons.html +++ b/wqflask/wqflask/templates/tool_buttons.html @@ -18,13 +18,13 @@ BNW - +
- +
- - + {% if image["image_generated"] %}
@@ -140,13 +129,8 @@ let results = {{results|safe}} let phenoModules = results["data"]["output"]["net_colors"] -let phenotypes = Array.from(Object.keys(phenoModules)); +let phenotypes = Object.keys(phenoModules) let phenoMods = Object.values(phenoModules) -console.log(phenotypes) - - -console.log(typeof phenotypes); - let {col_names,mod_dataset} = {{data|safe}} $('#eigens').DataTable( { @@ -159,7 +143,6 @@ let {col_names,mod_dataset} = {{data|safe}} } ); $('#phenos').DataTable( { data:phenotypes.map((phenoName,idx)=>{ - console.log(phenoName) return [phenoName,phenoMods[idx]] }), columns: [{ -- cgit v1.2.3 From 1642c6bf0b8dee3bd3d4c32636a2c11ab97025a0 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Sun, 10 Oct 2021 12:02:01 +0300 Subject: replace form input with select options --- wqflask/wqflask/templates/wgcna_setup.html | 35 ++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/wqflask/wqflask/templates/wgcna_setup.html b/wqflask/wqflask/templates/wgcna_setup.html index 9d4bbfc7..86d9fa10 100644 --- a/wqflask/wqflask/templates/wgcna_setup.html +++ b/wqflask/wqflask/templates/wgcna_setup.html @@ -35,29 +35,42 @@
-
- -
- -
+ +
+ +
+ +
+
- +
-
- -
- -
+ +
+ +
+ +
+
+ + + {% endif %}
-- cgit v1.2.3 From db9225caf0a78b13af1892d47c69463e00262d03 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 13 Oct 2021 08:22:51 +0300 Subject: disable heatmap image --- wqflask/wqflask/templates/test_wgcna_results.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/templates/test_wgcna_results.html b/wqflask/wqflask/templates/test_wgcna_results.html index 0d253564..1dddd393 100644 --- a/wqflask/wqflask/templates/test_wgcna_results.html +++ b/wqflask/wqflask/templates/test_wgcna_results.html @@ -94,9 +94,9 @@
{% endif %} -
+
-- cgit v1.2.3