From b158f11588afc4c93c5daf17ed0195f392e2e2d7 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Fri, 18 Mar 2022 14:56:57 +0300 Subject: integrate scree plot --- wqflask/wqflask/templates/correlation_matrix.html | 6 ++++++ wqflask/wqflask/templates/pca_scree_plot.html | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/correlation_matrix.html b/wqflask/wqflask/templates/correlation_matrix.html index 3da6981c..e90accf2 100644 --- a/wqflask/wqflask/templates/correlation_matrix.html +++ b/wqflask/wqflask/templates/correlation_matrix.html @@ -71,6 +71,12 @@
+ +
+ {% include 'pca_scree_plot.html' %} + +
+ {% if pca_works == "True" %}

PCA Traits

diff --git a/wqflask/wqflask/templates/pca_scree_plot.html b/wqflask/wqflask/templates/pca_scree_plot.html index 41036333..b0ef78d0 100644 --- a/wqflask/wqflask/templates/pca_scree_plot.html +++ b/wqflask/wqflask/templates/pca_scree_plot.html @@ -15,11 +15,11 @@ -- cgit v1.2.3 From 0964e2563a96130e306edd31cd91fee4b378697d Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Fri, 18 Mar 2022 14:57:25 +0300 Subject: code to fetch scree data from gn3 --- wqflask/wqflask/correlation_matrix/show_corr_matrix.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'wqflask') diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py index 88d62045..cf37b9e9 100644 --- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py +++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py @@ -37,6 +37,7 @@ from gn3.computations.pca import compute_pca from gn3.computations.pca import process_factor_loadings_tdata from gn3.computations.pca import generate_pca_temp_traits from gn3.computations.pca import cache_pca_dataset +from gn3.computations.pca import generate_scree_plot_data class CorrelationMatrix: @@ -169,6 +170,7 @@ class CorrelationMatrix: pca = self.calculate_pca() self.loadings_array = process_factor_loadings_tdata( factor_loadings=self.loadings, traits_num=len(self.trait_list)) + else: self.pca_works = "False" except: @@ -176,6 +178,7 @@ class CorrelationMatrix: self.js_data = dict(traits=[trait.name for trait in self.traits], groups=groups, + scree_data = self.scree_data, cols=list(range(len(self.traits))), rows=list(range(len(self.traits))), samples=self.all_sample_list, @@ -187,6 +190,7 @@ class CorrelationMatrix: self.loadings = pca["components"] self.scores = pca["scores"] + self.pca_obj = pca["pca"] this_group_name = self.trait_list[0][1].group.name temp_dataset = create_dataset( @@ -205,6 +209,13 @@ class CorrelationMatrix: self.pca_trait_ids = list(pca_temp_traits.keys()) + x_coord, y_coord = generate_scree_plot_data( + list(self.pca_obj.explained_variance_ratio_)) + + self.scree_data = { + "x_coord": x_coord, + "y_coord": y_coord + } return pca -- cgit v1.2.3 From 11c94876a376539030d9645a1779abff62858c65 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Fri, 18 Mar 2022 16:32:28 +0300 Subject: fixes for ImageButtonOptions --- wqflask/wqflask/templates/pca_scree_plot.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/pca_scree_plot.html b/wqflask/wqflask/templates/pca_scree_plot.html index b0ef78d0..e0b854fa 100644 --- a/wqflask/wqflask/templates/pca_scree_plot.html +++ b/wqflask/wqflask/templates/pca_scree_plot.html @@ -9,7 +9,7 @@
- pca scree plot +
@@ -23,7 +23,7 @@ let { x_coord, y_coord } = js_data["scree_data"] const layout = { title: { - text: "Scree Plot", + text: "Pca Scree Plot", font: { "size": 24, "family": "Arial", @@ -77,8 +77,8 @@ let custom_configs = (filename, download_format, modebar = true) => { displayModeBar: modebar, scrollZoom: false, toImageButtonOptions: { - download_format, filename, + format:download_format, height: 600, width: 700, scale: 1 -- cgit v1.2.3 From 5c941a9872f70d9be4d54badb536dc5ef04a0223 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Fri, 18 Mar 2022 16:49:00 +0300 Subject: remove correlation test button --- wqflask/wqflask/templates/show_trait_calculate_correlations.html | 3 --- 1 file changed, 3 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/show_trait_calculate_correlations.html b/wqflask/wqflask/templates/show_trait_calculate_correlations.html index 16a819fa..2f98f14e 100644 --- a/wqflask/wqflask/templates/show_trait_calculate_correlations.html +++ b/wqflask/wqflask/templates/show_trait_calculate_correlations.html @@ -119,9 +119,6 @@
-
- -
-- cgit v1.2.3 From 33605e355b7335138dd75ef3ffe29d095533933d Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Fri, 18 Mar 2022 16:51:30 +0300 Subject: add uniform font for title --- wqflask/wqflask/templates/pca_scree_plot.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/pca_scree_plot.html b/wqflask/wqflask/templates/pca_scree_plot.html index e0b854fa..11bfebff 100644 --- a/wqflask/wqflask/templates/pca_scree_plot.html +++ b/wqflask/wqflask/templates/pca_scree_plot.html @@ -27,7 +27,7 @@ const layout = { font: { "size": 24, "family": "Arial", - "color": "#FF0000" + "color": "#000000" } }, -- cgit v1.2.3