From 80709f6573a85f2d1195f938006f46044651320b Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 18 May 2020 15:35:29 -0500 Subject: Added warning that 1 is being added when doing log transform on traits with sample values between 0 and 1 --- .../wqflask/static/new/javascript/show_trait.js | 28 ++++++++++++++++++---- .../new/javascript/show_trait_mapping_tools.js | 5 +--- wqflask/wqflask/templates/show_trait.html | 3 ++- .../templates/show_trait_transform_and_filter.html | 2 +- 4 files changed, 28 insertions(+), 10 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 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('
' + message + '
'); + return $('#outlier_alert_placeholder').append('
' + message + '
'); }; $('#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 @@
{% include 'show_trait_transform_and_filter.html' %}
+
@@ -98,7 +99,7 @@
{% include 'show_trait_mapping_tools.html' %}
-
+
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 @@

Outliers highlighted in - yellow + orange can be hidden using the Hide Outliers button.

-- cgit v1.2.3