aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Sloan2014-08-28 20:37:05 +0000
committerZachary Sloan2014-08-28 20:37:05 +0000
commitb9ceae1564ea3bfa5648ec2e565eb0e96ea047e1 (patch)
tree986d37257b6347a29ef4c3746c95ef8ecb856bd4
parentb01b62ebd35fa929170657ae69701680812e073d (diff)
downloadgenenetwork2-b9ceae1564ea3bfa5648ec2e565eb0e96ea047e1.tar.gz
Added a validation that warns the user of the number of permutations for
pyLMM is more than 20 (due to speed) Changed the port in the flask settings to 5002 due to adding the new production server branch
-rwxr-xr-xwqflask/cfg/default_settings.py2
l---------wqflask/maintenance/our_settings.py1
-rwxr-xr-xwqflask/wqflask/static/new/javascript/validation.coffee11
-rwxr-xr-xwqflask/wqflask/static/new/javascript/validation.js102
-rwxr-xr-xwqflask/wqflask/templates/show_trait_mapping_tools.html6
5 files changed, 77 insertions, 45 deletions
diff --git a/wqflask/cfg/default_settings.py b/wqflask/cfg/default_settings.py
index e638a9c0..c9d2a934 100755
--- a/wqflask/cfg/default_settings.py
+++ b/wqflask/cfg/default_settings.py
@@ -1,6 +1,6 @@
LOGFILE = """/tmp/flask_gn_log"""
-SERVER_PORT = 5000
+SERVER_PORT = 5002
#This is needed because Flask turns key errors into a
#400 bad request response with no exception/log
diff --git a/wqflask/maintenance/our_settings.py b/wqflask/maintenance/our_settings.py
deleted file mode 120000
index b14de960..00000000
--- a/wqflask/maintenance/our_settings.py
+++ /dev/null
@@ -1 +0,0 @@
-../../../lei_settings.py \ No newline at end of file
diff --git a/wqflask/wqflask/static/new/javascript/validation.coffee b/wqflask/wqflask/static/new/javascript/validation.coffee
index f28e9bd7..901f8c7c 100755
--- a/wqflask/wqflask/static/new/javascript/validation.coffee
+++ b/wqflask/wqflask/static/new/javascript/validation.coffee
@@ -27,5 +27,16 @@ $ ->
console.log("input isn't valid")
$('#remove_samples_invalid').show()
+ validate_pylmm_permutation = ->
+ ###
+ Check if number of permutations is high (and will take long to compute)
+ ###
+ input = $('input[name=num_perm_pylmm]').val()
+ console.log("input:", input)
+ if input > 20
+ $('#permutations_alert').show()
+ else
+ $('#permutations_alert').hide()
+ $('input[name=num_perm_pylmm]').change(validate_pylmm_permutation)
$('#remove_samples_field').change(validate_remove_samples) \ No newline at end of file
diff --git a/wqflask/wqflask/static/new/javascript/validation.js b/wqflask/wqflask/static/new/javascript/validation.js
index 9536491b..24a2a5b0 100755
--- a/wqflask/wqflask/static/new/javascript/validation.js
+++ b/wqflask/wqflask/static/new/javascript/validation.js
@@ -1,47 +1,65 @@
// Generated by CoffeeScript 1.7.1
-$(function() {
- var remove_samples_is_valid, validate_remove_samples;
- remove_samples_is_valid = function(input) {
- var new_splats, pattern, splat, splats, _i, _len;
- if (_.trim(input).length === 0) {
+(function() {
+ $(function() {
+ var remove_samples_is_valid, validate_pylmm_permutation, validate_remove_samples;
+ remove_samples_is_valid = function(input) {
+ var new_splats, pattern, splat, splats, _i, _len;
+ if (_.trim(input).length === 0) {
+ return true;
+ }
+ splats = input.split(",");
+ new_splats = (function() {
+ var _i, _len, _results;
+ _results = [];
+ for (_i = 0, _len = splats.length; _i < _len; _i++) {
+ input = splats[_i];
+ _results.push(_.trim(input));
+ }
+ return _results;
+ })();
+ console.log("new_splats:", new_splats);
+ pattern = /^\d+\s*(?:-\s*\d+)?\s*$/;
+ for (_i = 0, _len = new_splats.length; _i < _len; _i++) {
+ splat = new_splats[_i];
+ console.log("splat is:", splat);
+ if (!splat.match(pattern)) {
+ return false;
+ }
+ }
return true;
- }
- splats = input.split(",");
- new_splats = (function() {
- var _i, _len, _results;
- _results = [];
- for (_i = 0, _len = splats.length; _i < _len; _i++) {
- input = splats[_i];
- _results.push(_.trim(input));
+ };
+ validate_remove_samples = function() {
+
+ /*
+ Check if input for the remove samples function is valid and notify the user if not
+ */
+ var input;
+ input = $('#remove_samples_field').val();
+ console.log("input is:", input);
+ if (remove_samples_is_valid(input)) {
+ console.log("input is valid");
+ return $('#remove_samples_invalid').hide();
+ } else {
+ console.log("input isn't valid");
+ return $('#remove_samples_invalid').show();
}
- return _results;
- })();
- console.log("new_splats:", new_splats);
- pattern = /^\d+\s*(?:-\s*\d+)?\s*$/;
- for (_i = 0, _len = new_splats.length; _i < _len; _i++) {
- splat = new_splats[_i];
- console.log("splat is:", splat);
- if (!splat.match(pattern)) {
- return false;
+ };
+ validate_pylmm_permutation = function() {
+
+ /*
+ Check if number of permutations is high (and will take long to compute)
+ */
+ var input;
+ input = $('input[name=num_perm_pylmm]').val();
+ console.log("input:", input);
+ if (input > 20) {
+ return $('#permutations_alert').show();
+ } else {
+ return $('#permutations_alert').hide();
}
- }
- return true;
- };
- validate_remove_samples = function() {
+ };
+ $('input[name=num_perm_pylmm]').change(validate_pylmm_permutation);
+ return $('#remove_samples_field').change(validate_remove_samples);
+ });
- /*
- Check if input for the remove samples function is valid and notify the user if not
- */
- var input;
- input = $('#remove_samples_field').val();
- console.log("input is:", input);
- if (remove_samples_is_valid(input)) {
- console.log("input is valid");
- return $('#remove_samples_invalid').hide();
- } else {
- console.log("input isn't valid");
- return $('#remove_samples_invalid').show();
- }
- };
- return $('#remove_samples_field').change(validate_remove_samples);
-});
+}).call(this);
diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html
index 61fb98de..d6426f0c 100755
--- a/wqflask/wqflask/templates/show_trait_mapping_tools.html
+++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html
@@ -151,8 +151,12 @@
<div class="control-group mapping_method_fields">
<label for="mapping_permutations" class="control-label">Permutations (n)</label>
<div class="controls">
- <input name="num_perm_pylmm" value="2000" type="text" />
+ <input name="num_perm_pylmm" value="20" type="text" />
</div>
+
+ </div>
+ <div id="permutations_alert" class="alert alert-error" style="display:none;">
+ Please be aware that permutations can take a very long time (~20 minutes for 500 permutations)
</div>
<div class="control-group" id="display_all_div">
<label class="control-label">Manhattan Plot</label>