From d9ceb094bd6887d81faf37dc93388d3df200e9b7 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 29 Aug 2019 16:03:35 -0500 Subject: Fixed remaining issue where columns didn't show up right and the mean/r filter didn't work right for non-ProbeSet target datasets --- wqflask/wqflask/correlation/show_corr_results.py | 17 ++++++++++-- wqflask/wqflask/templates/correlation_page.html | 35 +++++++++++------------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 1fa47920..0db8fa38 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -150,6 +150,13 @@ class CorrelationResults(object): self.header_fields = get_header_fields(self.target_dataset.type, self.corr_method) + if self.target_dataset.type == "ProbeSet": + self.filter_cols = [7, 6] + elif self.target_dataset.type == "Publish": + self.filter_cols = [6, 0] + else: + self.filter_cols = [4, 0] + self.correlation_results = [] self.correlation_data = {} @@ -583,7 +590,10 @@ def get_header_fields(data_type, corr_method): 'Year', 'Sample r', 'N', - 'Sample p(r)'] + 'Sample p(r)', + 'Max LRS', + 'Max LRS Location', + 'Additive Effect'] else: header_fields = ['Index', 'Record', @@ -592,7 +602,10 @@ def get_header_fields(data_type, corr_method): 'Year', 'Sample rho', 'N', - 'Sample p(rho)'] + 'Sample p(rho)', + 'Max LRS', + 'Max LRS Location', + 'Additive Effect'] else: if corr_method == "pearson": header_fields = ['Index', diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index fffdfd75..cbd2ab46 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -161,12 +161,12 @@ {{ trait.pubmed_text }} - {{ trait.LRS_score_repr }} - {{ trait.LRS_location_repr }} - {% if trait.additive != "" %}{{ '%0.3f' % trait.additive|float }}{% else %}N/A{% endif %} {{'%0.3f'|format(trait.sample_r)}} {{ trait.num_overlap }} {{'%0.3e'|format(trait.sample_p)}} + {{ trait.LRS_score_repr }} + {{ trait.LRS_location_repr }} + {% if trait.additive != "" %}{{ '%0.3f' % trait.additive|float }}{% else %}N/A{% endif %} {% elif target_dataset.type == "Geno" %} {{ trait.location_repr }} {{'%0.3f'|format(trait.sample_r)}} @@ -233,38 +233,37 @@ //$.fn.dataTableExt.afnFiltering.push( $.fn.dataTable.ext.search.push( function( settings, data, dataIndex ) { - var r_column = 10; + var r_column = {{ filter_cols[0] }}; var r_greater = parseFloat($('input[name=r_greater_select]').val()) var r_less = parseFloat($('input[name=r_less_select]').val()); var r_and_or = $('#r_and_or').val(); - var mean_column = 6; + var mean_column = {{ filter_cols[1] }}; var mean_greater = parseFloat($('input[name=mean_greater_select]').val()); var mean_less = parseFloat($('input[name=mean_less_select]').val()); var mean_and_or = $('#mean_and_or').val(); - if (r_and_or == "and" && mean_and_or == "and"){ - if ( (data[r_column] >= r_greater && data[r_column] <= r_less) && (data[mean_column] > mean_greater && data[mean_column] < mean_less) ){ + if ( (data[r_column] >= r_greater && data[r_column] <= r_less) && {% if filter_cols[1] != 0 %}(data[mean_column] > mean_greater && data[mean_column] < mean_less){% else %} true{% endif %} ){ return true } else { return false } } else if (r_and_or == "and" && mean_and_or == "or"){ - if ( (data[r_column] >= r_greater && data[r_column] <= r_less) && (data[mean_column] >= mean_greater || data[mean_column] <= mean_less) ){ + if ( (data[r_column] >= r_greater && data[r_column] <= r_less) && {% if filter_cols[1] != 0 %}(data[mean_column] >= mean_greater || data[mean_column] <= mean_less){% else %} true{% endif %} ){ return true } else { return false } } else if (r_and_or == "or" && mean_and_or == "and") { - if ( (data[r_column] >= r_greater || data[r_column] <= r_less) && (data[mean_column] >= mean_greater && data[mean_column] <= mean_less) ){ + if ( (data[r_column] >= r_greater || data[r_column] <= r_less) && {% if filter_cols[1] != 0 %}(data[mean_column] >= mean_greater && data[mean_column] <= mean_less){% else %} true{% endif %} ){ return true } else { return false } } else { - if ( (data[r_column] >= r_greater || data[r_column] <= r_less) && (data[mean_column] >= mean_greater || data[mean_column] <= mean_less) ){ + if ( (data[r_column] >= r_greater || data[r_column] <= r_less) && {% if filter_cols[1] != 0 %}(data[mean_column] >= mean_greater || data[mean_column] <= mean_less){% else %} true{% endif %} ){ return true } else { return false @@ -360,7 +359,7 @@ $('td', row).eq(4).text($('td', row).eq(4).text() + '...') } }, - "order": [[12, "asc" ]], + "order": [[9, "asc" ]], "sDom": "tir", "iDisplayLength": -1, "autoWidth": false, @@ -395,11 +394,11 @@ { "type": "natural", "width": "12%" }, { "type": "natural" }, { "type": "natural" }, - { "type": "natural" }, - { "type": "natural" }, { "orderDataType": "dom-innertext", 'orderSequence': [ "desc", "asc"] }, + { "type": "scientific" }, { "type": "natural" }, - { "type": "scientific" } + { "type": "natural" }, + { "type": "natural" } ], "createdRow": function ( row, data, index ) { $('td', row).eq(3).attr('title', $('td', row).eq(3).text()); @@ -413,12 +412,10 @@ $('td', row).eq(4).text($('td', row).eq(4).text() + '...') } }, - "order": [[11, "asc" ]], - "sDom": "Btir", + "order": [[8, "asc" ]], + "sDom": "tir", "autoWidth": false, - "bDeferRender": true, - "scrollY": "800px", - "scrollCollapse": false + "bDeferRender": true } {% elif target_dataset.type == "Geno" %} table_conf = { -- cgit v1.2.3