diff options
author | zsloan | 2020-05-18 15:35:29 -0500 |
---|---|---|
committer | zsloan | 2020-05-18 15:35:29 -0500 |
commit | 80709f6573a85f2d1195f938006f46044651320b (patch) | |
tree | d0cf3dfd27862ccd827e02a72339757657d530b4 | |
parent | 442ec66a603bdc312f760027d4c000ba7af14fe6 (diff) | |
download | genenetwork2-80709f6573a85f2d1195f938006f46044651320b.tar.gz |
Added warning that 1 is being added when doing log transform on traits with sample values between 0 and 1
4 files changed, 28 insertions, 10 deletions
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 2f276021..c0b2e6db 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -755,12 +755,12 @@ check_for_zero_to_one_vals = function() { $('.trait_value_input').each(function() { current_value = $(this).data("value") if(isNaN(current_value)) { - return; + return true; } else { current_value = parseFloat(current_value) if (0 <= current_value && current_value < 1){ zero_to_one_vals_exist = true - return false; + return false } } }); @@ -769,7 +769,6 @@ check_for_zero_to_one_vals = function() { normalize_data = function() { if ($('#norm_method option:selected').val() == 'log2' || $('#norm_method option:selected').val() == 'log10'){ - zero_to_one_vals_exist = check_for_zero_to_one_vals(); if ($('input[name="transform"]').val() != "log2" && $('#norm_method option:selected').val() == 'log2') { log2_normalize_data(zero_to_one_vals_exist) $('input[name="transform"]').val("log2") @@ -810,7 +809,28 @@ normalize_data = function() { } } -$('#normalize').click(normalize_data); +zero_to_one_vals_exist = false + +show_transform_warning = function() { + transform_type = $('#norm_method option:selected').val() + zero_to_one_vals_exist = check_for_zero_to_one_vals(); + if (transform_type == "log2" || transform_type == "log10"){ + if (zero_to_one_vals_exist){ + $('#transform_alert').css("display", "block") + } + } else { + $('#transform_alert').css("display", "none") + } +} + +$('#norm_method').change(function(){ + show_transform_warning() +}); +$('#normalize').hover(function(){ + show_transform_warning() +}); + +$('#normalize').click(normalize_data) switch_qnorm_data = function() { return $('.trait_value_input').each((function(_this) { 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 7176a0da..01da3f74 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -131,11 +131,8 @@ }; outlier_text = "One or more outliers exist in this data set. Please review values before mapping. Including outliers when mapping may lead to misleading results."; - - runtime_warning_text = "This function could take as long as 10-20 minutes to run, so please do not close your browser window until it finishes." - showalert = function(message, alerttype) { - return $('#alert_placeholder').append('<div id="alertdiv" class="alert ' + alerttype + '"><a class="close" data-dismiss="alert">�</a><span>' + message + '</span></div>'); + return $('#outlier_alert_placeholder').append('<div id="mapping_alert" class="alert ' + alerttype + '"><a class="close" data-dismiss="alert">�</a><span>' + message + '</span></div>'); }; $('#suggestive').hide(); diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index d29be30b..7380d198 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -74,6 +74,7 @@ <div class="panel-body"> {% include 'show_trait_transform_and_filter.html' %} </div> + <div id="transform_alert_placeholder"><div id="transform_alert" style="display: none;"class="alert alert-success outlier-alert"><a class="close" data-dismiss="alert">�</a><span>Because there are some values between 0 and 1, log2 and log10 transforms will add 1 to each value.</span></div></div> </div> </div> <div class="panel panel-default"> @@ -98,7 +99,7 @@ <div class="panel-body"> {% include 'show_trait_mapping_tools.html' %} </div> - <div id="alert_placeholder"></div> + <div id="outlier_alert_placeholder"></div> </div> </div> <div class="panel panel-default"> diff --git a/wqflask/wqflask/templates/show_trait_transform_and_filter.html b/wqflask/wqflask/templates/show_trait_transform_and_filter.html index 4be6d249..b4118b04 100644 --- a/wqflask/wqflask/templates/show_trait_transform_and_filter.html +++ b/wqflask/wqflask/templates/show_trait_transform_and_filter.html @@ -70,7 +70,7 @@ <div> <p>Outliers highlighted in - <strong style="background-color:yellow;">yellow</strong> + <strong style="background-color:orange;">orange</strong> can be hidden using the <strong>Hide Outliers</strong> button. </p> |