From ef38724c31567b56214026999a944f9088fe30b8 Mon Sep 17 00:00:00 2001 From: uditgulati Date: Sun, 28 Jun 2020 11:23:27 -0500 Subject: make stains headers names horizontal --- wqflask/wqflask/templates/snp_browser.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/snp_browser.html b/wqflask/wqflask/templates/snp_browser.html index fb564b28..7019e943 100644 --- a/wqflask/wqflask/templates/snp_browser.html +++ b/wqflask/wqflask/templates/snp_browser.html @@ -195,7 +195,7 @@ {{ header }} {% endfor %} {% for strain in header_fields[1] %} - {% for letter in strain %}
{{ letter }}
{% endfor %} + {{ strain }} {% endfor %} {% else %} {% for header in header_fields %} -- cgit v1.2.3 From 88715630c4d18d962a7473dcac7e34b1b9c098a0 Mon Sep 17 00:00:00 2001 From: uditgulati Date: Sun, 28 Jun 2020 11:24:12 -0500 Subject: add DataTables pagination --- wqflask/wqflask/templates/snp_browser.html | 1 - 1 file changed, 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/snp_browser.html b/wqflask/wqflask/templates/snp_browser.html index 7019e943..3b97963c 100644 --- a/wqflask/wqflask/templates/snp_browser.html +++ b/wqflask/wqflask/templates/snp_browser.html @@ -407,7 +407,6 @@ {% endif %} 'order': [[1, "asc" ]], 'sDom': "rtip", - 'iDisplayLength': 500, 'processing': true, 'language': { 'loadingRecords': ' ', -- cgit v1.2.3 From 73e3f354b0bf6accfd884f0fab8ef93f03be7945 Mon Sep 17 00:00:00 2001 From: uditgulati Date: Sun, 28 Jun 2020 11:28:28 -0500 Subject: fix typo in check_if_in_gene function while querying for species_id = 0 --- wqflask/wqflask/snp_browser/snp_browser.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/snp_browser/snp_browser.py b/wqflask/wqflask/snp_browser/snp_browser.py index 6c3fcf53..a2fb7195 100644 --- a/wqflask/wqflask/snp_browser/snp_browser.py +++ b/wqflask/wqflask/snp_browser/snp_browser.py @@ -526,7 +526,6 @@ class SnpBrowser(object): the_rows.append(this_row) return the_rows - def include_record(self, domain, function, snp_source, conservation_score): """ Decide whether to add this record """ @@ -868,8 +867,6 @@ def get_gene_id_name_dict(species_id, gene_name_list): if len(results) > 0: for item in results: gene_id_name_dict[item[1]] = item[0] - else: - pass return gene_id_name_dict @@ -883,7 +880,7 @@ def check_if_in_gene(species_id, chr, mb): query = """SELECT geneId,geneSymbol FROM GeneList WHERE chromosome = '{0}' AND - (txStart < {1} AND txEnd > {1}); """.format(species_id, chr, mb) + (txStart < {1} AND txEnd > {1}); """.format(chr, mb) result = g.db.execute(query).fetchone() -- cgit v1.2.3 From 429aff0920b1fddf71e4547c35a726b11e6713a0 Mon Sep 17 00:00:00 2001 From: uditgulati Date: Tue, 30 Jun 2020 14:14:53 -0500 Subject: 500 rows per page for DataTables --- wqflask/wqflask/templates/snp_browser.html | 1 + 1 file changed, 1 insertion(+) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/snp_browser.html b/wqflask/wqflask/templates/snp_browser.html index 3b97963c..7019e943 100644 --- a/wqflask/wqflask/templates/snp_browser.html +++ b/wqflask/wqflask/templates/snp_browser.html @@ -407,6 +407,7 @@ {% endif %} 'order': [[1, "asc" ]], 'sDom': "rtip", + 'iDisplayLength': 500, 'processing': true, 'language': { 'loadingRecords': ' ', -- cgit v1.2.3 From 776ccfbb2fc5a6e85c7a41efd92b33b0e27de68a Mon Sep 17 00:00:00 2001 From: uditgulati Date: Tue, 30 Jun 2020 14:56:22 -0500 Subject: reduce gap between first and second column in form --- wqflask/wqflask/templates/snp_browser.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/snp_browser.html b/wqflask/wqflask/templates/snp_browser.html index 7019e943..73359835 100644 --- a/wqflask/wqflask/templates/snp_browser.html +++ b/wqflask/wqflask/templates/snp_browser.html @@ -15,7 +15,7 @@ -
+
@@ -74,7 +74,7 @@
-
+
@@ -108,7 +108,7 @@
-
+
-- cgit v1.2.3 From 3a792dbe74ab181d2fa9582f67c99b68ffad0c10 Mon Sep 17 00:00:00 2001 From: uditgulati Date: Tue, 30 Jun 2020 15:38:04 -0500 Subject: align numeric data values to right, categorial values to center --- wqflask/wqflask/templates/snp_browser.html | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/snp_browser.html b/wqflask/wqflask/templates/snp_browser.html index 73359835..816d5f0f 100644 --- a/wqflask/wqflask/templates/snp_browser.html +++ b/wqflask/wqflask/templates/snp_browser.html @@ -272,7 +272,8 @@ return '' } }, { - 'data': 'index' + 'data': 'index', + 'className': 'dt-body-right' }, { 'data': null, 'render': function(data, type, row, meta) { @@ -283,9 +284,11 @@ } } }, { - 'data': 'chr' + 'data': 'chr', + 'className': 'dt-body-center' }, { - 'data': 'mb_formatted' + 'data': 'mb_formatted', + 'className': 'dt-body-right' }, { 'data': 'alleles' }, {% if empty_columns['snp_source'] == "true" %}{ @@ -298,7 +301,8 @@ } } }, {% endif %} {% if empty_columns['conservation_score'] == "true" %}{ - 'data': 'conservation_score' + 'data': 'conservation_score', + 'className': 'dt-body-right' }, {% endif %} {% if empty_columns['gene_name'] == "true" %}{ 'data': null, 'render': function(data, type, row, meta) { @@ -383,21 +387,26 @@ return '' } }, { - 'data': 'index' + 'data': 'index', + 'className': 'dt-body-right' }, { 'data': 'indel_name' }, { 'data': 'indel_type' }, { - 'data': 'indel_chr' + 'data': 'indel_chr', + 'className': 'dt-body-center' }, { - 'data': 'indel_mb_s' + 'data': 'indel_mb_s', + 'className': 'dt-body-right' }, { - 'data': 'indel_mb_e' + 'data': 'indel_mb_e', + 'className': 'dt-body-right' }, { 'data': 'indel_strand' }, { - 'data': 'indel_size' + 'data': 'indel_size', + 'className': 'dt-body-right' }, { 'data': 'indel_sequence' }, { -- cgit v1.2.3 From f7b7950533f52e418c2be569cca409ae1fb3faf0 Mon Sep 17 00:00:00 2001 From: uditgulati Date: Tue, 30 Jun 2020 16:48:02 -0500 Subject: rotate strain headers 270 deg --- wqflask/wqflask/templates/snp_browser.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/snp_browser.html b/wqflask/wqflask/templates/snp_browser.html index 816d5f0f..36f893bc 100644 --- a/wqflask/wqflask/templates/snp_browser.html +++ b/wqflask/wqflask/templates/snp_browser.html @@ -195,7 +195,7 @@ {{ header }} {% endfor %} {% for strain in header_fields[1] %} - {{ strain }} + {% for letter in strain|reverse %}
{{ letter }}
{% endfor %} {% endfor %} {% else %} {% for header in header_fields %} -- cgit v1.2.3 From 7a4068d6d46d923c30316887e1d20f2fa6caa859 Mon Sep 17 00:00:00 2001 From: uditgulati Date: Fri, 10 Jul 2020 10:15:22 -0500 Subject: add export to CSV button to export current page --- wqflask/wqflask/templates/snp_browser.html | 43 +++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/snp_browser.html b/wqflask/wqflask/templates/snp_browser.html index 36f893bc..284b55c5 100644 --- a/wqflask/wqflask/templates/snp_browser.html +++ b/wqflask/wqflask/templates/snp_browser.html @@ -107,6 +107,12 @@
+
+ +
+ +
+
@@ -192,14 +198,14 @@ {% if header_fields|length == 2 %} {% for header in header_fields[0] %} - {{ header }} + {{ header }} {% endfor %} {% for strain in header_fields[1] %} - {% for letter in strain|reverse %}
{{ letter }}
{% endfor %} + {% for letter in strain|reverse %}
{{ letter }}
{% endfor %} {% endfor %} {% else %} {% for header in header_fields %} - {{ header }} + {{ header }} {% endfor %} {% endif %} @@ -518,6 +524,37 @@ }); $("input[name=chosen_strains]").val(strain_list.join(",")); }); + + $("input[name=export_csv]").click(function() { + var csv = []; + var rows = document.querySelectorAll("table tr"); + + var headers = []; + var col_header = rows[0].querySelectorAll("th"); + console.log(col_header.length); + for(var i = 1; i < col_header.length; i++) { + console.log(col_header[i].getAttribute("name")); + headers.push(col_header[i].getAttribute("name")); + } + csv.push(headers.join(",")); + + for (var i = 1; i < rows.length; i++) { + var row = [], cols = rows[i].querySelectorAll("td"); + + for (var j = 1; j < cols.length; j++) + row.push(cols[j].innerText); + + csv.push(row.join(",")); + } + + var csvFile = new Blob([csv.join("\n")], {type: "text/csv"}); + var downloadLink = document.createElement("a"); + downloadLink.download = "hello.csv"; + downloadLink.href = window.URL.createObjectURL(csvFile); + downloadLink.style.display = "none"; + document.body.appendChild(downloadLink); + downloadLink.click(); + }); {% endblock %} -- cgit v1.2.3 From f99b69155d35900a75c000fbb79f6bcfb3fa6ff1 Mon Sep 17 00:00:00 2001 From: uditgulati Date: Fri, 10 Jul 2020 10:30:04 -0500 Subject: export only checked rows to csv; update csv file name --- wqflask/wqflask/templates/snp_browser.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/snp_browser.html b/wqflask/wqflask/templates/snp_browser.html index 284b55c5..83606804 100644 --- a/wqflask/wqflask/templates/snp_browser.html +++ b/wqflask/wqflask/templates/snp_browser.html @@ -531,25 +531,27 @@ var headers = []; var col_header = rows[0].querySelectorAll("th"); - console.log(col_header.length); for(var i = 1; i < col_header.length; i++) { - console.log(col_header[i].getAttribute("name")); headers.push(col_header[i].getAttribute("name")); } csv.push(headers.join(",")); for (var i = 1; i < rows.length; i++) { var row = [], cols = rows[i].querySelectorAll("td"); + var checkBox = rows[i].querySelector("input"); + console.log(checkBox); - for (var j = 1; j < cols.length; j++) - row.push(cols[j].innerText); + if(checkBox.checked == true) { + for (var j = 1; j < cols.length; j++) + row.push(cols[j].innerText); - csv.push(row.join(",")); + csv.push(row.join(",")); + } } var csvFile = new Blob([csv.join("\n")], {type: "text/csv"}); var downloadLink = document.createElement("a"); - downloadLink.download = "hello.csv"; + downloadLink.download = "variant_data.csv"; downloadLink.href = window.URL.createObjectURL(csvFile); downloadLink.style.display = "none"; document.body.appendChild(downloadLink); -- cgit v1.2.3 From 349b395375703e727465a1f05f4a5e2d4fc64d2a Mon Sep 17 00:00:00 2001 From: uditgulati Date: Sun, 19 Jul 2020 17:21:15 -0500 Subject: add server side processing due to large tables in DataTables; work on server-side processing API pending for sorting, paging etc --- wqflask/wqflask/snp_browser/snp_browser.py | 39 ++++++++++++++++++++++-------- wqflask/wqflask/templates/snp_browser.html | 26 +++++++++++++++----- wqflask/wqflask/views.py | 10 ++++++++ 3 files changed, 59 insertions(+), 16 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/snp_browser/snp_browser.py b/wqflask/wqflask/snp_browser/snp_browser.py index a2fb7195..9ae8892b 100644 --- a/wqflask/wqflask/snp_browser/snp_browser.py +++ b/wqflask/wqflask/snp_browser/snp_browser.py @@ -4,7 +4,7 @@ import string from PIL import (Image) from utility.logger import getLogger -logger = getLogger(__name__ ) +logger = getLogger(__name__) from base import species from base import webqtlConfig @@ -14,16 +14,16 @@ class SnpBrowser(object): def __init__(self, start_vars): self.strain_lists = get_browser_sample_lists() self.initialize_parameters(start_vars) - self.limit_number = 10000 if self.first_run == "false": self.filtered_results = self.get_browser_results() + self.table_rows = self.get_table_rows() + self.rows_count = len(self.table_rows) - if len(self.filtered_results) <= self.limit_number: - self.table_rows = self.get_table_rows() - else: - self.empty_columns = None - self.table_rows = [] + del self.filtered_results + + if 'sEcho' not in start_vars: + self.table_rows = self.table_rows[:500] if self.limit_strains == "true": self.header_fields, self.empty_field_count = get_header_list(variant_type = self.variant_type, strains = self.chosen_strains, empty_columns = self.empty_columns) @@ -380,7 +380,7 @@ class SnpBrowser(object): the_rows = [] for i, result in enumerate(self.filtered_results): - this_row = [] + this_row = {} if self.variant_type == "SNP": snp_name, rs, chr, mb, alleles, gene, transcript, exon, domain, function, function_details, snp_source, conservation_score, snp_id = result[:14] allele_value_list = result[14:] @@ -520,8 +520,6 @@ class SnpBrowser(object): "source_name": str(source_name) } #this_row = [indel_name, indel_chr, indel_mb_s, indel_mb_e, indel_strand, indel_type, indel_size, indel_sequence, source_name] - else: - this_row = {} the_rows.append(this_row) @@ -643,6 +641,27 @@ class SnpBrowser(object): #for i in range(n_click): # href = url_for('snp_browser', first_run="false", chosen_strains_mouse=self.chosen_strains_mouse, chosen_strains_rat=self.chosen_strains_rat, variant=self.variant_type, species=self.species_name, gene_name=self.gene_name, chr=self.chr, start_mb=self.start_mb, end_mb=self.end_mb, limit_strains=self.limit_strains, domain=self.domain, function=self.function, criteria=self.criteria, score=self.score, diff_alleles=self.diff_alleles) +class SnpPage(object): + + def __init__(self, start_vars): + self.snp_browser = SnpBrowser(start_vars) + # self.table_rows = self.filter_rows() + self.rows_count = self.snp_browser.rows_count + self.sEcho = start_vars['sEcho'] + + def filter_rows(self): + pass + + def get_page(self): + output = {} + output['sEcho'] = str(self.sEcho) + output['iTotalRecords'] = str(self.rows_count) + output['iTotalDisplayRecords'] = str(100) + # logger.info(len(self.table_rows), type(self.table_rows), self.table_rows[0]) + logger.info(self.snp_browser.rows_count, len(self.snp_browser.table_rows)) + output['data'] = self.snp_browser.table_rows[:100] + return output + def get_browser_sample_lists(species_id=1): strain_lists = {} mouse_strain_list = [] diff --git a/wqflask/wqflask/templates/snp_browser.html b/wqflask/wqflask/templates/snp_browser.html index 83606804..f3e928af 100644 --- a/wqflask/wqflask/templates/snp_browser.html +++ b/wqflask/wqflask/templates/snp_browser.html @@ -188,10 +188,7 @@
- {% if filtered_results is defined %} - {% if filtered_results|length > limit_number %} - There are more than 10000 results. Consider limiting your search to a smaller range. - {% else %} + {% if table_rows is defined %} @@ -214,7 +211,6 @@

Loading...
- {% endif %} {% endif %}
@@ -229,11 +225,23 @@ - + 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(-) (limited to 'wqflask') 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 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(-) (limited to 'wqflask') 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(-) (limited to 'wqflask') 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 0253f1f483ecdcf4cceb65f55efee739a58d0e4e Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 10 Dec 2020 12:29:04 -0600 Subject: Replaced the Scroller import with the CDN one until we figure out why the new import doesn't work --- wqflask/wqflask/templates/show_trait.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index b02f8140..c95a0522 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -146,7 +146,7 @@ - + -- 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(-) (limited to 'wqflask') 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 d1ef84a3ba6312a53076d40ee899933172866477 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 14 Dec 2020 12:42:58 -0600 Subject: Added a template for the tool bottons on the search result, correlation, and collection pages (since the buttons are the same and it's redundant currently) --- wqflask/wqflask/templates/collections/view.html | 36 +--------------------- wqflask/wqflask/templates/correlation_page.html | 36 +--------------------- wqflask/wqflask/templates/search_result_page.html | 37 +---------------------- wqflask/wqflask/templates/tool_buttons.html | 35 +++++++++++++++++++++ 4 files changed, 38 insertions(+), 106 deletions(-) create mode 100644 wqflask/wqflask/templates/tool_buttons.html (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index 99a6f2de..66945ed7 100644 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -28,41 +28,7 @@ {{ this_trait.name }}:{{ this_trait.dataset.name }}:{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}, {% endfor %}" > - - - - - - - - - - - - - - - - - + {% include 'tool_buttons.html' %}
diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 7acccc25..49b2bf26 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -33,41 +33,7 @@ {{ this_trait.name }}:{{ this_trait.dataset }}, {% endfor %}" > - - - - - - - - - - - - - - - - - + {% include 'tool_buttons.html' %}
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 3be2e395..92f14ade 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -75,42 +75,7 @@ {{ this_trait.name }}:{{ this_trait.dataset }}, {% endfor %}" > - - - - - - - - - - - - - - - - - - + {% include 'tool_buttons.html' %}
diff --git a/wqflask/wqflask/templates/tool_buttons.html b/wqflask/wqflask/templates/tool_buttons.html new file mode 100644 index 00000000..5b2dbf3d --- /dev/null +++ b/wqflask/wqflask/templates/tool_buttons.html @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file -- 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(-) (limited to 'wqflask') 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 From f8fc508f86ba015097a027055c429e61d310523f Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 15 Dec 2020 11:21:32 -0600 Subject: Removed Index and Record from hideable columns in search result and correlation pages --- wqflask/wqflask/templates/correlation_page.html | 2 -- wqflask/wqflask/templates/search_result_page.html | 2 -- 2 files changed, 4 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 49b2bf26..82caee21 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -86,8 +86,6 @@
Show/Hide Columns:
- - {% if target_dataset.type == 'ProbeSet' %} diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 92f14ade..adc2f140 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -106,8 +106,6 @@
Show/Hide Columns:
- - {% if dataset.type == 'ProbeSet' %} -- cgit v1.2.3 From 49a5d53533477250a1add2ba866d42e86dfd12b3 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 15 Dec 2020 11:29:47 -0600 Subject: Changed High P to Peak LOD and changed the width of the column some --- wqflask/wqflask/templates/correlation_page.html | 8 ++++---- wqflask/wqflask/templates/search_result_page.html | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 82caee21..db04a530 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -91,7 +91,7 @@ - + {% elif target_dataset.type == 'Publish' %} @@ -102,7 +102,7 @@ - + {% else %} @@ -355,7 +355,7 @@ 'orderSequence': [ "desc", "asc"] }, { - 'title': "High P ", + 'title': "Peak LOD ", 'type': "natural-minus-na", 'data': "lrs_score", 'width': "60px", @@ -455,7 +455,7 @@ 'orderSequence': [ "desc", "asc"] }, { - 'title': "High P ", + 'title': "Peak  LOD", 'type': "natural-minus-na", 'data': "lrs_score", 'width': "60px", diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index adc2f140..4a3080a3 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -111,7 +111,7 @@ - + {% elif dataset.type == 'Publish' %} @@ -119,7 +119,7 @@ - + {% endif %} @@ -277,10 +277,10 @@ 'orderSequence': [ "desc", "asc"] }, { - 'title': "High P ", + 'title': "Peak  LOD", 'type': "natural-minus-na", 'data': "lrs_score", - 'width': "65px", + 'width': "60px", 'orderSequence': [ "desc", "asc"] }, { @@ -346,10 +346,10 @@ 'orderSequence': [ "desc", "asc"] }, { - 'title': "High P ", + 'title': "Peak  LOD", 'type': "natural-minus-na", 'data': "lrs_score", - 'width': "80px", + 'width': "60px", 'orderSequence': [ "desc", "asc"] }, { -- cgit v1.2.3 From 5a2284984e75a4a25debdfcbdc8c2951a799c4cb Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 15 Dec 2020 11:52:58 -0600 Subject: Changed LRS to LOD score for correlation page table --- wqflask/wqflask/correlation/show_corr_results.py | 13 ++++++++----- wqflask/wqflask/templates/correlation_page.html | 6 +++--- wqflask/wqflask/templates/search_result_page.html | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 0c1cea0e..8536ce51 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -493,14 +493,15 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap results_dict['description'] = "N/A" results_dict['location'] = trait.location_repr results_dict['mean'] = "N/A" - results_dict['lrs_score'] = "N/A" results_dict['additive'] = "N/A" if bool(trait.description_display): results_dict['description'] = trait.description_display if bool(trait.mean): results_dict['mean'] = f"{float(trait.mean):.3f}" - if trait.LRS_score_repr != "N/A": - results_dict['lrs_score'] = f"{float(trait.LRS_score_repr):.1f}" + try: + trait_dict['lod_score'] = f"{float(this_trait.LRS_score_repr) / 4.61:.1f}" + except: + trait_dict['lod_score'] = "N/A" results_dict['lrs_location'] = trait.LRS_location_repr if bool(trait.additive): results_dict['additive'] = f"{float(trait.additive):.3f}" @@ -544,8 +545,10 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap else: results_dict['pubmed_link'] = trait.pubmed_link results_dict['pubmed_text'] = trait.pubmed_text - - results_dict['lrs_score'] = trait.LRS_score_repr + try: + trait_dict['lod_score'] = f"{float(this_trait.LRS_score_repr) / 4.61:.1f}" + except: + trait_dict['lod_score'] = "N/A" results_dict['lrs_location'] = trait.LRS_location_repr if bool(trait.additive): results_dict['additive'] = f"{float(trait.additive):.3f}" diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index db04a530..a9a3a2ca 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -355,9 +355,9 @@ 'orderSequence': [ "desc", "asc"] }, { - 'title': "Peak LOD ", + 'title': "Peak  LOD", 'type': "natural-minus-na", - 'data': "lrs_score", + 'data': "lod_score", 'width': "60px", 'orderSequence': [ "desc", "asc"] }, @@ -457,7 +457,7 @@ { 'title': "Peak  LOD", 'type': "natural-minus-na", - 'data': "lrs_score", + 'data': "lod_score", 'width': "60px", 'orderSequence': [ "desc", "asc"] }, diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 4a3080a3..f2334512 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -279,7 +279,7 @@ { 'title': "Peak  LOD", 'type': "natural-minus-na", - 'data': "lrs_score", + 'data': "lod_score", 'width': "60px", 'orderSequence': [ "desc", "asc"] }, @@ -348,7 +348,7 @@ { 'title': "Peak  LOD", 'type': "natural-minus-na", - 'data': "lrs_score", + 'data': "lod_score", 'width': "60px", 'orderSequence': [ "desc", "asc"] }, -- cgit v1.2.3 From 2f84b17bbd632fd7591c2b8c51bb071e6e16d92d Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 15 Dec 2020 11:53:40 -0600 Subject: Changed string formatting to use preferable Python 3 syntax and converted LRS scores to LOD scores for the search results page --- wqflask/wqflask/search_results.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index ce836ce2..0d0894a4 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -126,11 +126,14 @@ views.py). trait_dict['mean'] = "N/A" trait_dict['additive'] = "N/A" if this_trait.mean != "" and this_trait.mean != None: - trait_dict['mean'] = '%.3f' % this_trait.mean - trait_dict['lrs_score'] = this_trait.LRS_score_repr + trait_dict['mean'] = f"{this_trait.mean:.3f}" + try: + trait_dict['lod_score'] = f"{float(this_trait.LRS_score_repr) / 4.61:.1f}" + except: + trait_dict['lod_score'] = "N/A" trait_dict['lrs_location'] = this_trait.LRS_location_repr if this_trait.additive != "": - trait_dict['additive'] = '%.3f' % this_trait.additive + trait_dict['additive'] = f"{this_trait.additive:.3f}" elif this_trait.dataset.type == "Geno": trait_dict['location'] = this_trait.location_repr elif this_trait.dataset.type == "Publish": @@ -143,12 +146,15 @@ views.py). trait_dict['pubmed_text'] = this_trait.pubmed_text trait_dict['mean'] = "N/A" if this_trait.mean != "" and this_trait.mean != None: - trait_dict['mean'] = '%.3f' % this_trait.mean - trait_dict['lrs_score'] = this_trait.LRS_score_repr + trait_dict['mean'] = f"{this_trait.mean:.3f}" + try: + trait_dict['lod_score'] = f"{float(this_trait.LRS_score_repr) / 4.61:.1f}" + except: + trait_dict['lod_score'] = "N/A" trait_dict['lrs_location'] = this_trait.LRS_location_repr trait_dict['additive'] = "N/A" if this_trait.additive != "": - trait_dict['additive'] = '%.3f' % this_trait.additive + trait_dict['additive'] = f"{this_trait.additive:.3f}" # Convert any bytes in dict to a normal utf-8 string for key in trait_dict.keys(): if isinstance(trait_dict[key], bytes): -- cgit v1.2.3 From fde06d3a6b0ea22224f17e179c7ea226e658d02e Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 15 Dec 2020 13:50:04 -0600 Subject: Changed the Hide No Value function to use DataTables API --- .../wqflask/static/new/javascript/show_trait.js | 33 ++++++++++++++++++---- .../templates/show_trait_transform_and_filter.html | 2 +- 2 files changed, 28 insertions(+), 7 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 87c35984..e8768325 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -731,14 +731,35 @@ filter_by_value = function() { } }; +hide_no_value_filter = function( settings, data, dataIndex ) { + this_value = table_api.column(3).nodes().to$()[dataIndex].childNodes[0].value; + if (this_value == "x"){ + return false + } else { + return true + } +} + hide_no_value = function() { - return $('.value_se').each((function(_this) { - return function(_index, element) { - if ($(element).find('.trait-value-input').val() === 'x') { - return $(element).hide(); + + tables = ['samples_primary', 'samples_other']; + filter_active = $(this).data("active"); + for (_i = 0, _len = tables.length; _i < _len; _i++) { + table = tables[_i]; + if ($('#' + table).length) { + table_api = $('#' + table).DataTable(); + if (filter_active == "true"){ + table_api.draw(); + $(this).data("active", "false"); + } else { + $.fn.dataTable.ext.search.push(hide_no_value_filter); + table_api.search(); + table_api.draw(); + $.fn.dataTable.ext.search.splice($.fn.dataTable.ext.search.indexOf(hide_no_value_filter, 1)); + $(this).data("active", "true"); } - }; - })(this)); + } + } }; $('#hide_no_value').click(hide_no_value); diff --git a/wqflask/wqflask/templates/show_trait_transform_and_filter.html b/wqflask/wqflask/templates/show_trait_transform_and_filter.html index d7eac378..b70ca590 100644 --- a/wqflask/wqflask/templates/show_trait_transform_and_filter.html +++ b/wqflask/wqflask/templates/show_trait_transform_and_filter.html @@ -80,7 +80,7 @@
- + -- cgit v1.2.3 From 9a6195abd1867e602234f182d73029e700612bd4 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 15 Dec 2020 13:55:24 -0600 Subject: Fixed Reset button to also reset hidden rows + changed Hide No Value button to change its text when active --- wqflask/wqflask/static/new/javascript/show_trait.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index e8768325..5dc9e456 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -741,7 +741,6 @@ hide_no_value_filter = function( settings, data, dataIndex ) { } hide_no_value = function() { - tables = ['samples_primary', 'samples_other']; filter_active = $(this).data("active"); for (_i = 0, _len = tables.length; _i < _len; _i++) { @@ -749,9 +748,11 @@ hide_no_value = function() { if ($('#' + table).length) { table_api = $('#' + table).DataTable(); if (filter_active == "true"){ + $(this).val("Hide No Value") table_api.draw(); $(this).data("active", "false"); } else { + $(this).val("Show No Value") $.fn.dataTable.ext.search.push(hide_no_value_filter); table_api.search(); table_api.draw(); @@ -775,6 +776,7 @@ $('#block_outliers').click(block_outliers); reset_samples_table = function() { $('input[name="transform"]').val(""); $('span[name="transform_text"]').text("") + $('#hide_no_value').val("Hide No Value") tables = ['samples_primary', 'samples_other']; for (_i = 0, _len = tables.length; _i < _len; _i++) { table = tables[_i]; @@ -792,6 +794,7 @@ reset_samples_table = function() { this_node.value = this_node.attributes["data-value"].value; } } + table_api.draw(); } } }; -- cgit v1.2.3 From 66f7e4977f751e3b533ee8fcdbba3547b9e0eace Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 15 Dec 2020 14:00:06 -0600 Subject: Fixed mistake with the way lod score was being set for correlation results --- wqflask/wqflask/correlation/show_corr_results.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 8536ce51..7d3b9b9f 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -499,9 +499,9 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap if bool(trait.mean): results_dict['mean'] = f"{float(trait.mean):.3f}" try: - trait_dict['lod_score'] = f"{float(this_trait.LRS_score_repr) / 4.61:.1f}" + results_dict['lod_score'] = f"{float(trait.LRS_score_repr) / 4.61:.1f}" except: - trait_dict['lod_score'] = "N/A" + results_dict['lod_score'] = "N/A" results_dict['lrs_location'] = trait.LRS_location_repr if bool(trait.additive): results_dict['additive'] = f"{float(trait.additive):.3f}" @@ -546,9 +546,9 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap results_dict['pubmed_link'] = trait.pubmed_link results_dict['pubmed_text'] = trait.pubmed_text try: - trait_dict['lod_score'] = f"{float(this_trait.LRS_score_repr) / 4.61:.1f}" + results_dict['lod_score'] = f"{float(trait.LRS_score_repr) / 4.61:.1f}" except: - trait_dict['lod_score'] = "N/A" + results_dict['lod_score'] = "N/A" results_dict['lrs_location'] = trait.LRS_location_repr if bool(trait.additive): results_dict['additive'] = f"{float(trait.additive):.3f}" -- cgit v1.2.3 From 4760b390f7e87ea16152a7ecf5422abfb4125176 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 15 Dec 2020 14:36:12 -0600 Subject: Fixed typo in mapping results table --- wqflask/wqflask/templates/mapping_results.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html index 86aa74b0..1a76ef7a 100644 --- a/wqflask/wqflask/templates/mapping_results.html +++ b/wqflask/wqflask/templates/mapping_results.html @@ -389,7 +389,7 @@ "orderable": false } ], "language": { - "info": "Showing1 from _START_ to _END_ of " + js_data.total_markers + " records", + "info": "Showing from _START_ to _END_ of " + js_data.total_markers + " records", }, "order": [[1, "asc" ]], "sDom": "iRZtir", -- cgit v1.2.3 From 13ae2b093720a04b63f50a77b92e3b8e480b5ae1 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 15 Dec 2020 14:38:42 -0600 Subject: Added additive effect to GEMMA results + removed an unused function --- wqflask/wqflask/marker_regression/gemma_mapping.py | 46 ++++------------------ 1 file changed, 8 insertions(+), 38 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/marker_regression/gemma_mapping.py b/wqflask/wqflask/marker_regression/gemma_mapping.py index 61e4897c..630a3afa 100644 --- a/wqflask/wqflask/marker_regression/gemma_mapping.py +++ b/wqflask/wqflask/marker_regression/gemma_mapping.py @@ -80,7 +80,7 @@ def run_gemma(this_trait, this_dataset, samples, vals, covariates, use_loco, maf os.system(generate_k_command) - gemma_command = GEMMA_WRAPPER_COMMAND + ' --json --input %s/gn2/%s.json -- ' % (TEMPDIR, k_output_filename) + GEMMAOPTS + ' -a %s/%s_snps.txt -lmm 2 -g %s/%s_geno.txt -p %s/gn2/%s.txt' % (flat_files('genotype/bimbam'), + gemma_command = GEMMA_WRAPPER_COMMAND + ' --json --input %s/gn2/%s.json -- ' % (TEMPDIR, k_output_filename) + GEMMAOPTS + ' -a %s/%s_snps.txt -lmm 9 -g %s/%s_geno.txt -p %s/gn2/%s.txt' % (flat_files('genotype/bimbam'), genofile_name, flat_files('genotype/bimbam'), genofile_name, @@ -101,7 +101,7 @@ def run_gemma(this_trait, this_dataset, samples, vals, covariates, use_loco, maf marker_obs = parse_loco_output(this_dataset, gwa_output_filename) return marker_obs, gwa_output_filename else: - marker_obs = parse_loco_output(this_dataset, gwa_output_filename) + marker_obs = parse_loco_output(this_dataset, gwa_output_filename, use_loco) return marker_obs, gwa_output_filename def gen_pheno_txt_file(this_dataset, genofile_name, vals, trait_filename): @@ -145,41 +145,7 @@ def gen_covariates_file(this_dataset, covariates, samples): outfile.write(str(this_covariate[i]) + "\t") outfile.write("\n") -def parse_gemma_output(genofile_name): - included_markers = [] - p_values = [] - marker_obs = [] - - with open("{}{}_output.assoc.txt".format(webqtlConfig.GENERATED_IMAGE_DIR, genofile_name)) as output_file: - for line in output_file: - if line.startswith("chr\t"): - continue - else: - marker = {} - marker['name'] = line.split("\t")[1] - if line.split("\t")[0] != "X" and line.split("\t")[0] != "X/Y": - if "chr" in line.split("\t")[0]: - marker['chr'] = int(line.split("\t")[0][3:]) - else: - marker['chr'] = int(line.split("\t")[0]) - else: - marker['chr'] = line.split("\t")[0] - marker['Mb'] = float(line.split("\t")[2]) / 1000000 - marker['p_value'] = float(line.split("\t")[9]) - if math.isnan(marker['p_value']) or (marker['p_value'] <= 0): - marker['lod_score'] = 0 - #marker['lrs_value'] = 0 - else: - marker['lod_score'] = -math.log10(marker['p_value']) - #marker['lrs_value'] = -math.log10(marker['p_value']) * 4.61 - marker_obs.append(marker) - - included_markers.append(line.split("\t")[1]) - p_values.append(float(line.split("\t")[9])) - - return marker_obs - -def parse_loco_output(this_dataset, gwa_output_filename): +def parse_loco_output(this_dataset, gwa_output_filename, loco="True"): output_filelist = [] with open("{}/gn2/".format(TEMPDIR) + gwa_output_filename + ".json") as data_file: @@ -218,7 +184,11 @@ def parse_loco_output(this_dataset, gwa_output_filename): else: marker['chr'] = line.split("\t")[0] marker['Mb'] = float(line.split("\t")[2]) / 1000000 - marker['p_value'] = float(line.split("\t")[9]) + if loco == "True": + marker['p_value'] = float(line.split("\t")[9]) + else: + marker['p_value'] = float(line.split("\t")[10]) + marker['additive'] = float(line.split("\t")[7]) if math.isnan(marker['p_value']) or (marker['p_value'] <= 0): marker['lod_score'] = 0 #marker['lrs_value'] = 0 -- cgit v1.2.3 From e744352ec32809f791754fe7828c7e81813b24c7 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 16 Dec 2020 14:57:37 +0300 Subject: Replace jquery libs(jquery cookie,jquery ui,jquery js) (#512) * replace jquery-ui in templates * replace jquery-cookie library in templates * replace jquery.min.js in templates * add jquery-ui to mechanical rob * add jquery-cookie to mechanical rob * add jquery min js to mechanical rob Co-authored-by: BonfaceKilz --- test/requests/link_checker.py | 3 +++ wqflask/wqflask/templates/base.html | 6 +++--- wqflask/wqflask/templates/loading.html | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'wqflask') diff --git a/test/requests/link_checker.py b/test/requests/link_checker.py index a22c2b54..eb27d9fe 100644 --- a/test/requests/link_checker.py +++ b/test/requests/link_checker.py @@ -117,6 +117,9 @@ 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/jquery-ui/jquery-ui.min.js", + "/js/jquery-cookie/jquery.cookie.js", + "/js/jquery/jquery.min.js", "/js/typeahead/typeahead.bundle.js", "/js/underscore-string/underscore.string.min.js", "/js/js_alt/jstat.min.js", diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index bb618294..e368a4be 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -238,7 +238,7 @@
- + - + - + diff --git a/wqflask/wqflask/templates/loading.html b/wqflask/wqflask/templates/loading.html index 9b335dfe..94e17724 100644 --- a/wqflask/wqflask/templates/loading.html +++ b/wqflask/wqflask/templates/loading.html @@ -38,7 +38,7 @@
- + - + -- cgit v1.2.3 From 218a2aa198cb70761ddd20c94169941f3ea86188 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 16 Dec 2020 15:03:15 +0300 Subject: Replace zxcvbn async (#524) * replace axcbn-async in templates * add zxcvbn-async.min.js in mechanical rob Co-authored-by: BonfaceKilz --- test/requests/link_checker.py | 1 + wqflask/wqflask/templates/new_security/forgot_password_step2.html | 2 +- wqflask/wqflask/templates/new_security/password_reset.html | 2 +- wqflask/wqflask/templates/new_security/register_user.html | 2 +- wqflask/wqflask/templates/new_security/registered.html | 2 +- wqflask/wqflask/templates/new_security/thank_you.html | 2 +- wqflask/wqflask/templates/new_security/verification_still_needed.html | 2 +- 7 files changed, 7 insertions(+), 6 deletions(-) (limited to 'wqflask') diff --git a/test/requests/link_checker.py b/test/requests/link_checker.py index f73ec185..bc3b5861 100644 --- a/test/requests/link_checker.py +++ b/test/requests/link_checker.py @@ -141,6 +141,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/zxcvbn-async/zxcvbn-async.min.js", "/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/new_security/forgot_password_step2.html b/wqflask/wqflask/templates/new_security/forgot_password_step2.html index 473fa377..5dc424e5 100644 --- a/wqflask/wqflask/templates/new_security/forgot_password_step2.html +++ b/wqflask/wqflask/templates/new_security/forgot_password_step2.html @@ -21,6 +21,6 @@ {% block js %} {% include "new_security/_scripts.html" %} - + {% endblock %} diff --git a/wqflask/wqflask/templates/new_security/password_reset.html b/wqflask/wqflask/templates/new_security/password_reset.html index 7110dc79..4e3ea59f 100644 --- a/wqflask/wqflask/templates/new_security/password_reset.html +++ b/wqflask/wqflask/templates/new_security/password_reset.html @@ -74,6 +74,6 @@ {% block js %} {% include "new_security/_scripts.html" %} - + {% endblock %} diff --git a/wqflask/wqflask/templates/new_security/register_user.html b/wqflask/wqflask/templates/new_security/register_user.html index 325d8aa5..2506f4ee 100644 --- a/wqflask/wqflask/templates/new_security/register_user.html +++ b/wqflask/wqflask/templates/new_security/register_user.html @@ -101,6 +101,6 @@ {% block js %} {% include "new_security/_scripts.html" %} - + {% endblock %} diff --git a/wqflask/wqflask/templates/new_security/registered.html b/wqflask/wqflask/templates/new_security/registered.html index e71d5598..eaed3ed0 100644 --- a/wqflask/wqflask/templates/new_security/registered.html +++ b/wqflask/wqflask/templates/new_security/registered.html @@ -20,6 +20,6 @@ {% block js %} {% include "new_security/_scripts.html" %} - + {% endblock %} diff --git a/wqflask/wqflask/templates/new_security/thank_you.html b/wqflask/wqflask/templates/new_security/thank_you.html index 459bd66a..f492fb51 100644 --- a/wqflask/wqflask/templates/new_security/thank_you.html +++ b/wqflask/wqflask/templates/new_security/thank_you.html @@ -19,6 +19,6 @@ {% block js %} {% include "new_security/_scripts.html" %} - + {% endblock %} diff --git a/wqflask/wqflask/templates/new_security/verification_still_needed.html b/wqflask/wqflask/templates/new_security/verification_still_needed.html index 3aa24e37..91768eb9 100644 --- a/wqflask/wqflask/templates/new_security/verification_still_needed.html +++ b/wqflask/wqflask/templates/new_security/verification_still_needed.html @@ -22,6 +22,6 @@ {% block js %} {% include "new_security/_scripts.html" %} - + {% endblock %} -- cgit v1.2.3 From 87fdfc19009acda8b58729d0ffbdccbdf6a85a1e Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 16 Dec 2020 11:27:39 -0600 Subject: Set all attribute names to lower-case for sorting in order to keep order consistent --- wqflask/wqflask/show_trait/SampleList.py | 4 ++-- wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js | 2 +- wqflask/wqflask/static/new/javascript/show_trait.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/show_trait/SampleList.py b/wqflask/wqflask/show_trait/SampleList.py index 00495377..ece485ae 100644 --- a/wqflask/wqflask/show_trait/SampleList.py +++ b/wqflask/wqflask/show_trait/SampleList.py @@ -108,7 +108,7 @@ class SampleList(object): FROM CaseAttribute, CaseAttributeXRefNew WHERE CaseAttributeXRefNew.CaseAttributeId = CaseAttribute.Id AND CaseAttributeXRefNew.InbredSetId = %s - ORDER BY CaseAttribute.Name''', (str(self.dataset.group.id),)) + ORDER BY lower(CaseAttribute.Name)''', (str(self.dataset.group.id),)) self.attributes = {} for attr, values in itertools.groupby(results.fetchall(), lambda row: (row.Id, row.Name)): @@ -157,7 +157,7 @@ class SampleList(object): except ValueError: pass - attribute_values[self.attributes[item.Id].name] = attribute_value + attribute_values[self.attributes[item.Id].name.lower()] = attribute_value self.sample_attribute_values[sample_name] = attribute_values def get_first_attr_col(self): diff --git a/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js b/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js index 5a4f151c..4362a75e 100644 --- a/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js +++ b/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js @@ -93,7 +93,7 @@ build_columns = function() { ); } - attr_keys = Object.keys(js_data.attributes).sort((a, b) => (js_data.attributes[a].name > js_data.attributes[b].name) ? 1 : -1) + attr_keys = Object.keys(js_data.attributes).sort((a, b) => (js_data.attributes[a].name.toLowerCase() > js_data.attributes[b].name.toLowerCase()) ? 1 : -1) for (i = 0; i < attr_keys.length; i++){ column_list.push( { diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 5dc9e456..98f90f7d 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -571,7 +571,7 @@ populate_sample_attributes_values_dropdown = function() { sample_attributes = []; var attributes_as_list = Object.keys(js_data.attributes).map(function(key) { - return [key, js_data.attributes[key].name]; + return [key, js_data.attributes[key].name.toLowerCase()]; }); attributes_as_list.sort(function(first, second) { -- cgit v1.2.3 From 124bc16cdc67b6ba31a281e619dcf15f181ba131 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 16 Dec 2020 11:33:10 -0600 Subject: Removed ID/Sample/Value from Show/Hide Columns in trait page and only show the option if columns other than those exist --- wqflask/wqflask/templates/show_trait_edit_data.html | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/show_trait_edit_data.html b/wqflask/wqflask/templates/show_trait_edit_data.html index 4ad11a5e..0d34bebc 100644 --- a/wqflask/wqflask/templates/show_trait_edit_data.html +++ b/wqflask/wqflask/templates/show_trait_edit_data.html @@ -1,12 +1,9 @@
{% for sample_type in sample_groups %}
- {% if loop.index == 1 %} + {% if loop.index == 1 and (sample_groups[0].se_exists or has_num_cases or sample_groups[0].attributes|length > 0) %} Show/Hide Columns:
- - - {% if sample_groups[0].se_exists %} {% if has_num_cases %} -- cgit v1.2.3 From ec1e37331e320ed674f184b738b9917753b6071f Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 16 Dec 2020 15:45:53 -0600 Subject: Made change to the way sample table width is calculated to account for sample name width --- wqflask/wqflask/show_trait/show_trait.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 0c6ae198..4c6dd005 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -186,8 +186,6 @@ class ShowTrait(object): self.has_num_cases = has_num_cases(self.this_trait) - self.stats_table_width, self.trait_table_width = get_table_widths(self.sample_groups, self.has_num_cases) - #ZS: Needed to know whether to display bar chart + get max sample name length in order to set table column width self.num_values = 0 self.binary = "true" #ZS: So it knows whether to display the Binary R/qtl mapping method, which doesn't work unless all values are 0 or 1 @@ -206,6 +204,8 @@ class ShowTrait(object): sample_column_width = max_samplename_width * 8 + self.stats_table_width, self.trait_table_width = get_table_widths(self.sample_groups, sample_column_width, self.has_num_cases) + if self.num_values >= 5000: self.maf = 0.01 else: @@ -547,12 +547,12 @@ def get_nearest_marker(this_trait, this_db): return result[0][0] -def get_table_widths(sample_groups, has_num_cases=False): +def get_table_widths(sample_groups, sample_column_width, has_num_cases=False): stats_table_width = 250 if len(sample_groups) > 1: stats_table_width = 450 - trait_table_width = 380 + trait_table_width = 300 + sample_column_width if sample_groups[0].se_exists: trait_table_width += 80 if has_num_cases: -- cgit v1.2.3 From fbec8e8bb919cb866d70db9f93a942f4554395fb Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 16 Dec 2020 15:53:59 -0600 Subject: Removed unused JS and fixed mapping covariate selection to work for both R/qtl and GEMMA --- wqflask/wqflask/static/new/javascript/show_trait.js | 10 +--------- wqflask/wqflask/templates/show_trait_mapping_tools.html | 8 ++++---- 2 files changed, 5 insertions(+), 13 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 98f90f7d..9cd79687 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -100,15 +100,7 @@ d3.select("#select_compare_trait").on("click", (function(_this) { return open_trait_selection(); }; })(this)); -d3.select("#select_covariates").on("click", (function(_this) { - return function() { - return open_covariate_selection(); - }; -})(this)); -$("#remove_covariates").click(function () { - $("input[name=covariates]").val("") - $(".selected-covariates").val("") -}); + $(".select_covariates").click(function () { open_covariate_selection(); }); diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html index eca436c6..c42fe4aa 100755 --- a/wqflask/wqflask/templates/show_trait_mapping_tools.html +++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html @@ -74,8 +74,8 @@ No collections available. Please add traits to a collection to use them as covariates. {% else %}
- - + +
{% endif %} @@ -317,8 +317,8 @@ No collections available. Please add traits to a collection to use them as covariates. {% else %}
- - + +
{% endif %} -- cgit v1.2.3 From d080436fa5640522c45b1d8bb90e9ca20ba06d5d Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Thu, 17 Dec 2020 01:26:47 +0300 Subject: remove test for parse_gemma_output and modify run_gemma tests (#533) --- .../marker_regression/test_gemma_mapping.py | 32 ++-------------------- 1 file changed, 2 insertions(+), 30 deletions(-) (limited to 'wqflask') diff --git a/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py b/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py index b8c13ab4..eab6afe6 100644 --- a/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py +++ b/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py @@ -5,7 +5,6 @@ from unittest import mock from wqflask.marker_regression.gemma_mapping import run_gemma from wqflask.marker_regression.gemma_mapping import gen_pheno_txt_file from wqflask.marker_regression.gemma_mapping import gen_covariates_file -from wqflask.marker_regression.gemma_mapping import parse_gemma_output from wqflask.marker_regression.gemma_mapping import parse_loco_output @@ -69,11 +68,9 @@ class TestGemmaMapping(unittest.TestCase): mock_parse_loco.return_value = [] results = run_gemma(this_trait=trait, this_dataset=dataset, samples=[ ], vals=[], covariates="", use_loco=True) - system_calls = [mock.call('ghc --json -- -debug -g /home/genotype/bimbam/file_geno.txt -p /home/user/data//gn2/trait1_dataset1_name_pheno.txt -a /home/genotype/bimbam/file_snps.txt -gk > /home/user/data//gn2/GP1_K_RRRRRR.json'), - mock.call('ghc --json --input /home/user/data//gn2/GP1_K_RRRRRR.json -- -debug -a /home/genotype/bimbam/file_snps.txt -lmm 2 -g /home/genotype/bimbam/file_geno.txt -p /home/user/data//gn2/trait1_dataset1_name_pheno.txt > /home/user/data//gn2/GP1_GWA_RRRRRR.json')] - mock_os.system.assert_has_calls(system_calls) + self.assertEqual(mock_os.system.call_count,2) mock_gen_pheno_txt.assert_called_once() - mock_parse_loco.assert_called_once_with(dataset, "GP1_GWA_RRRRRR") + mock_parse_loco.assert_called_once_with(dataset, "GP1_GWA_RRRRRR",True) mock_os.path.isfile.assert_called_once_with( ('/home/user/imgfile_output.assoc.txt')) self.assertEqual(mock_flat_files.call_count, 4) @@ -138,31 +135,6 @@ class TestGemmaMapping(unittest.TestCase): filehandler.write.assert_has_calls([mock.call( '-9\t'), mock.call('-9\t'), mock.call('-9\t'), mock.call('-9\t'), mock.call('\n')]) - @mock.patch("wqflask.marker_regression.gemma_mapping.webqtlConfig.GENERATED_IMAGE_DIR", "/home/user/img/") - def test_parse_gemma_output(self): - """add test for generating gemma output with obj returned""" - file = """X/Y\t gn2\t21\tQ\tE\tA\tP\tMMB\tCDE\t0.5 -X/Y\tgn2\t21322\tQ\tE\tA\tP\tMMB\tCDE\t0.5 -chr\tgn1\t12312\tQ\tE\tA\tP\tMMB\tCDE\t0.7 -X\tgn7\t2324424\tQ\tE\tA\tP\tMMB\tCDE\t0.4 -125\tgn9\t433575\tQ\tE\tA\tP\tMMB\tCDE\t0.67 -""" - with mock.patch("builtins.open", mock.mock_open(read_data=file)) as mock_open: - results = parse_gemma_output(genofile_name="gema_file") - expected = [{'name': ' gn2', 'chr': 'X/Y', 'Mb': 2.1e-05, 'p_value': 0.5, 'lod_score': 0.3010299956639812}, {'name': 'gn2', 'chr': 'X/Y', 'Mb': 0.021322, 'p_value': 0.5, 'lod_score': 0.3010299956639812}, - {'name': 'gn7', 'chr': 'X', 'Mb': 2.324424, 'p_value': 0.4, 'lod_score': 0.3979400086720376}, {'name': 'gn9', 'chr': 125, 'Mb': 0.433575, 'p_value': 0.67, 'lod_score': 0.17392519729917352}] - mock_open.assert_called_once_with( - "/home/user/img/gema_file_output.assoc.txt") - self.assertEqual(results, expected) - - @mock.patch("wqflask.marker_regression.gemma_mapping.webqtlConfig.GENERATED_IMAGE_DIR", "/home/user/img") - def test_parse_gemma_output_with_empty_return(self): - """add tests for parse gemma output where nothing returned""" - output_file_results = """chr\t today""" - with mock.patch("builtins.open", mock.mock_open(read_data=output_file_results)) as mock_open: - results = parse_gemma_output(genofile_name="gema_file") - self.assertEqual(results, []) - @mock.patch("wqflask.marker_regression.gemma_mapping.TEMPDIR", "/home/tmp") @mock.patch("wqflask.marker_regression.gemma_mapping.os") @mock.patch("wqflask.marker_regression.gemma_mapping.json") -- cgit v1.2.3 From e44f149fb6f6ca7d948c95f30faba4f4c2dc2ddd Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 17 Dec 2020 13:47:16 -0600 Subject: Correlation Min Expr and Location filters display depending upon the selected target dataset now, instead of the trait's dataset --- .../wqflask/static/new/javascript/show_trait.js | 18 ++++++++++++++++ .../show_trait_calculate_correlations.html | 24 ++++++++++++---------- 2 files changed, 31 insertions(+), 11 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 9cd79687..e9c7cce1 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -516,6 +516,24 @@ on_corr_method_change = function() { }; $('select[name=corr_type]').change(on_corr_method_change); +on_dataset_change = function() { + let dataset_type = $('select[name=corr_dataset] option:selected').data('type'); + + if (dataset_type == "mrna_assay"){ + $('#min_expr_filter').show(); + $('#location_filter').show(); + } + else if (dataset_type == "pheno"){ + $('#min_expr_filter').show(); + $('#location_filter').hide(); + } + else { + $('#min_expr_filter').hide(); + $('#location_filter').show(); + } +} +$('select[name=corr_dataset]').change(on_dataset_change); + submit_special = function(url) { get_table_contents_for_form_submit("trait_data_form"); $("#trait_data_form").attr("action", url); diff --git a/wqflask/wqflask/templates/show_trait_calculate_correlations.html b/wqflask/wqflask/templates/show_trait_calculate_correlations.html index ba72ff27..12294efb 100644 --- a/wqflask/wqflask/templates/show_trait_calculate_correlations.html +++ b/wqflask/wqflask/templates/show_trait_calculate_correlations.html @@ -19,18 +19,18 @@ @@ -74,14 +74,16 @@
- {% if dataset.type != "Publish" %} -
+ {% if dataset.type != "Geno" %} +
-
+ {% endif %} + {% if dataset.type != "Pheno" %} +
-- cgit v1.2.3 From 561dfe5e1dedbf9c31d45023b895a2b9bb003869 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 17 Dec 2020 13:51:59 -0600 Subject: Replaced Pheno with Publish for identifying dataset type in corr options --- wqflask/wqflask/templates/show_trait_calculate_correlations.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/show_trait_calculate_correlations.html b/wqflask/wqflask/templates/show_trait_calculate_correlations.html index 12294efb..6f124943 100644 --- a/wqflask/wqflask/templates/show_trait_calculate_correlations.html +++ b/wqflask/wqflask/templates/show_trait_calculate_correlations.html @@ -82,7 +82,7 @@
{% endif %} - {% if dataset.type != "Pheno" %} + {% if dataset.type != "Publish" %}
-- cgit v1.2.3 From f851ea02b94b98f1537060a7189e25086fc991e9 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 17 Dec 2020 14:48:55 -0600 Subject: Fixed a couple logic issues and changed indentation in show_trait_calculate_correlations.html --- .../show_trait_calculate_correlations.html | 154 ++++++++++----------- 1 file changed, 75 insertions(+), 79 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 6f124943..eaa0c308 100644 --- a/wqflask/wqflask/templates/show_trait_calculate_correlations.html +++ b/wqflask/wqflask/templates/show_trait_calculate_correlations.html @@ -2,88 +2,85 @@
-
- -
- -
-
+
+ +
+ +
+
-
- -
- -
-
+
+ +
+ +
+
-
- -
- -
-
+
+ +
+ +
+
-
- -
- -
-
+
+ +
+ +
+
-
- -
- -
-
- {% if dataset.type != "Geno" %} -
- -
- -
-
- {% endif %} - {% if dataset.type != "Publish" %} -
+
+ +
+ +
+
+
+ +
+ +
+
+
@@ -93,7 +90,6 @@
- {% endif %}
-- cgit v1.2.3 From be1c1c1c48d75875f03b7ff4e91654f390571b58 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 17 Dec 2020 14:49:26 -0600 Subject: Added Mean (mean expression) column to phenotype correlation results table --- wqflask/wqflask/templates/correlation_page.html | 26 +++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 8e2a23fd..6188c0e7 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -95,14 +95,15 @@ {% elif target_dataset.type == 'Publish' %} - - - - - - - - + + + + + + + + + {% else %} @@ -398,6 +399,13 @@ } } }, + { + 'title': "Mean", + 'type': "natural-minus-na", + 'width': "40px", + 'data': "mean", + 'orderSequence': [ "desc", "asc"] + }, { 'title': "Authors", 'type': "natural", @@ -514,6 +522,8 @@ } ], {% if target_dataset.type == 'Geno' %} "order": [[6, "asc" ]], + {% elif target_dataset.type == 'Publish' %} + "order": [[10, "asc" ]], {% else %} "order": [[9, "asc" ]], {% endif %} -- cgit v1.2.3 From 03de3751bd003117dce2bc4bf085092bd8f9a0fe Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 17 Dec 2020 14:50:34 -0600 Subject: Fixed some logic to work correctly with the changes to the way correlation filters work + changed correlation python code to include Mean (mean expression) for phenotype results --- wqflask/wqflask/correlation/show_corr_results.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 7d3b9b9f..298a3559 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -71,7 +71,6 @@ class CorrelationResults(object): assert('corr_sample_method' in start_vars) assert('corr_samples_group' in start_vars) assert('corr_dataset' in start_vars) - #assert('min_expr' in start_vars) assert('corr_return_results' in start_vars) if 'loc_chr' in start_vars: assert('min_loc_mb' in start_vars) @@ -197,15 +196,15 @@ class CorrelationResults(object): if (float(self.correlation_data[trait][0]) >= self.p_range_lower and float(self.correlation_data[trait][0]) <= self.p_range_upper): - if self.target_dataset.type == "ProbeSet" or self.target_dataset.type == "Geno": - + if (self.target_dataset.type == "ProbeSet" or self.target_dataset.type == "Publish") and bool(trait_object.mean): if (self.min_expr != None) and (float(trait_object.mean) < self.min_expr): continue - elif range_chr_as_int != None and (chr_as_int != range_chr_as_int): + if self.target_dataset.type == "ProbeSet" or self.target_dataset.type == "Geno": + if range_chr_as_int != None and (chr_as_int != range_chr_as_int): continue - elif (self.min_location_mb != None) and (float(trait_object.mb) < float(self.min_location_mb)): + if (self.min_location_mb != None) and (float(trait_object.mb) < float(self.min_location_mb)): continue - elif (self.max_location_mb != None) and (float(trait_object.mb) > float(self.max_location_mb)): + if (self.max_location_mb != None) and (float(trait_object.mb) > float(self.max_location_mb)): continue (trait_object.sample_r, @@ -519,6 +518,7 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap elif target_dataset.type == "Publish": results_dict['abbreviation_display'] = "N/A" results_dict['description'] = "N/A" + results_dict['mean'] = "N/A" results_dict['authors_display'] = "N/A" results_dict['additive'] = "N/A" if for_api: @@ -532,6 +532,8 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap results_dict['abbreviation_display'] = trait.abbreviation if bool(trait.description_display): results_dict['description'] = trait.description_display + if bool(trait.mean): + results_dict['mean'] = f"{float(trait.mean):.3f}" if bool(trait.authors): authors_list = trait.authors.split(',') if len(authors_list) > 6: @@ -605,6 +607,7 @@ def get_header_fields(data_type, corr_method): 'Record', 'Abbreviation', 'Description', + 'Mean', 'Authors', 'Year', 'Sample rho', @@ -618,6 +621,7 @@ def get_header_fields(data_type, corr_method): 'Record', 'Abbreviation', 'Description', + 'Mean', 'Authors', 'Year', 'Sample r', -- cgit v1.2.3 From 47c15cdbd8d54afca05bf939dec8d7d461cff5a5 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 18 Dec 2020 14:30:13 -0600 Subject: Added function that fetches sample data and converts it to JSON to show_trait.js --- .../wqflask/static/new/javascript/show_trait.js | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 98f90f7d..b71a9dd8 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -427,6 +427,25 @@ process_id = function() { } return processed; }; + +fetch_sample_values = function() { + // This is meant to fetch all sample values using DataTables API, since they can't all be submitted with the form when using Scroller (and this should also be faster) + sample_val_dict = {}; + + table = 'samples_primary'; + if ($('#' + table).length){ + table_api = $('#' + table).DataTable(); + val_nodes = table_api.column(3).nodes().to$(); + for (_j = 0; _j < val_nodes.length; _j++){ + sample_name = val_nodes[_j].childNodes[0].name.split(":")[1] + sample_val = val_nodes[_j].childNodes[0].value + sample_val_dict[sample_name] = sample_val + } + } + + return sample_val_dict; +} + edit_data_change = function() { var already_seen, checkbox, name, real_dict, real_value, real_variance, row, rows, sample_sets, table, tables, _i, _j, _len, _len1; already_seen = {}; @@ -525,7 +544,7 @@ on_corr_method_change = function() { $('select[name=corr_type]').change(on_corr_method_change); submit_special = function(url) { - get_table_contents_for_form_submit("trait_data_form"); + $("input[name=sample_vals]").val(JSON.stringify(fetch_sample_values())) $("#trait_data_form").attr("action", url); $("#trait_data_form").submit(); }; @@ -549,7 +568,7 @@ get_table_contents_for_form_submit = function(form_id) { }); } -var corr_input_list = ['corr_type', 'primary_samples', 'trait_id', 'dataset', 'group', 'tool_used', 'form_url', 'corr_sample_method', 'corr_samples_group', 'corr_dataset', 'min_expr', +var corr_input_list = ['sample_vals', 'corr_type', 'primary_samples', 'trait_id', 'dataset', 'group', 'tool_used', 'form_url', 'corr_sample_method', 'corr_samples_group', 'corr_dataset', 'min_expr', 'corr_return_results', 'loc_chr', 'min_loc_mb', 'max_loc_mb', 'p_range_lower', 'p_range_upper'] $(".corr_compute").on("click", (function(_this) { -- cgit v1.2.3 From 66b8f70f162f2d6356c6e9af5066c5b90335f7c2 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 18 Dec 2020 14:33:04 -0600 Subject: Changed views.py to accept sample data for loading page and mapping as JSON instead of having separate form parameters for each sample + removed some commented out code/logging --- wqflask/wqflask/views.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 25563e86..c136711e 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -621,12 +621,13 @@ def loading_page(): wanted = initial_start_vars['wanted_inputs'].split(",") start_vars = {} for key, value in list(initial_start_vars.items()): - if key in wanted or key.startswith(('value:')): + if key in wanted: start_vars[key] = value if 'n_samples' in start_vars: n_samples = int(start_vars['n_samples']) else: + sample_vals_dict = json.loads(start_vars['sample_vals']) if 'group' in start_vars: dataset = create_dataset(start_vars['dataset'], group_name = start_vars['group']) else: @@ -642,8 +643,7 @@ def loading_page(): samples = genofile_samples for sample in samples: - value = start_vars.get('value:' + sample) - if value != "x": + if sample_vals_dict[sample] != "x": n_samples += 1 start_vars['n_samples'] = n_samples @@ -660,7 +660,6 @@ def loading_page(): @app.route("/run_mapping", methods=('POST',)) def mapping_results_page(): initial_start_vars = request.form - #logger.debug("Mapping called with initial_start_vars:", initial_start_vars.items()) logger.info(request.url) temp_uuid = initial_start_vars['temp_uuid'] wanted = ( @@ -670,6 +669,7 @@ def mapping_results_page(): 'species', 'samples', 'vals', + 'sample_vals', 'first_run', 'output_files', 'geno_db_exists', @@ -723,13 +723,11 @@ def mapping_results_page(): ) start_vars = {} for key, value in list(initial_start_vars.items()): - if key in wanted or key.startswith(('value:')): + if key in wanted: start_vars[key] = value - #logger.debug("Mapping called with start_vars:", start_vars) version = "v3" key = "mapping_results:{}:".format(version) + json.dumps(start_vars, sort_keys=True) - #logger.info("key is:", pf(key)) with Bench("Loading cache"): result = None # Just for testing #result = Redis.get(key) @@ -775,10 +773,6 @@ def mapping_results_page(): rendered_template = render_template("pair_scan_results.html", **result) else: gn1_template_vars = display_mapping_results.DisplayMappingResults(result).__dict__ - #pickled_result = pickle.dumps(result, pickle.HIGHEST_PROTOCOL) - #logger.info("pickled result length:", len(pickled_result)) - #Redis.set(key, pickled_result) - #Redis.expire(key, 1*60) with Bench("Rendering template"): #if (gn1_template_vars['mapping_method'] == "gemma") or (gn1_template_vars['mapping_method'] == "plink"): -- cgit v1.2.3 From 20314199985aa21a00a47f3c7b053ec49bc8b60d Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 18 Dec 2020 14:33:44 -0600 Subject: Added sample_vals input element that is meant to contain JSON for all sample values (pulled from the sample table using DataTables API in show_trait.js) --- wqflask/wqflask/templates/show_trait.html | 1 + 1 file changed, 1 insertion(+) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index c881eb76..77fc9342 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -35,6 +35,7 @@ +
-- cgit v1.2.3 From 969a421efc0bd4529607fdc14332acd897d8e106 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 18 Dec 2020 14:34:21 -0600 Subject: Added sample_vals to the list of mapping inputs that determines what is included in start_vars when trait page parameters are passed to the mapping loading page --- wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js index 34582f21..3ae52975 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -141,7 +141,7 @@ $('input[name=display_all]').change((function(_this) { })(this)); //ZS: This is a list of inputs to be passed to the loading page, since not all inputs on the trait page are relevant to mapping -var mapping_input_list = ['temp_uuid', 'trait_id', 'dataset', 'tool_used', 'form_url', 'method', 'transform', 'trimmed_markers', 'selected_chr', 'chromosomes', 'mapping_scale', +var mapping_input_list = ['temp_uuid', 'trait_id', 'dataset', 'tool_used', 'form_url', 'method', 'transform', 'trimmed_markers', 'selected_chr', 'chromosomes', 'mapping_scale', 'sample_vals', 'score_type', 'suggestive', 'significant', 'num_perm', 'permCheck', 'perm_output', 'perm_strata', 'categorical_vars', 'num_bootstrap', 'bootCheck', 'bootstrap_results', 'LRSCheck', 'covariates', 'maf', 'use_loco', 'manhattan_plot', 'control_marker', 'control_marker_db', 'do_control', 'genofile', 'pair_scan', 'startMb', 'endMb', 'graphWidth', 'lrsMax', 'additiveCheck', 'showSNP', 'showGenes', 'viewLegend', 'haplotypeAnalystCheck', -- cgit v1.2.3 From 95d1887bba6b93ea310c226cb82e9cb64f75cc67 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 18 Dec 2020 14:35:09 -0600 Subject: Changed mapping_results.html to have a single sample_vals input instead of separate ones for every sample + added sample_vals to the list of inputs sent to the loading page --- wqflask/wqflask/templates/mapping_results.html | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html index 1a76ef7a..2fb37832 100644 --- a/wqflask/wqflask/templates/mapping_results.html +++ b/wqflask/wqflask/templates/mapping_results.html @@ -31,10 +31,7 @@ {% endif %} - - {% for sample in samples %} - - {% endfor %} + @@ -450,7 +447,7 @@ }); - var mapping_input_list = ['temp_uuid', 'trait_id', 'dataset', 'tool_used', 'form_url', 'method', 'transform', 'trimmed_markers', 'selected_chr', 'chromosomes', 'mapping_scale', + var mapping_input_list = ['temp_uuid', 'trait_id', 'dataset', 'tool_used', 'form_url', 'method', 'transform', 'trimmed_markers', 'selected_chr', 'chromosomes', 'mapping_scale', 'sample_vals', 'score_type', 'suggestive', 'significant', 'num_perm', 'permCheck', 'perm_output', 'perm_strata', 'categorical_vars', 'num_bootstrap', 'bootCheck', 'bootstrap_results', 'LRSCheck', 'covariates', 'maf', 'use_loco', 'manhattan_plot', 'color_scheme', 'manhattan_single_color', 'control_marker', 'control_marker_db', 'do_control', 'genofile', 'pair_scan', 'startMb', 'endMb', 'graphWidth', 'lrsMax', 'additiveCheck', 'showSNP', 'showGenes', 'viewLegend', 'haplotypeAnalystCheck', -- cgit v1.2.3 From 7544d03a6d819d70779deb79d38b7465a648c1ff Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 18 Dec 2020 14:36:53 -0600 Subject: Changed run_mapping.py to get sample names and values from JSON instead of a bunch of separate input parameters --- wqflask/wqflask/marker_regression/run_mapping.py | 64 ++++++------------------ 1 file changed, 15 insertions(+), 49 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index 891fcc66..a1f87b61 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -71,56 +71,22 @@ class RunMapping(object): all_samples_ordered = self.dataset.group.all_samples_ordered() self.vals = [] - if 'samples' in start_vars: - self.samples = start_vars['samples'].split(",") - if (len(genofile_samplelist) != 0): - for sample in genofile_samplelist: - if sample in self.samples: - value = start_vars.get('value:' + sample) - if value: - self.vals.append(value) - else: - self.vals.append("x") - else: - for sample in self.samples: - value = start_vars.get('value:' + sample) - if value: - self.vals.append(value) + self.samples = [] + self.sample_vals = start_vars['sample_vals'] + sample_val_dict = json.loads(self.sample_vals) + samples = sample_val_dict.keys() + if (len(genofile_samplelist) != 0): + for sample in genofile_samplelist: + self.samples.append(sample) + if sample in samples: + self.vals.append(sample_val_dict[sample]) + else: + self.vals.append("x") else: - self.samples = [] - if (len(genofile_samplelist) != 0): - for sample in genofile_samplelist: - if sample in self.dataset.group.samplelist: - in_trait_data = False - for item in self.this_trait.data: - if self.this_trait.data[item].name == sample: - value = start_vars['value:' + self.this_trait.data[item].name] - self.samples.append(self.this_trait.data[item].name) - self.vals.append(value) - in_trait_data = True - break - if not in_trait_data: - value = start_vars.get('value:' + sample) - if value: - self.samples.append(sample) - self.vals.append(value) - else: - self.vals.append("x") - else: - for sample in self.dataset.group.samplelist: # sample is actually the name of an individual - in_trait_data = False - for item in self.this_trait.data: - if self.this_trait.data[item].name == sample: - value = start_vars['value:' + self.this_trait.data[item].name] - self.samples.append(self.this_trait.data[item].name) - self.vals.append(value) - in_trait_data = True - break - if not in_trait_data: - value = start_vars.get('value:' + sample) - if value: - self.samples.append(sample) - self.vals.append(value) + for sample in self.dataset.group.samplelist: + if sample in samples: + self.vals.append(sample_val_dict[sample]) + self.samples.append(sample) if 'n_samples' in start_vars: self.n_samples = start_vars['n_samples'] -- cgit v1.2.3 From 6d493f7ef57322f226dd310497e4dc7518440cfd Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 18 Dec 2020 14:38:09 -0600 Subject: Changed display_mapping_results.py to get sample names and values from the JSON sample_vals parameter --- .../marker_regression/display_mapping_results.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index 08c2d750..9f1b050d 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -270,8 +270,9 @@ class DisplayMappingResults(object): # Needing for form submission when doing single chr # mapping or remapping after changing options - self.samples = start_vars['samples'] - self.vals = start_vars['vals'] + self.sample_vals = start_vars['sample_vals'] + self.sample_vals_dict = json.loads(self.sample_vals) + self.transform = start_vars['transform'] self.mapping_method = start_vars['mapping_method'] self.mapping_results_path = start_vars['mapping_results_path'] @@ -492,11 +493,10 @@ class DisplayMappingResults(object): ## count the amount of individuals to be plotted, and increase self.graphHeight if self.haplotypeAnalystChecked and self.selectedChr > -1: thisTrait = self.this_trait - _strains, _vals, _vars, _aliases = thisTrait.export_informative() smd=[] - for ii, _val in enumerate(self.vals): - if _val != "x": - temp = GeneralObject(name=self.samples[ii], value=float(_val)) + for sample in self.sample_vals_dict.keys(): + if self.sample_vals_dict[sample] != "x": + temp = GeneralObject(name=sample, value=float(self.sample_vals_dict[sample])) smd.append(temp) else: continue @@ -1464,12 +1464,11 @@ class DisplayMappingResults(object): yPaddingTop = yTopOffset thisTrait = self.this_trait - _strains, _vals, _vars, _aliases = thisTrait.export_informative() smd=[] - for ii, _val in enumerate(self.vals): - if _val != "x": - temp = GeneralObject(name=self.samples[ii], value=float(_val)) + for sample in self.sample_vals_dict.keys(): + if self.sample_vals_dict[sample] != "x": + temp = GeneralObject(name=sample, value=float(self.sample_vals_dict[sample])) smd.append(temp) else: continue -- cgit v1.2.3 From 41efd6840f2e1c052dbb77affd6f09fc2e2bcd05 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 18 Dec 2020 14:39:31 -0600 Subject: Changed show_corr_results.py to get sample names/values from the JSON sample_vals parameter --- wqflask/wqflask/correlation/show_corr_results.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 7d3b9b9f..be983c87 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -87,8 +87,6 @@ class CorrelationResults(object): else: helper_functions.get_species_dataset_trait(self, start_vars) - #self.dataset.group.read_genotype_file() - corr_samples_group = start_vars['corr_samples_group'] self.sample_data = {} @@ -454,13 +452,13 @@ class CorrelationResults(object): if not excluded_samples: excluded_samples = () + sample_val_dict = json.loads(start_vars['sample_vals']) for sample in sample_names: if sample not in excluded_samples: - # print("Looking for",sample,"in",start_vars) - value = start_vars.get('value:' + sample) - if value: - if not value.strip().lower() == 'x': - self.sample_data[str(sample)] = float(value) + value = sample_val_dict[sample] + if not value.strip().lower() == 'x': + self.sample_data[str(sample)] = float(value) + def do_bicor(this_trait_vals, target_trait_vals): r_library = ro.r["library"] # Map the library function -- cgit v1.2.3 From 453ac34383d54910e821609b80b69ff41c48d0ce Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 18 Dec 2020 14:53:01 -0600 Subject: Added Additive Effect when using LOCO with GEMMA --- wqflask/wqflask/marker_regression/gemma_mapping.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/marker_regression/gemma_mapping.py b/wqflask/wqflask/marker_regression/gemma_mapping.py index 630a3afa..ab3a7278 100644 --- a/wqflask/wqflask/marker_regression/gemma_mapping.py +++ b/wqflask/wqflask/marker_regression/gemma_mapping.py @@ -54,7 +54,7 @@ def run_gemma(this_trait, this_dataset, samples, vals, covariates, use_loco, maf TEMPDIR, trait_filename) if covariates != "": - gemma_command += ' -c %s/%s_covariates.txt -a %s/%s_snps.txt -lmm 2 -maf %s > %s/gn2/%s.json' % (flat_files('mapping'), + gemma_command += ' -c %s/%s_covariates.txt -a %s/%s_snps.txt -lmm 9 -maf %s > %s/gn2/%s.json' % (flat_files('mapping'), this_dataset.group.name, flat_files('genotype/bimbam'), genofile_name, @@ -62,7 +62,7 @@ def run_gemma(this_trait, this_dataset, samples, vals, covariates, use_loco, maf TEMPDIR, gwa_output_filename) else: - gemma_command += ' -a %s/%s_snps.txt -lmm 2 -maf %s > %s/gn2/%s.json' % (flat_files('genotype/bimbam'), + gemma_command += ' -a %s/%s_snps.txt -lmm 9 -maf %s > %s/gn2/%s.json' % (flat_files('genotype/bimbam'), genofile_name, maf, TEMPDIR, @@ -184,11 +184,8 @@ def parse_loco_output(this_dataset, gwa_output_filename, loco="True"): else: marker['chr'] = line.split("\t")[0] marker['Mb'] = float(line.split("\t")[2]) / 1000000 - if loco == "True": - marker['p_value'] = float(line.split("\t")[9]) - else: - marker['p_value'] = float(line.split("\t")[10]) - marker['additive'] = float(line.split("\t")[7]) + marker['p_value'] = float(line.split("\t")[10]) + marker['additive'] = float(line.split("\t")[7]) if math.isnan(marker['p_value']) or (marker['p_value'] <= 0): marker['lod_score'] = 0 #marker['lrs_value'] = 0 -- cgit v1.2.3 From 69f92ef2bc10477a80eff96fb7cc83fee11f31e8 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 18 Dec 2020 17:05:55 -0600 Subject: This should fix the Github login error --- wqflask/wqflask/user_login.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/user_login.py b/wqflask/wqflask/user_login.py index f25ebc32..b6266b2a 100644 --- a/wqflask/wqflask/user_login.py +++ b/wqflask/wqflask/user_login.py @@ -239,7 +239,7 @@ def github_oauth2(): } result = requests.post("https://github.com/login/oauth/access_token", json=data) - result_dict = {arr[0]:arr[1] for arr in [tok.split("=") for tok in [token.encode("utf-8") for token in result.text.split("&")]]} + result_dict = {arr[0]:arr[1] for arr in [tok.split("=") for tok in result.text.split("&")]} github_user = get_github_user_details(result_dict["access_token"]) -- cgit v1.2.3 From fc717c36d334f364bbae8c98f31ddf78e18d64e3 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 18 Dec 2020 17:34:47 -0600 Subject: Added redirect_uri to the ORCID_AUTH_URL since it wasn't working due to missing this parameter --- wqflask/utility/tools.py | 2 +- wqflask/wqflask/user_login.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'wqflask') diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py index 68ef0f04..65df59c3 100644 --- a/wqflask/utility/tools.py +++ b/wqflask/utility/tools.py @@ -267,7 +267,7 @@ ORCID_CLIENT_SECRET = get_setting('ORCID_CLIENT_SECRET') ORCID_AUTH_URL = None if ORCID_CLIENT_ID != 'UNKNOWN' and ORCID_CLIENT_SECRET: ORCID_AUTH_URL = "https://orcid.org/oauth/authorize?response_type=code&scope=/authenticate&show_login=true&client_id=" + \ - ORCID_CLIENT_ID+"&client_secret="+ORCID_CLIENT_SECRET + ORCID_CLIENT_ID+"&client_secret="+ORCID_CLIENT_SECRET + "&redirect_uri=" + GN2_BRANCH_URL + "n/login/orcid_oauth2" ORCID_TOKEN_URL = get_setting('ORCID_TOKEN_URL') ELASTICSEARCH_HOST = get_setting('ELASTICSEARCH_HOST') diff --git a/wqflask/wqflask/user_login.py b/wqflask/wqflask/user_login.py index b6266b2a..bc608e84 100644 --- a/wqflask/wqflask/user_login.py +++ b/wqflask/wqflask/user_login.py @@ -25,7 +25,7 @@ from utility.logger import getLogger logger = getLogger(__name__) from smtplib import SMTP -from utility.tools import SMTP_CONNECT, SMTP_USERNAME, SMTP_PASSWORD, LOG_SQL_ALCHEMY +from utility.tools import SMTP_CONNECT, SMTP_USERNAME, SMTP_PASSWORD, LOG_SQL_ALCHEMY, GN2_BRANCH_URL THREE_DAYS = 60 * 60 * 24 * 3 @@ -277,9 +277,11 @@ def orcid_oauth2(): data = { "client_id": ORCID_CLIENT_ID, "client_secret": ORCID_CLIENT_SECRET, - "grant_type": "authorization_code", + "grant_type": "authorization_code", + "redirect_uri": GN2_BRANCH_URL + "n/login/orcid_oauth2", "code": code } + result = requests.post(ORCID_TOKEN_URL, data=data) result_dict = json.loads(result.text.encode("utf-8")) -- cgit v1.2.3 From 0560b297a9a6139079ee237bc8d98f471e7703f5 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 25 Dec 2020 19:18:48 -0600 Subject: Added edit_data_change to block_by_attribute_value so it will update stats figures after using that tool --- wqflask/wqflask/static/new/javascript/show_trait.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index e9c7cce1..312cc22f 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -641,6 +641,8 @@ block_by_attribute_value = function() { this_val_node.value = "x"; } } + + edit_data_change(); }; $('#exclude_by_attr').click(block_by_attribute_value); -- cgit v1.2.3 From c26304ed6a2937654794f908c13ccd3ba4a66453 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 28 Dec 2020 14:25:51 -0600 Subject: Fix issue that caused error bars to not work for bar chart --- wqflask/wqflask/static/new/javascript/show_trait.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 312cc22f..6918cf34 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -448,7 +448,7 @@ edit_data_change = function() { if (is_number(sample_val) && sample_val !== "") { sample_val = parseFloat(sample_val); sample_sets[table].add_value(sample_val); - if (typeof var_nodes !== 'undefined'){ + if (typeof var_nodes === 'undefined'){ sample_var = null; } else { sample_var = var_nodes[_j].childNodes[0].value @@ -471,6 +471,7 @@ edit_data_change = function() { } } } + } update_stat_values(sample_sets); -- cgit v1.2.3 From 3241a8de759f18bbbc73bd755419831db37e71a0 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 28 Dec 2020 15:01:31 -0600 Subject: Added 'Location Type' option to show_trait correlation options --- wqflask/wqflask/templates/show_trait_calculate_correlations.html | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/show_trait_calculate_correlations.html b/wqflask/wqflask/templates/show_trait_calculate_correlations.html index eaa0c308..46232b97 100644 --- a/wqflask/wqflask/templates/show_trait_calculate_correlations.html +++ b/wqflask/wqflask/templates/show_trait_calculate_correlations.html @@ -80,6 +80,15 @@
+
+ +
+ +
+
-- cgit v1.2.3 From ab9aebc567d1a10282ae55f282993a3fa9dd3582 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 28 Dec 2020 15:14:32 -0600 Subject: Changed correlation options to always show the location field and both location_type options, since one or the other will always apply --- wqflask/wqflask/templates/show_trait_calculate_correlations.html | 4 ++-- 1 file changed, 2 insertions(+), 2 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 46232b97..cba977ac 100644 --- a/wqflask/wqflask/templates/show_trait_calculate_correlations.html +++ b/wqflask/wqflask/templates/show_trait_calculate_correlations.html @@ -84,12 +84,12 @@
-
+
-- cgit v1.2.3 From a336ca94fd473fdfd6cc5a83ce879429c0f1db92 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 28 Dec 2020 15:15:01 -0600 Subject: Added JS controlling which location_type options are available depending upon the selected target dataset --- wqflask/wqflask/static/new/javascript/show_trait.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 6918cf34..a301615b 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -519,21 +519,26 @@ $('select[name=corr_type]').change(on_corr_method_change); on_dataset_change = function() { let dataset_type = $('select[name=corr_dataset] option:selected').data('type'); + let location_type = $('select[name=location_type] option:selected').val(); if (dataset_type == "mrna_assay"){ $('#min_expr_filter').show(); - $('#location_filter').show(); + $('select[name=location_type] option:disabled').prop('disabled', false) } else if (dataset_type == "pheno"){ $('#min_expr_filter').show(); - $('#location_filter').hide(); + $('select[name=location_type]>option:eq(0)').prop('disabled', true).attr('selected', false); + $('select[name=location_type]>option:eq(1)').prop('disabled', false).attr('selected', true); } else { $('#min_expr_filter').hide(); - $('#location_filter').show(); + $('select[name=location_type]>option:eq(0)').prop('disabled', false).attr('selected', true); + $('select[name=location_type]>option:eq(1)').prop('disabled', true).attr('selected', false); } } + $('select[name=corr_dataset]').change(on_dataset_change); +$('select[name=location_type]').change(on_dataset_change); submit_special = function(url) { get_table_contents_for_form_submit("trait_data_form"); -- cgit v1.2.3 From 8dd6f67d37c2d5cc800ee9dc33dd13a566e256fa Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 28 Dec 2020 15:48:50 -0600 Subject: Incorporated location_type into the filtering logic for the correlation page --- wqflask/wqflask/correlation/show_corr_results.py | 37 +++++++++++++++--------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 298a3559..6175dc7e 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -101,11 +101,12 @@ class CorrelationResults(object): 'min_loc_mb' in start_vars and 'max_loc_mb' in start_vars): + self.location_type = get_string(start_vars, 'location_type') self.location_chr = get_string(start_vars, 'loc_chr') self.min_location_mb = get_int(start_vars, 'min_loc_mb') self.max_location_mb = get_int(start_vars, 'max_loc_mb') else: - self.location_chr = self.min_location_mb = self.max_location_mb = None + self.location_type = self.location_chr = self.min_location_mb = self.max_location_mb = None self.get_formatted_corr_type() self.return_number = int(start_vars['corr_return_results']) @@ -173,23 +174,25 @@ class CorrelationResults(object): self.correlation_data = collections.OrderedDict(sorted(list(self.correlation_data.items()), key=lambda t: -abs(t[1][0]))) - if self.target_dataset.type == "ProbeSet" or self.target_dataset.type == "Geno": - #ZS: Convert min/max chromosome to an int for the location range option - range_chr_as_int = None - for order_id, chr_info in list(self.dataset.species.chromosomes.chromosomes.items()): - if 'loc_chr' in start_vars: - if chr_info.name == self.location_chr: - range_chr_as_int = order_id + + #ZS: Convert min/max chromosome to an int for the location range option + range_chr_as_int = None + for order_id, chr_info in list(self.dataset.species.chromosomes.chromosomes.items()): + if 'loc_chr' in start_vars: + if chr_info.name == self.location_chr: + range_chr_as_int = order_id for _trait_counter, trait in enumerate(list(self.correlation_data.keys())[:self.return_number]): trait_object = create_trait(dataset=self.target_dataset, name=trait, get_qtl_info=True, get_sample_info=False) if not trait_object: continue - if self.target_dataset.type == "ProbeSet" or self.target_dataset.type == "Geno": - #ZS: Convert trait chromosome to an int for the location range option - chr_as_int = 0 - for order_id, chr_info in list(self.dataset.species.chromosomes.chromosomes.items()): + chr_as_int = 0 + for order_id, chr_info in list(self.dataset.species.chromosomes.chromosomes.items()): + if self.location_type == "highest_lod": + if chr_info.name == trait_object.locus_chr: + chr_as_int = order_id + else: if chr_info.name == trait_object.chr: chr_as_int = order_id @@ -199,9 +202,15 @@ class CorrelationResults(object): if (self.target_dataset.type == "ProbeSet" or self.target_dataset.type == "Publish") and bool(trait_object.mean): if (self.min_expr != None) and (float(trait_object.mean) < self.min_expr): continue - if self.target_dataset.type == "ProbeSet" or self.target_dataset.type == "Geno": - if range_chr_as_int != None and (chr_as_int != range_chr_as_int): + + if range_chr_as_int != None and (chr_as_int != range_chr_as_int): + continue + if self.location_type == "highest_lod": + if (self.min_location_mb != None) and (float(trait_object.locus_mb) < float(self.min_location_mb)): + continue + if (self.max_location_mb != None) and (float(trait_object.locus_mb) > float(self.max_location_mb)): continue + else: if (self.min_location_mb != None) and (float(trait_object.mb) < float(self.min_location_mb)): continue if (self.max_location_mb != None) and (float(trait_object.mb) > float(self.max_location_mb)): -- cgit v1.2.3 From dd2c510ea09ea3169cac3685b299640226d5606a Mon Sep 17 00:00:00 2001 From: Alexanderkabui Date: Sun, 27 Dec 2020 23:17:36 +0300 Subject: update tests for run gemma --- .../wqflask/marker_regression/test_gemma_mapping.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'wqflask') diff --git a/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py b/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py index eab6afe6..fe2569b8 100644 --- a/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py +++ b/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py @@ -144,21 +144,26 @@ class TestGemmaMapping(unittest.TestCase): "files": [["file_name", "user", "~/file1"], ["file_name", "user", "~/file2"]] } - return_file_1 = """X/Y\t L1\t21\tQ\tE\tA\tP\tMMB\tCDE\t0.5 -X/Y\tL2\t21322\tQ\tE\tA\tP\tMMB\tCDE\t0.5 -chr\tL3\t12312\tQ\tE\tA\tP\tMMB\tCDE\t0.7""" - return_file_2 = """chr\tother\t21322\tQ\tE\tA\tP\tMMB\tCDE\t0.5""" + return_file="""X/Y\tM1\t28.457155\tQ\tE\tA\tMMB\t23.3\tW\t0.9\t0.85\t +chr4\tM2\t12\tQ\tE\tMMB\tR\t24\tW\t0.87\t0.5 +Y\tM4\t12\tQ\tE\tMMB\tR\t11.6\tW\t0.21\t0.7 +X\tM5\t12\tQ\tE\tMMB\tR\t21.1\tW\t0.65\t0.6""" + + return_file_2 = """chr\tother\t21322\tQ\tE\tA\tP\tMMB\tCDE\t0.5\t0.4""" mock_os.path.isfile.return_value = True file_to_write = """{"files":["file_1","file_2"]}""" with mock.patch("builtins.open") as mock_open: handles = (mock.mock_open(read_data="gwas").return_value, mock.mock_open( - read_data=return_file_1).return_value, mock.mock_open(read_data=return_file_2).return_value) + read_data=return_file).return_value, mock.mock_open(read_data=return_file_2).return_value) mock_open.side_effect = handles results = parse_loco_output( this_dataset={}, gwa_output_filename=".xw/") - expected_results = [{'name': ' L1', 'chr': 'X/Y', 'Mb': 2.1e-05, 'p_value': 0.5, 'lod_score': 0.3010299956639812}, { - 'name': 'L2', 'chr': 'X/Y', 'Mb': 0.021322, 'p_value': 0.5, 'lod_score': 0.3010299956639812}] + expected_results= [ + {'name': 'M1', 'chr': 'X/Y', 'Mb': 2.8457155e-05, 'p_value': 0.85, 'additive': 23.3, 'lod_score': 0.07058107428570727}, + {'name': 'M2', 'chr': 4, 'Mb': 1.2e-05, 'p_value': 0.5, 'additive': 24.0, 'lod_score': 0.3010299956639812}, + {'name': 'M4', 'chr': 'Y', 'Mb': 1.2e-05, 'p_value': 0.7, 'additive': 11.6, 'lod_score': 0.1549019599857432}, + {'name': 'M5', 'chr': 'X', 'Mb': 1.2e-05, 'p_value': 0.6, 'additive': 21.1, 'lod_score': 0.22184874961635637}] self.assertEqual(expected_results, results) -- cgit v1.2.3 From e7324bf55b7dcfd46f7a2ab52765977fb189c26b Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 29 Dec 2020 13:12:48 -0600 Subject: Added location_type to the list of inputs to correlation page (a list of form inputs the correlation page needs is passed with it so it doesn't get unrelated form inputs) --- wqflask/wqflask/static/new/javascript/show_trait.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index a301615b..83d4f193 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -566,7 +566,7 @@ get_table_contents_for_form_submit = function(form_id) { } var corr_input_list = ['corr_type', 'primary_samples', 'trait_id', 'dataset', 'group', 'tool_used', 'form_url', 'corr_sample_method', 'corr_samples_group', 'corr_dataset', 'min_expr', - 'corr_return_results', 'loc_chr', 'min_loc_mb', 'max_loc_mb', 'p_range_lower', 'p_range_upper'] + 'corr_return_results', 'location_type', 'loc_chr', 'min_loc_mb', 'max_loc_mb', 'p_range_lower', 'p_range_upper'] $(".corr_compute").on("click", (function(_this) { return function() { -- cgit v1.2.3 From 1bd2d85624e04966ed20ec84dc6ba2cfda85d794 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 29 Dec 2020 15:03:22 -0600 Subject: Used a try/catch to deal with situations where there's no SE/var column, since apparently var_nodes wasn't undefined, causing the previous check to not work --- wqflask/wqflask/static/new/javascript/show_trait.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 6918cf34..1025233b 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -448,15 +448,15 @@ edit_data_change = function() { if (is_number(sample_val) && sample_val !== "") { sample_val = parseFloat(sample_val); sample_sets[table].add_value(sample_val); - if (typeof var_nodes === 'undefined'){ - sample_var = null; - } else { + try { sample_var = var_nodes[_j].childNodes[0].value if (is_number(sample_var)) { sample_var = parseFloat(sample_var) } else { sample_var = null; } + } catch { + sample_var = null; } sample_dict = { value: sample_val, -- cgit v1.2.3 From 7d8e41cd6d31c51adfedcf7abc0da553dd58762c Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 4 Jan 2021 13:04:55 -0600 Subject: Removed logging line from draw_probability_plot.js --- wqflask/wqflask/static/new/javascript/draw_probability_plot.js | 1 - 1 file changed, 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/draw_probability_plot.js b/wqflask/wqflask/static/new/javascript/draw_probability_plot.js index 3d756303..1b944d4f 100644 --- a/wqflask/wqflask/static/new/javascript/draw_probability_plot.js +++ b/wqflask/wqflask/static/new/javascript/draw_probability_plot.js @@ -118,7 +118,6 @@ }; }; data = [make_data('samples_primary'), make_data('samples_other')]; - console.log("THE DATA IS:", data); d3.select("#prob_plot_container svg").datum(data).call(chart); if (js_data.trait_symbol != null) { $("#prob_plot_title").html("

" + js_data.trait_symbol + ": " + js_data.trait_id + "

"); -- cgit v1.2.3 From 1e8c9e4bbc2f8b2085eaf77f469001660cf3c43d Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 4 Jan 2021 13:12:02 -0600 Subject: Increased the top margin on the trait page Bar Chart, which should prevent the chart options from overlapping with the title --- wqflask/wqflask/static/new/javascript/show_trait.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 1025233b..66f7b606 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -1302,7 +1302,7 @@ if (js_data.num_values < 256) { margin: { l: left_margin, r: 30, - t: 30, + t: 100, b: bottom_margin } }; -- cgit v1.2.3 From 683381f1c98afa58cc40f1a1f000f5e136c931e3 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 4 Jan 2021 13:15:55 -0600 Subject: Removed Scatterplot Matrix since it isn't working and wasn't really used to begin with --- wqflask/wqflask/static/new/javascript/show_trait.js | 18 ------------------ wqflask/wqflask/templates/show_trait_statistics.html | 16 ---------------- 2 files changed, 34 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 66f7b606..832dd1e4 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -94,25 +94,7 @@ add = function() { $('#add_to_collection').click(add); sample_lists = js_data.sample_lists; sample_group_types = js_data.sample_group_types; -d3.select("#select_compare_trait").on("click", (function(_this) { - return function() { - $('.scatter-matrix-container').remove(); - return open_trait_selection(); - }; -})(this)); -$(".select_covariates").click(function () { - open_covariate_selection(); -}); -$(".remove_covariates").click(function () { - $("input[name=covariates]").val("") - $(".selected-covariates").val("") -}); -d3.select("#clear_compare_trait").on("click", (function(_this) { - return function() { - return $('.scatter-matrix-container').remove(); - }; -})(this)); open_trait_selection = function() { return $('#collections_holder').load('/collections/list?color_by_trait #collections_list', (function(_this) { return function() { diff --git a/wqflask/wqflask/templates/show_trait_statistics.html b/wqflask/wqflask/templates/show_trait_statistics.html index 4f347d4e..865959b1 100644 --- a/wqflask/wqflask/templates/show_trait_statistics.html +++ b/wqflask/wqflask/templates/show_trait_statistics.html @@ -21,9 +21,6 @@
  • Violin Plot
  • -
  • - Scatterplot Matrix -
  • @@ -116,19 +113,6 @@
    -
    -
    - - -
    -
    -
    -
    -