From 1f74f44c2a066833b735690664eea2efca0e8466 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 3 Oct 2019 11:48:36 -0500 Subject: Bar chart y axis range should update with transforms Changed the way aliases are used in searches to hopefully limit results to things that make sense Fixed issue where headers didn't appear correctly for correlation results when correlating against a genotype dataset --- wqflask/wqflask/correlation/show_corr_results.py | 4 ++-- wqflask/wqflask/do_search.py | 5 ++++- .../wqflask/static/new/javascript/show_trait.js | 24 +++++++++++++--------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 0db8fa38..be27da7b 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -610,14 +610,14 @@ def get_header_fields(data_type, corr_method): if corr_method == "pearson": header_fields = ['Index', 'ID', - 'Location' + 'Location', 'Sample r', 'N', 'Sample p(r)'] else: header_fields = ['Index', 'ID', - 'Location' + 'Location', 'Sample rho', 'N', 'Sample p(rho)'] diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index a7f117ec..3ea841ab 100644 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -125,7 +125,10 @@ class MrnaAssaySearch(DoSearch): aliases = get_aliases(search_string, self.dataset.group.species) if len(aliases) > 0: match_clause += " or " - alias_string = " ".join(aliases) + alias_string_list = [] + for alias in aliases: + alias_string_list.append('"'+alias+'"') + alias_string = " ".join(alias_string_list) match_clause += "(MATCH (ProbeSet.symbol) AGAINST ('%s' IN BOOLEAN MODE))) and " % alias_string else: match_clause += ") and " diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 830dbf7f..9813fca8 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -261,6 +261,10 @@ update_bar_chart = function() { } } + new_chart_range = get_bar_range(trait_vals, trait_vars) + + root.bar_layout['yaxis']['range'] = new_chart_range + root.bar_data[0]['y'] = trait_vals root.bar_data[0]['error_y'] = { type: 'data', @@ -886,16 +890,16 @@ var bar_trace = { root.bar_data = [bar_trace] -get_bar_range = function(sample_list){ +get_bar_range = function(sample_vals, sample_errors = null){ positive_error_vals = [] negative_error_vals = [] - for (i = 0;i < get_sample_vals(sample_list).length; i++){ - if (get_sample_errors(sample_list)[0][i] != undefined) { - positive_error_vals.push(get_sample_vals(sample_list)[i] + get_sample_errors(sample_list)[0][i]) - negative_error_vals.push(get_sample_vals(sample_list)[i] - get_sample_errors(sample_list)[0][i]) + for (i = 0;i < sample_vals.length; i++){ + if (sample_errors[i] != undefined) { + positive_error_vals.push(sample_vals[i] + sample_errors[i]) + negative_error_vals.push(sample_vals[i] - sample_errors[i]) } else { - positive_error_vals.push(get_sample_vals(sample_list)[i]) - negative_error_vals.push(get_sample_vals(sample_list)[i]) + positive_error_vals.push(sample_vals[i]) + negative_error_vals.push(sample_vals[i]) } } @@ -920,12 +924,12 @@ get_bar_range = function(sample_list){ return [range_bottom, range_top] } -root.chart_range = get_bar_range(sample_lists[0]) +root.chart_range = get_bar_range(get_sample_vals(sample_lists[0]), get_sample_errors(sample_lists[0])[0]) val_range = root.chart_range[1] - root.chart_range[0] -if (val_range < 4){ +if (val_range < 5){ tick_digits = '.1f' -} else if (val_range < 0.4) { +} else if (val_range < 0.5) { tick_digits = '.2f' } else { tick_digits = 'f' -- cgit v1.2.3