From 2f5b606af6dd1deb381e0acc0ef6605d6849fa63 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Mon, 7 Dec 2020 13:21:32 +0300 Subject: replace underscore js in templates --- wqflask/wqflask/templates/admin/create_group.html | 2 +- wqflask/wqflask/templates/comparison_bar_chart.html | 2 +- wqflask/wqflask/templates/correlation_matrix.html | 2 +- wqflask/wqflask/templates/correlation_page.html | 2 +- wqflask/wqflask/templates/heatmap.html | 2 +- wqflask/wqflask/templates/pair_scan_results.html | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wqflask/wqflask/templates/admin/create_group.html b/wqflask/wqflask/templates/admin/create_group.html index 5a6929fb..cb255ea9 100644 --- a/wqflask/wqflask/templates/admin/create_group.html +++ b/wqflask/wqflask/templates/admin/create_group.html @@ -82,7 +82,7 @@ {% block js %} - + diff --git a/wqflask/wqflask/templates/comparison_bar_chart.html b/wqflask/wqflask/templates/comparison_bar_chart.html index f791457f..6f5527db 100644 --- a/wqflask/wqflask/templates/comparison_bar_chart.html +++ b/wqflask/wqflask/templates/comparison_bar_chart.html @@ -31,7 +31,7 @@ - + diff --git a/wqflask/wqflask/templates/correlation_matrix.html b/wqflask/wqflask/templates/correlation_matrix.html index 4e150618..4b449927 100644 --- a/wqflask/wqflask/templates/correlation_matrix.html +++ b/wqflask/wqflask/templates/correlation_matrix.html @@ -133,7 +133,7 @@ - + diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 06ee9056..46257833 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -172,7 +172,7 @@ - + diff --git a/wqflask/wqflask/templates/heatmap.html b/wqflask/wqflask/templates/heatmap.html index 497838dd..4fa562cc 100644 --- a/wqflask/wqflask/templates/heatmap.html +++ b/wqflask/wqflask/templates/heatmap.html @@ -39,6 +39,6 @@ - + {% endblock %} \ No newline at end of file diff --git a/wqflask/wqflask/templates/pair_scan_results.html b/wqflask/wqflask/templates/pair_scan_results.html index f1646af7..684a331e 100644 --- a/wqflask/wqflask/templates/pair_scan_results.html +++ b/wqflask/wqflask/templates/pair_scan_results.html @@ -69,6 +69,6 @@ - + {% endblock %} \ No newline at end of file -- cgit v1.2.3 From f337f93af938612eb4e5ca95d97a6b339f9c8a0d Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Mon, 7 Dec 2020 13:23:40 +0300 Subject: replace underscore-string in templates --- wqflask/wqflask/templates/show_trait.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index 7b74a3f6..98b71a8b 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -131,7 +131,7 @@ - + -- cgit v1.2.3 From 699b211aee55703937df07a210756292114382d2 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 8 Dec 2020 13:27:18 +0300 Subject: add underscore.string.min.js to mechanical rob --- test/requests/link_checker.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/requests/link_checker.py b/test/requests/link_checker.py index 6ac26ba7..2bcef540 100644 --- a/test/requests/link_checker.py +++ b/test/requests/link_checker.py @@ -116,6 +116,7 @@ def check_packaged_js_files(args_obj, parser): "/js/nvd3/nv.d3.min.css", "/js/qtip2/jquery.qtip.min.js", "/js/js_alt/md5.min.js", + "/js/underscore-string/underscore.string.min.js", ] print("Checking links") -- cgit v1.2.3 From 28223e97e3e24c0ac759d7523d701b875cd6df7b Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 8 Dec 2020 17:04:41 -0600 Subject: Added method as a parameter for the correlation scatterplot so that it will default to the Spearman tab when the link is from a Spearman correlation --- wqflask/wqflask/correlation/corr_scatter_plot.py | 2 ++ wqflask/wqflask/templates/corr_scatterplot.html | 8 ++++---- wqflask/wqflask/templates/correlation_matrix.html | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/wqflask/wqflask/correlation/corr_scatter_plot.py b/wqflask/wqflask/correlation/corr_scatter_plot.py index 6ab8c3d8..c87776bb 100644 --- a/wqflask/wqflask/correlation/corr_scatter_plot.py +++ b/wqflask/wqflask/correlation/corr_scatter_plot.py @@ -29,6 +29,8 @@ class CorrScatterPlot(object): self.trait_2 = create_trait(name=params['trait_2'], dataset=self.dataset_2) #self.trait_3 = create_trait(name=params['trait_3'], dataset=self.dataset_3) + self.method = params['method'] + primary_samples = self.dataset_1.group.samplelist if self.dataset_1.group.parlist != None: primary_samples += self.dataset_1.group.parlist diff --git a/wqflask/wqflask/templates/corr_scatterplot.html b/wqflask/wqflask/templates/corr_scatterplot.html index 1133fcd2..cd1998fa 100644 --- a/wqflask/wqflask/templates/corr_scatterplot.html +++ b/wqflask/wqflask/templates/corr_scatterplot.html @@ -118,17 +118,17 @@ {% endif %}
-
+


@@ -243,7 +243,7 @@
-
+


diff --git a/wqflask/wqflask/templates/correlation_matrix.html b/wqflask/wqflask/templates/correlation_matrix.html index 96ad9c35..fb0380c9 100644 --- a/wqflask/wqflask/templates/correlation_matrix.html +++ b/wqflask/wqflask/templates/correlation_matrix.html @@ -32,6 +32,7 @@ {% endfor %} {% for trait in traits %} + {% set outer_loop = loop.index %} @@ -54,7 +55,7 @@ {% if result[1] == 0 %} N/A {% else %} - {{ '%0.2f' % result[1] }}
{{ result[2] }}
+ {{ '%0.2f' % result[1] }}
{{ result[2] }}
{% endif %} {% endif %} {% endfor %} -- cgit v1.2.3 From 77bf00aa228a0be2cc4ad083c9f0e3d98e1fd126 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 8 Dec 2020 17:05:49 -0600 Subject: Added method to the links to the scatterplot in the correlation paage --- wqflask/wqflask/templates/correlation_page.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 3cca7495..ee6c3aae 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -349,7 +349,7 @@ 'orderSequence': [ "desc", "asc"], 'render': function(data, type, row, meta) { if (data.sample_r != "N/A") { - return "" + data.sample_r + "" + return "" + data.sample_r + "" } else { return data.sample_r } @@ -470,7 +470,7 @@ 'orderSequence': [ "desc", "asc"], 'render': function(data, type, row, meta) { if (data.sample_r != "N/A") { - return "" + data.sample_r + "" + return "" + data.sample_r + "" } else { return data.sample_r } @@ -524,7 +524,7 @@ 'orderSequence': [ "desc", "asc"], 'render': function(data, type, row, meta) { if (data.sample_r != "N/A") { - return "" + data.sample_r + "" + return "" + data.sample_r + "" } else { return data.sample_r } -- cgit v1.2.3 From 05f8cf8e500a79eecb51db07e6dc5dd96131925e Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 10 Dec 2020 15:22:29 -0600 Subject: Added an export for the Correlation Matrix --- .../wqflask/correlation_matrix/show_corr_matrix.py | 43 +++++++++++++++++++--- wqflask/wqflask/templates/correlation_matrix.html | 17 ++++++++- wqflask/wqflask/views.py | 11 ++++++ 3 files changed, 64 insertions(+), 7 deletions(-) diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py index 0269ce68..a77877d2 100644 --- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py +++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py @@ -20,24 +20,23 @@ import datetime import math +import random +import string + import numpy as np import scipy import rpy2.robjects as robjects -import utility.webqtlUtil # this is for parallel computing only. -import utility.logger +from rpy2.robjects.packages import importr from base import data_set +from base.webqtlConfig import GENERATED_TEXT_DIR from functools import reduce from functools import cmp_to_key -from rpy2.robjects.packages import importr - from utility import webqtlUtil from utility import helper_functions from utility import corr_result_helpers from utility.redis_tools import get_redis_conn -logger = utility.logger.getLogger(__name__) - Redis = get_redis_conn() THIRTY_DAYS = 60 * 60 * 24 * 30 @@ -135,6 +134,8 @@ class CorrelationMatrix(object): self.corr_results.append(corr_result_row) self.pca_corr_results.append(pca_corr_result_row) + self.export_filename, self.export_filepath = export_corr_matrix(self.corr_results) + self.trait_data_array = [] for trait_db in self.trait_list: this_trait = trait_db[0] @@ -232,6 +233,36 @@ class CorrelationMatrix(object): loadings_array.append(loadings_row) return loadings_array +def export_corr_matrix(corr_results): + corr_matrix_filename = "corr_matrix_" + ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(6)) + matrix_export_path = "{}{}.csv".format(GENERATED_TEXT_DIR, corr_matrix_filename) + with open(matrix_export_path, "w+") as output_file: + output_file.write("Time/Date: " + datetime.datetime.now().strftime("%x / %X") + "\n") + output_file.write("\n") + output_file.write("Correlation ") + for i, item in enumerate(corr_results[0]): + output_file.write("Trait" + str(i + 1) + ": " + str(item[0].dataset.name) + "::" + str(item[0].name) + "\t") + output_file.write("\n") + for i, row in enumerate(corr_results): + output_file.write("Trait" + str(i + 1) + ": " + str(row[0][0].dataset.name) + "::" + str(row[0][0].name) + "\t") + for item in row: + output_file.write(str(item[1]) + "\t") + output_file.write("\n") + + output_file.write("\n") + output_file.write("\n") + output_file.write("N ") + for i, item in enumerate(corr_results[0]): + output_file.write("Trait" + str(i) + ": " + str(item[0].dataset.name) + "::" + str(item[0].name) + "\t") + output_file.write("\n") + for i, row in enumerate(corr_results): + output_file.write("Trait" + str(i) + ": " + str(row[0][0].dataset.name) + "::" + str(row[0][0].name) + "\t") + for item in row: + output_file.write(str(item[2]) + "\t") + output_file.write("\n") + + return corr_matrix_filename, matrix_export_path + def zScore(trait_data_array): NN = len(trait_data_array[0]) if NN < 10: diff --git a/wqflask/wqflask/templates/correlation_matrix.html b/wqflask/wqflask/templates/correlation_matrix.html index 96ad9c35..78d7e9aa 100644 --- a/wqflask/wqflask/templates/correlation_matrix.html +++ b/wqflask/wqflask/templates/correlation_matrix.html @@ -1,10 +1,11 @@ {% extends "base.html" %} +{% block title %}Correlation Matrix{% endblock %} {% block css %} - + {% endblock %} {% block content %} @@ -63,6 +64,12 @@
+
+ + + +
+
{% if pca_works == "True" %}

PCA Traits

@@ -172,6 +179,14 @@ "paging": false, "orderClasses": true } ); + + export_corr_matrix = function() { + $('#matrix_export_form').attr('action', '/export_corr_matrix'); + return $('#matrix_export_form').submit(); + } + + $('#export').click(export_corr_matrix); + {% endblock %} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 3557a62a..25563e86 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -799,6 +799,17 @@ def export_mapping_results(): return response +@app.route("/export_corr_matrix", methods = ('POST',)) +def export_corr_matrix(): + file_path = request.form.get("export_filepath") + file_name = request.form.get("export_filename") + results_csv = open(file_path, "r").read() + response = Response(results_csv, + mimetype='text/csv', + headers={"Content-Disposition":"attachment;filename=" + file_name + ".csv"}) + + return response + @app.route("/export", methods = ('POST',)) def export(): logger.info("request.form:", request.form) -- cgit v1.2.3 From 67ec0db7ef88a4ce49f6f6161bea978674f7123a Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 15 Dec 2020 14:52:39 +0300 Subject: Replace twitter-post-fetcher (#526) * replace twitter fetcher in templates * add twitter post fetcher to mechanical rob Co-authored-by: BonfaceKilz --- test/requests/link_checker.py | 1 + wqflask/wqflask/templates/index_page_orig.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/requests/link_checker.py b/test/requests/link_checker.py index 0a371bb8..64707514 100644 --- a/test/requests/link_checker.py +++ b/test/requests/link_checker.py @@ -137,6 +137,7 @@ def check_packaged_js_files(args_obj, parser): "/js/cytoscape-panzoom/cytoscape.js-panzoom.css", "/js/cytoscape-qtip/cytoscape-qtip.js", "/css/d3-tip/d3-tip.css", + "/js/javascript-twitter-post-fetcher/js/twitterFetcher_min.js", "/js/DataTables/images/sort_asc_disabled.png", "/js/DataTables/images/sort_desc_disabled.png", ] diff --git a/wqflask/wqflask/templates/index_page_orig.html b/wqflask/wqflask/templates/index_page_orig.html index 13ca52df..7efbdccf 100755 --- a/wqflask/wqflask/templates/index_page_orig.html +++ b/wqflask/wqflask/templates/index_page_orig.html @@ -326,7 +326,7 @@ } - + - + -- cgit v1.2.3