diff options
author | Zachary Sloan | 2012-08-23 16:01:46 -0500 |
---|---|---|
committer | Zachary Sloan | 2012-08-23 16:01:46 -0500 |
commit | bc1c2a65b93134f3676188bbee6bb69ee82c77be (patch) | |
tree | a67dbe2b20375df2690978c744b076b6d0f6d5c6 | |
parent | ee24468b3ad5575c4f7ba06aa3319bdab3a34c6c (diff) | |
parent | 300f2fec72ce8e7143e0c954074690224f6d0f70 (diff) | |
download | genenetwork2-bc1c2a65b93134f3676188bbee6bb69ee82c77be.tar.gz |
Merge branch 'flask' of https://github.com/OriginalPenguin/genenetwork into flask
-rw-r--r-- | wqflask/cfg/__init__.py | 0 | ||||
-rw-r--r-- | wqflask/cfg/default_settings.py | 1 | ||||
-rw-r--r-- | wqflask/wqflask/__init__.py | 4 | ||||
-rw-r--r-- | wqflask/wqflask/search_results.py | 2 | ||||
-rwxr-xr-x | wqflask/wqflask/show_trait/DataEditingPage.py | 12 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee | 98 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js | 125 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/js_external/underscore-min.js | 32 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/js_external/underscore.string.min.js | 1 | ||||
-rw-r--r-- | wqflask/wqflask/templates/base.html | 2 | ||||
-rw-r--r-- | wqflask/wqflask/templates/trait_data_and_analysis.html | 5 | ||||
-rw-r--r-- | wqflask/wqflask/templates/whats_new.html | 29 | ||||
-rw-r--r-- | wqflask/wqflask/views.py | 13 | ||||
-rw-r--r-- | wqflask/wqflask/yaml_data/whats_new.yaml | 26 |
14 files changed, 274 insertions, 76 deletions
diff --git a/wqflask/cfg/__init__.py b/wqflask/cfg/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/wqflask/cfg/__init__.py diff --git a/wqflask/cfg/default_settings.py b/wqflask/cfg/default_settings.py new file mode 100644 index 00000000..30ad51d1 --- /dev/null +++ b/wqflask/cfg/default_settings.py @@ -0,0 +1 @@ +LOGFILE = """/tmp/flask_gn_log""" diff --git a/wqflask/wqflask/__init__.py b/wqflask/wqflask/__init__.py index a6119dcc..a7492e77 100644 --- a/wqflask/wqflask/__init__.py +++ b/wqflask/wqflask/__init__.py @@ -9,6 +9,10 @@ from utility import formatting app = Flask(__name__) +# See http://flask.pocoo.org/docs/config/#configuring-from-files +app.config.from_object('cfg.default_settings') +app.config.from_envvar('WQFLASK_SETTINGS') + app.jinja_env.globals.update( numify = formatting.numify ) diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index ce7a6eef..d393d0c1 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -36,7 +36,7 @@ from utility import webqtlUtil from dbFunction import webqtlDatabaseFunction import logging -logging.basicConfig(filename="/tmp/flask_gn_log", level=logging.INFO) +logging.basicConfig(filename=app.config['LOGFILE'], level=logging.INFO) _log = logging.getLogger("search") _ch = logging.StreamHandler() diff --git a/wqflask/wqflask/show_trait/DataEditingPage.py b/wqflask/wqflask/show_trait/DataEditingPage.py index 610124ae..68de5ae4 100755 --- a/wqflask/wqflask/show_trait/DataEditingPage.py +++ b/wqflask/wqflask/show_trait/DataEditingPage.py @@ -227,9 +227,15 @@ class DataEditingPage(templatePage): # """) self.basic_table['columns'] = yaml.load(""" - - All Cases - - BXD Only - - Non-BXD Only + - + n: All Cases + t: all + - + n: BXD Only + t: primary + - + n: Non-BXD Only + t: other """) print(pf(self.basic_table)) diff --git a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee index 2c912f05..bbee9c5a 100644 --- a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee +++ b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee @@ -1,6 +1,7 @@ console.log("start_b") -isNumber = (o) -> +# this is our isNumber, do not confuse with the underscore.js one +is_number = (o) -> return ! isNaN (o-0) && o != null $ -> @@ -20,46 +21,73 @@ $ -> $(".stats_mdp").change(stats_mdp_change) - mean = (the_values)-> - total = 0 - total += value for value in the_values - the_mean = total / the_values.length - the_mean = the_mean.toFixed(2) - current_mean = parseFloat($("#mean_value").html).toFixed(2) - if the_mean != current_mean - $("#mean_value").html(the_mean).effect("highlight") - - n_of_samples = the_values.length - current_n_of_samples = $("#n_of_samples_value").html() - console.log("cnos:", current_n_of_samples) - console.log("n_of_samples:", n_of_samples) - if n_of_samples != current_n_of_samples - $("#n_of_samples_value").html(current_n_of_samples).effect("highlight") + update_stat_values = (the_values)-> + for category in ['primary', 'other', 'all'] + id = "#" + process_id(category, "mean") + console.log("id:", id) + total = 0 + total += value for value in the_values[category] + the_mean = total / the_values[category].length + the_mean = the_mean.toFixed(2) + console.log("aaa") + in_box = $(id).html + console.log("in_box:", in_box) + current_mean = parseFloat($(in_box)).toFixed(2) + console.log("the_mean:", the_mean) + console.log("current_mean:", current_mean) + console.log("aab") + if the_mean != current_mean + console.log("setting mean") + $(id).html(the_mean).effect("highlight") + console.log("should be set") + + n_of_samples = the_values[category].length + id = "#" + process_id(category, "n_of_samples") + console.log("n_of_samples id:", id) + current_n_of_samples = $(id).html() + console.log("cnos:", current_n_of_samples) + console.log("n_of_samples:", n_of_samples) + if n_of_samples != current_n_of_samples + $(id).html(n_of_samples).effect("highlight") edit_data_change = -> - the_values = [] - values = $('#primary').find(".edit_strain_value") + the_values = + primary: [] + other: [] + all: [] + console.log("at beginning:", the_values) + values = $('#value_table').find(".edit_strain_value") #console.log("values are:", values) for value in values real_value = $(value).val() #console.log("parent is:", $(value).closest("tr")) row = $(value).closest("tr") + console.log("row is:", row) + console.log("row[0].id is:", row[0].id) + category = row[0].id checkbox = $(row).find(".edit_strain_checkbox") checked = $(checkbox).attr('checked') if not checked console.log("Not checked") continue - if isNumber(real_value) and real_value != "" - the_values.push(parseFloat(real_value)) - mean(the_values) + if is_number(real_value) and real_value != "" + real_value = parseFloat(real_value) + if _(category).startsWith("Primary") + the_values.primary.push(real_value) + else if _(category).startsWith("Other") + the_values.other.push(real_value) + the_values.all.push(real_value) + console.log("torwads end:", the_values) + update_stat_values(the_values) make_table = -> header = "<thead><tr><th> </th>" for column in basic_table['columns'] - the_id = process_id("column_" + column) - header += """<th id="#{ the_id }">#{ column }</th>""" + console.log("column:", column) + the_id = process_id("column", column.t) + header += """<th id="#{ the_id }">#{ column.n }</th>""" header += "</thead>" rows = [ @@ -90,9 +118,9 @@ $ -> row_line += """<td id="#{ row.vn }">#{ row.pretty }</td>""" for column in basic_table['columns'] console.log("apple:", column) - the_id = process_id(column + "_" + row.vn) + the_id = process_id(column.t, row.vn) console.log("the_id:", the_id) - row_line += """<td id="#{ the_id }"> </td>""" + row_line += """<td id="#{ the_id }">foo</td>""" row_line += """</tr>""" console.log("row line:", row_line) the_rows += row_line @@ -103,14 +131,22 @@ $ -> - process_id = (value) -> + process_id = (values...) -> ### Make an id or a class valid javascript by, for example, eliminating spaces ### - console.log("value:", value) - value = value.replace(" ", "_") - return value - - $('#primary').change(edit_data_change) + processed = "" + for value in values + console.log("value:", value) + value = value.replace(" ", "_") + if processed.length + processed += "-" + processed += value + return processed + + _.mixin(_.str.exports()); # Add string fuctions directly to underscore + $('#value_table').change(edit_data_change) console.log("loaded") console.log("basic_table is:", basic_table) make_table() + edit_data_change() # Set the values at the beginning + #$("#all-mean").html('foobar8') console.log("end") diff --git a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js index c288f11f..1a067820 100644 --- a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js +++ b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js @@ -1,15 +1,16 @@ // Generated by CoffeeScript 1.3.3 (function() { - var isNumber; + var is_number, + __slice = [].slice; console.log("start_b"); - isNumber = function(o) { + is_number = function(o) { return !isNaN((o - 0) && o !== null); }; $(function() { - var edit_data_change, hide_tabs, make_table, mean, process_id, stats_mdp_change; + var edit_data_change, hide_tabs, make_table, process_id, stats_mdp_change, update_stat_values; hide_tabs = function(start) { var x, _i, _results; _results = []; @@ -26,46 +27,82 @@ return $("#stats_tabs" + selected).show(); }; $(".stats_mdp").change(stats_mdp_change); - mean = function(the_values) { - var current_mean, current_n_of_samples, n_of_samples, the_mean, total, value, _i, _len; - total = 0; - for (_i = 0, _len = the_values.length; _i < _len; _i++) { - value = the_values[_i]; - total += value; - } - the_mean = total / the_values.length; - the_mean = the_mean.toFixed(2); - current_mean = parseFloat($("#mean_value").html).toFixed(2); - if (the_mean !== current_mean) { - $("#mean_value").html(the_mean).effect("highlight"); - } - n_of_samples = the_values.length; - current_n_of_samples = $("#n_of_samples_value").html(); - console.log("cnos:", current_n_of_samples); - console.log("n_of_samples:", n_of_samples); - if (n_of_samples !== current_n_of_samples) { - return $("#n_of_samples_value").html(current_n_of_samples).effect("highlight"); + update_stat_values = function(the_values) { + var category, current_mean, current_n_of_samples, id, in_box, n_of_samples, the_mean, total, value, _i, _j, _len, _len1, _ref, _ref1, _results; + _ref = ['primary', 'other', 'all']; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + category = _ref[_i]; + id = "#" + process_id(category, "mean"); + console.log("id:", id); + total = 0; + _ref1 = the_values[category]; + for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { + value = _ref1[_j]; + total += value; + } + the_mean = total / the_values[category].length; + the_mean = the_mean.toFixed(2); + console.log("aaa"); + in_box = $(id).html; + console.log("in_box:", in_box); + current_mean = parseFloat($(in_box)).toFixed(2); + console.log("the_mean:", the_mean); + console.log("current_mean:", current_mean); + console.log("aab"); + if (the_mean !== current_mean) { + console.log("setting mean"); + $(id).html(the_mean).effect("highlight"); + console.log("should be set"); + } + n_of_samples = the_values[category].length; + id = "#" + process_id(category, "n_of_samples"); + console.log("n_of_samples id:", id); + current_n_of_samples = $(id).html(); + console.log("cnos:", current_n_of_samples); + console.log("n_of_samples:", n_of_samples); + if (n_of_samples !== current_n_of_samples) { + _results.push($(id).html(n_of_samples).effect("highlight")); + } else { + _results.push(void 0); + } } + return _results; }; edit_data_change = function() { - var checkbox, checked, real_value, row, the_values, value, values, _i, _len; - the_values = []; - values = $('#primary').find(".edit_strain_value"); + var category, checkbox, checked, real_value, row, the_values, value, values, _i, _len; + the_values = { + primary: [], + other: [], + all: [] + }; + console.log("at beginning:", the_values); + values = $('#value_table').find(".edit_strain_value"); for (_i = 0, _len = values.length; _i < _len; _i++) { value = values[_i]; real_value = $(value).val(); row = $(value).closest("tr"); + console.log("row is:", row); + console.log("row[0].id is:", row[0].id); + category = row[0].id; checkbox = $(row).find(".edit_strain_checkbox"); checked = $(checkbox).attr('checked'); if (!checked) { console.log("Not checked"); continue; } - if (isNumber(real_value) && real_value !== "") { - the_values.push(parseFloat(real_value)); + if (is_number(real_value) && real_value !== "") { + real_value = parseFloat(real_value); + if (_(category).startsWith("Primary")) { + the_values.primary.push(real_value); + } else if (_(category).startsWith("Other")) { + the_values.other.push(real_value); + } + the_values.all.push(real_value); } } - return mean(the_values); + console.log("torwads end:", the_values); + return update_stat_values(the_values); }; make_table = function() { var column, header, row, row_line, rows, table, the_id, the_rows, _i, _j, _k, _len, _len1, _len2, _ref, _ref1; @@ -73,8 +110,9 @@ _ref = basic_table['columns']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { column = _ref[_i]; - the_id = process_id("column_" + column); - header += "<th id=\"" + the_id + "\">" + column + "</th>"; + console.log("column:", column); + the_id = process_id("column", column.t); + header += "<th id=\"" + the_id + "\">" + column.n + "</th>"; } header += "</thead>"; rows = [ @@ -104,9 +142,9 @@ for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) { column = _ref1[_k]; console.log("apple:", column); - the_id = process_id(column + "_" + row.vn); + the_id = process_id(column.t, row.vn); console.log("the_id:", the_id); - row_line += "<td id=\"" + the_id + "\"> </td>"; + row_line += "<td id=\"" + the_id + "\">foo</td>"; } row_line += "</tr>"; console.log("row line:", row_line); @@ -117,17 +155,30 @@ console.log("table is:", table); return $("#stats_table").append(table); }; - process_id = function(value) { + process_id = function() { + var processed, value, values, _i, _len; + values = 1 <= arguments.length ? __slice.call(arguments, 0) : []; /* Make an id or a class valid javascript by, for example, eliminating spaces */ - console.log("value:", value); - value = value.replace(" ", "_"); - return value; + + processed = ""; + for (_i = 0, _len = values.length; _i < _len; _i++) { + value = values[_i]; + console.log("value:", value); + value = value.replace(" ", "_"); + if (processed.length) { + processed += "-"; + } + processed += value; + } + return processed; }; - $('#primary').change(edit_data_change); + _.mixin(_.str.exports()); + $('#value_table').change(edit_data_change); console.log("loaded"); console.log("basic_table is:", basic_table); make_table(); + edit_data_change(); return console.log("end"); }); diff --git a/wqflask/wqflask/static/new/js_external/underscore-min.js b/wqflask/wqflask/static/new/js_external/underscore-min.js new file mode 100644 index 00000000..5a0cb3b0 --- /dev/null +++ b/wqflask/wqflask/static/new/js_external/underscore-min.js @@ -0,0 +1,32 @@ +// Underscore.js 1.3.3 +// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. +// Underscore is freely distributable under the MIT license. +// Portions of Underscore are inspired or borrowed from Prototype, +// Oliver Steele's Functional, and John Resig's Micro-Templating. +// For all details and documentation: +// http://documentcloud.github.com/underscore +(function(){function r(a,c,d){if(a===c)return 0!==a||1/a==1/c;if(null==a||null==c)return a===c;a._chain&&(a=a._wrapped);c._chain&&(c=c._wrapped);if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return!1;switch(e){case "[object String]":return a==""+c;case "[object Number]":return a!=+a?c!=+c:0==a?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source== +c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if("object"!=typeof a||"object"!=typeof c)return!1;for(var f=d.length;f--;)if(d[f]==a)return!0;d.push(a);var f=0,g=!0;if("[object Array]"==e){if(f=a.length,g=f==c.length)for(;f--&&(g=f in a==f in c&&r(a[f],c[f],d)););}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return!1;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&r(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,h)&&!f--)break; +g=!f}}d.pop();return g}var s=this,I=s._,o={},k=Array.prototype,p=Object.prototype,i=k.slice,J=k.unshift,l=p.toString,K=p.hasOwnProperty,y=k.forEach,z=k.map,A=k.reduce,B=k.reduceRight,C=k.filter,D=k.every,E=k.some,q=k.indexOf,F=k.lastIndexOf,p=Array.isArray,L=Object.keys,t=Function.prototype.bind,b=function(a){return new m(a)};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=b),exports._=b):s._=b;b.VERSION="1.3.3";var j=b.each=b.forEach=function(a, +c,d){if(a!=null)if(y&&a.forEach===y)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(e in a&&c.call(d,a[e],e,a)===o)break}else for(e in a)if(b.has(a,e)&&c.call(d,a[e],e,a)===o)break};b.map=b.collect=function(a,c,b){var e=[];if(a==null)return e;if(z&&a.map===z)return a.map(c,b);j(a,function(a,g,h){e[e.length]=c.call(b,a,g,h)});if(a.length===+a.length)e.length=a.length;return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(A&& +a.reduce===A){e&&(c=b.bind(c,e));return f?a.reduce(c,d):a.reduce(c)}j(a,function(a,b,i){if(f)d=c.call(e,d,a,b,i);else{d=a;f=true}});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(B&&a.reduceRight===B){e&&(c=b.bind(c,e));return f?a.reduceRight(c,d):a.reduceRight(c)}var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=function(a, +c,b){var e;G(a,function(a,g,h){if(c.call(b,a,g,h)){e=a;return true}});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(C&&a.filter===C)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(D&&a.every===D)return a.every(c,b);j(a,function(a,g,h){if(!(e=e&&c.call(b, +a,g,h)))return o});return!!e};var G=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(E&&a.some===E)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return o});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;if(q&&a.indexOf===q)return a.indexOf(c)!=-1;return b=G(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck= +function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b<e.computed&& +(e={value:a,computed:b})});return e.value};b.shuffle=function(a){var b=[],d;j(a,function(a,f){d=Math.floor(Math.random()*(f+1));b[f]=b[d];b[d]=a});return b};b.sortBy=function(a,c,d){var e=b.isFunction(c)?c:function(a){return a[c]};return b.pluck(b.map(a,function(a,b,c){return{value:a,criteria:e.call(d,a,b,c)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c===void 0?1:d===void 0?-1:c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]}; +j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,c,d){d||(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){return!a?[]:b.isArray(a)||b.isArguments(a)?i.call(a):a.toArray&&b.isFunction(a.toArray)?a.toArray():b.values(a)};b.size=function(a){return b.isArray(a)?a.length:b.keys(a).length};b.first=b.head=b.take=function(a,b,d){return b!=null&&!d?i.call(a,0,b):a[0]};b.initial=function(a,b,d){return i.call(a, +0,a.length-(b==null||d?1:b))};b.last=function(a,b,d){return b!=null&&!d?i.call(a,Math.max(a.length-b,0)):a[a.length-1]};b.rest=b.tail=function(a,b,d){return i.call(a,b==null||d?1:b)};b.compact=function(a){return b.filter(a,function(a){return!!a})};b.flatten=function(a,c){return b.reduce(a,function(a,e){if(b.isArray(e))return a.concat(c?e:b.flatten(e));a[a.length]=e;return a},[])};b.without=function(a){return b.difference(a,i.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a, +e=[];a.length<3&&(c=true);b.reduce(d,function(d,g,h){if(c?b.last(d)!==g||!d.length:!b.include(d,g)){d.push(g);e.push(a[h])}return d},[]);return e};b.union=function(){return b.uniq(b.flatten(arguments,true))};b.intersection=b.intersect=function(a){var c=i.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1),true);return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a= +i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,c,d){if(a==null)return-1;var e;if(d){d=b.sortedIndex(a,c);return a[d]===c?d:-1}if(q&&a.indexOf===q)return a.indexOf(c);d=0;for(e=a.length;d<e;d++)if(d in a&&a[d]===c)return d;return-1};b.lastIndexOf=function(a,b){if(a==null)return-1;if(F&&a.lastIndexOf===F)return a.lastIndexOf(b);for(var d=a.length;d--;)if(d in a&&a[d]===b)return d;return-1};b.range=function(a,b,d){if(arguments.length<= +1){b=a||0;a=0}for(var d=arguments[2]||1,e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;){g[f++]=a;a=a+d}return g};var H=function(){};b.bind=function(a,c){var d,e;if(a.bind===t&&t)return t.apply(a,i.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=i.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,e.concat(i.call(arguments)));H.prototype=a.prototype;var b=new H,g=a.apply(b,e.concat(i.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c= +i.call(arguments,1);c.length==0&&(c=b.functions(a));j(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,c){var d={};c||(c=b.identity);return function(){var e=c.apply(this,arguments);return b.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,b){var d=i.call(arguments,2);return setTimeout(function(){return a.apply(null,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(i.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,h,i,j=b.debounce(function(){h= +g=false},c);return function(){d=this;e=arguments;f||(f=setTimeout(function(){f=null;h&&a.apply(d,e);j()},c));g?h=true:i=a.apply(d,e);j();g=true;return i}};b.debounce=function(a,b,d){var e;return function(){var f=this,g=arguments;d&&!e&&a.apply(f,g);clearTimeout(e);e=setTimeout(function(){e=null;d||a.apply(f,g)},b)}};b.once=function(a){var b=false,d;return function(){if(b)return d;b=true;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(i.call(arguments,0)); +return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=L||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&& +c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.pick=function(a){var c={};j(b.flatten(i.call(arguments,1)),function(b){b in a&&(c[b]=a[b])});return c};b.defaults=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return r(a,b,[])};b.isEmpty= +function(a){if(a==null)return true;if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=p||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};b.isArguments=function(a){return l.call(a)=="[object Arguments]"};b.isArguments(arguments)||(b.isArguments=function(a){return!(!a||!b.has(a,"callee"))});b.isFunction=function(a){return l.call(a)=="[object Function]"}; +b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isFinite=function(a){return b.isNumber(a)&&isFinite(a)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a, +b){return K.call(a,b)};b.noConflict=function(){s._=I;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.escape=function(a){return(""+a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.result=function(a,c){if(a==null)return null;var d=a[c];return b.isFunction(d)?d.call(a):d};b.mixin=function(a){j(b.functions(a),function(c){M(c,b[c]=a[c])})};var N=0;b.uniqueId= +function(a){var b=N++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var u=/.^/,n={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},v;for(v in n)n[n[v]]=v;var O=/\\|'|\r|\n|\t|\u2028|\u2029/g,P=/\\(\\|'|r|n|t|u2028|u2029)/g,w=function(a){return a.replace(P,function(a,b){return n[b]})};b.template=function(a,c,d){d=b.defaults(d||{},b.templateSettings);a="__p+='"+a.replace(O,function(a){return"\\"+n[a]}).replace(d.escape|| +u,function(a,b){return"'+\n_.escape("+w(b)+")+\n'"}).replace(d.interpolate||u,function(a,b){return"'+\n("+w(b)+")+\n'"}).replace(d.evaluate||u,function(a,b){return"';\n"+w(b)+"\n;__p+='"})+"';\n";d.variable||(a="with(obj||{}){\n"+a+"}\n");var a="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n"+a+"return __p;\n",e=new Function(d.variable||"obj","_",a);if(c)return e(c,b);c=function(a){return e.call(this,a,b)};c.source="function("+(d.variable||"obj")+"){\n"+a+"}";return c}; +b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var x=function(a,c){return c?b(a).chain():a},M=function(a,c){m.prototype[a]=function(){var a=i.call(arguments);J.call(a,this._wrapped);return x(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return x(d, +this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return x(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=true;return this};m.prototype.value=function(){return this._wrapped}}).call(this); diff --git a/wqflask/wqflask/static/new/js_external/underscore.string.min.js b/wqflask/wqflask/static/new/js_external/underscore.string.min.js new file mode 100644 index 00000000..08b986f1 --- /dev/null +++ b/wqflask/wqflask/static/new/js_external/underscore.string.min.js @@ -0,0 +1 @@ +!function(a){"use strict";var b=String.prototype.trim,c=String.prototype.trimRight,d=String.prototype.trimLeft,e=function(a){return a*1||0},f=function(a,b){if(b<1)return"";var c="";while(b>0)b&1&&(c+=a),b>>=1,a+=a;return c},g=[].slice,h=function(a,b,c){return(""+a).replace(b,c)},i=function(a){return a!=null?"["+o.escapeRegExp(a)+"]":"\\s"},j=function(a,b){a+="",b+="";var c=[],d,e;for(var f=0;f<=b.length;f++)for(var g=0;g<=a.length;g++)f&&g?a.charAt(g-1)===b.charAt(f-1)?e=d:e=Math.min(c[g],c[g-1],d)+1:e=f+g,d=c[g],c[g]=e;return c.pop()},k={lt:"<",gt:">",quot:'"',apos:"'",amp:"&"},l={};for(var m in k)l[k[m]]=m;var n=function(){function a(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}var b=f,c=function(){return c.cache.hasOwnProperty(arguments[0])||(c.cache[arguments[0]]=c.parse(arguments[0])),c.format.call(null,c.cache[arguments[0]],arguments)};return c.format=function(c,d){var e=1,f=c.length,g="",h,i=[],j,k,l,m,o,p;for(j=0;j<f;j++){g=a(c[j]);if(g==="string")i.push(c[j]);else if(g==="array"){l=c[j];if(l[2]){h=d[e];for(k=0;k<l[2].length;k++){if(!h.hasOwnProperty(l[2][k]))throw new Error(n('[_.sprintf] property "%s" does not exist',l[2][k]));h=h[l[2][k]]}}else l[1]?h=d[l[1]]:h=d[e++];if(/[^s]/.test(l[8])&&a(h)!="number")throw new Error(n("[_.sprintf] expecting number but found %s",a(h)));switch(l[8]){case"b":h=h.toString(2);break;case"c":h=String.fromCharCode(h);break;case"d":h=parseInt(h,10);break;case"e":h=l[7]?h.toExponential(l[7]):h.toExponential();break;case"f":h=l[7]?parseFloat(h).toFixed(l[7]):parseFloat(h);break;case"o":h=h.toString(8);break;case"s":h=(h=String(h))&&l[7]?h.substring(0,l[7]):h;break;case"u":h=Math.abs(h);break;case"x":h=h.toString(16);break;case"X":h=h.toString(16).toUpperCase()}h=/[def]/.test(l[8])&&l[3]&&h>=0?"+"+h:h,o=l[4]?l[4]=="0"?"0":l[4].charAt(1):" ",p=l[6]-String(h).length,m=l[6]?b(o,p):"",i.push(l[5]?h+m:m+h)}}return i.join("")},c.cache={},c.parse=function(a){var b=a,c=[],d=[],e=0;while(b){if((c=/^[^\x25]+/.exec(b))!==null)d.push(c[0]);else if((c=/^\x25{2}/.exec(b))!==null)d.push("%");else{if((c=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(b))===null)throw new Error("[_.sprintf] huh?");if(c[2]){e|=1;var f=[],g=c[2],h=[];if((h=/^([a-z_][a-z_\d]*)/i.exec(g))===null)throw new Error("[_.sprintf] huh?");f.push(h[1]);while((g=g.substring(h[0].length))!=="")if((h=/^\.([a-z_][a-z_\d]*)/i.exec(g))!==null)f.push(h[1]);else{if((h=/^\[(\d+)\]/.exec(g))===null)throw new Error("[_.sprintf] huh?");f.push(h[1])}c[2]=f}else e|=2;if(e===3)throw new Error("[_.sprintf] mixing positional and named placeholders is not (yet) supported");d.push(c)}b=b.substring(c[0].length)}return d},c}(),o={VERSION:"2.2.0rc",isBlank:function(a){return/^\s*$/.test(a)},stripTags:function(a){return h(a,/<\/?[^>]+>/g,"")},capitalize:function(a){return a+="",a.charAt(0).toUpperCase()+a.slice(1)},chop:function(a,b){return a+="",b=~~b,b>0?a.match(new RegExp(".{1,"+b+"}","g")):[a]},clean:function(a){return o.strip(a).replace(/\s+/g," ")},count:function(a,b){return a+="",b+="",a.split(b).length-1},chars:function(a){return(""+a).split("")},swapCase:function(a){return h(a,/\S/g,function(a){return a===a.toUpperCase()?a.toLowerCase():a.toUpperCase()})},escapeHTML:function(a){return h(a,/[&<>"']/g,function(a){return"&"+l[a]+";"})},unescapeHTML:function(a){return h(a,/\&([^;]+);/g,function(a,b){var c;return b in k?k[b]:(c=b.match(/^#x([\da-fA-F]+)$/))?String.fromCharCode(parseInt(c[1],16)):(c=b.match(/^#(\d+)$/))?String.fromCharCode(~~c[1]):a})},escapeRegExp:function(a){return h(a,/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")},insert:function(a,b,c){var d=o.chars(a);return d.splice(~~b,0,""+c),d.join("")},include:function(a,b){return!!~(""+a).indexOf(b)},join:function(){var a=g.call(arguments);return a.join(a.shift())},lines:function(a){return(""+a).split("\n")},reverse:function(a){return o.chars(a).reverse().join("")},splice:function(a,b,c,d){var e=o.chars(a);return e.splice(~~b,~~c,d),e.join("")},startsWith:function(a,b){return a+="",b+="",a.length>=b.length&&a.slice(0,b.length)===b},endsWith:function(a,b){return a+="",b+="",a.length>=b.length&&a.slice(a.length-b.length)===b},succ:function(a){a+="";var b=o.chars(a);return b.splice(a.length-1,1,String.fromCharCode(a.charCodeAt(a.length-1)+1)),b.join("")},titleize:function(a){return h(a,/(?:^|\s)\S/g,function(a){return a.toUpperCase()})},camelize:function(a){return o.trim(a).replace(/[-_\s]+(.)?/g,function(a,b){return b.toUpperCase()})},underscored:function(a){return o.trim(a).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()},dasherize:function(a){return o.trim(a).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()},classify:function(a){return o.titleize(h(a,/_/g," ")).replace(/\s/g,"")},humanize:function(a){return o.capitalize(o.underscored(a).replace(/_id$/,"").replace(/_/g," "))},trim:function(a,c){return a+="",!c&&b?b.call(a):(c=i(c),a.replace(new RegExp("^"+c+"+|"+c+"+$","g"),""))},ltrim:function(a,b){return a+="",!b&&d?d.call(a):(b=i(b),a.replace(new RegExp("^"+b+"+"),""))},rtrim:function(a,b){return a+="",!b&&c?c.call(a):(b=i(b),a.replace(new RegExp(b+"+$"),""))},truncate:function(a,b,c){return a+="",c=c||"...",b=~~b,a.length>b?a.slice(0,b)+c:a},prune:function(a,b,c){a+="",b=~~b,c=c!=null?""+c:"...";var d,e,f=a.replace(/\W/g,function(a){return a.toUpperCase()!==a.toLowerCase()?"A":" "});return e=f.charAt(b),d=f.slice(0,b),e&&e.match(/\S/)&&(d=d.replace(/\s\S+$/,"")),d=o.rtrim(d),(d+c).length>a.length?a:a.slice(0,d.length)+c},words:function(a,b){return o.trim(a,b).split(b||/\s+/)},pad:function(a,b,c,d){a+="";var e=0;b=~~b,c?c.length>1&&(c=c.charAt(0)):c=" ";switch(d){case"right":return e=b-a.length,a+f(c,e);case"both":return e=b-a.length,f(c,Math.ceil(e/2))+a+f(c,Math.floor(e/2));default:return e=b-a.length,f(c,e)+a}},lpad:function(a,b,c){return o.pad(a,b,c)},rpad:function(a,b,c){return o.pad(a,b,c,"right")},lrpad:function(a,b,c){return o.pad(a,b,c,"both")},sprintf:n,vsprintf:function(a,b){return b.unshift(a),n.apply(null,b)},toNumber:function(a,b){a+="";var c=e(e(a).toFixed(~~b));return c===0&&!a.match(/^0+$/)?Number.NaN:c},strRight:function(a,b){a+="",b=b!=null?""+b:b;var c=b?a.indexOf(b):-1;return~c?a.slice(c+b.length,a.length):a},strRightBack:function(a,b){a+="",b=b!=null?""+b:b;var c=b?a.lastIndexOf(b):-1;return~c?a.slice(c+b.length,a.length):a},strLeft:function(a,b){a+="",b=b!=null?""+b:b;var c=b?a.indexOf(b):-1;return~c?a.slice(0,c):a},strLeftBack:function(a,b){a+="",b=b!=null?""+b:b;var c=a.lastIndexOf(b);return~c?a.slice(0,c):a},toSentence:function(a,b,c){b||(b=", "),c||(c=" and ");var d=a.length,e="";for(var f=0;f<d;f++)e+=a[f],f===d-2?e+=c:f<d-1&&(e+=b);return e},slugify:function(a){var b="ąàáäâãćęèéëêìíïîłńòóöôõùúüûñçżź",c="aaaaaaceeeeeiiiilnooooouuuunczz",d=new RegExp(i(b),"g");return a=(""+a).toLowerCase(),a=a.replace(d,function(a){var d=b.indexOf(a);return c.charAt(d)||"-"}),o.dasherize(a.replace(/[^\w\s-]/g,""))},surround:function(a,b){return[b,a,b].join("")},quote:function(a){return o.surround(a,'"')},exports:function(){var a={};for(var b in this){if(!this.hasOwnProperty(b)||b.match(/^(?:include|contains|reverse)$/))continue;a[b]=this[b]}return a},repeat:function(a,b,c){b=~~b;if(c==null)return f(a+"",b);for(var d=[];b>0;d[--b]=a);return d.join(c)},levenshtein:j};o.strip=o.trim,o.lstrip=o.ltrim,o.rstrip=o.rtrim,o.center=o.lrpad,o.rjust=o.lpad,o.ljust=o.rpad,o.contains=o.include,o.q=o.quote,typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(module.exports=o),exports._s=o):typeof define=="function"&&define.amd?define("underscore.string",[],function(){return o}):(a._=a._||{},a._.string=a._.str=o)}(this);
\ No newline at end of file diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index 4050164d..7d9218ed 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -112,7 +112,7 @@ <Strong>Help</Strong></Span> | <Span Id= "menu_grp4" onmouseover="A_MENUS[0].onmouseover(grpObj['menu_grp4'])" onmouseout="A_MENUS[0].onmouseout(grpObj['menu_grp4'])" style="font-size:12px;font-family:verdana;color:#0000ae"> - <A Href="/whats_new.html" style="font-size:12px;font-family:verdana;color:#0000ae"> + <A Href="/whats_new" style="font-size:12px;font-family:verdana;color:#0000ae"> <Strong>News</Strong></A></Span> | <Span Id= "menu_grp5" onmouseover="A_MENUS[0].onmouseover(grpObj['menu_grp5'])" onmouseout="A_MENUS[0].onmouseout(grpObj['menu_grp5'])" style="font-size:12px;font-family:verdana;color:#0000ae"> diff --git a/wqflask/wqflask/templates/trait_data_and_analysis.html b/wqflask/wqflask/templates/trait_data_and_analysis.html index 47d0827b..c951156a 100644 --- a/wqflask/wqflask/templates/trait_data_and_analysis.html +++ b/wqflask/wqflask/templates/trait_data_and_analysis.html @@ -3018,7 +3018,7 @@ <p id="sectionbody5"></p> - <table class="target5" cellpadding="0" cellspacing="0" width="100%"> + <table class="target5" id="value_table" cellpadding="0" cellspacing="0" width="100%"> <tr> <td> <div> @@ -3118,7 +3118,8 @@ basic_table = {{ basic_table | safe }} </script> - <script type="text/javascript" src="/static/new/packages/DataTables/js/jquery.dataTables.min.js"></script> + <script type="text/javascript" src="/static/new/js_external/underscore-min.js"></script>--> + <script type="text/javascript" src="/static/new/js_external/underscore.string.min.js"></script> <script type="text/javascript" src="/static/new/javascript/trait_data_and_analysis.js"></script> diff --git a/wqflask/wqflask/templates/whats_new.html b/wqflask/wqflask/templates/whats_new.html new file mode 100644 index 00000000..dca9e7b3 --- /dev/null +++ b/wqflask/wqflask/templates/whats_new.html @@ -0,0 +1,29 @@ +{% extends "base.html" %} +{% block title %}GeneNetwork{% endblock %} +{% block content %} +<!-- Start of body --> + + <TR> + <TD bgColor=#eeeeee class="solidBorder"> + <Table width= "100%" cellSpacing=0 cellPadding=5><TR> + <!-- Body Start from Here --> + <TD valign="top" height="200" width="100%" bgcolor="#eeeeee"> + + <P class="title">Latest Updates and News from Genenetwork <A HREF="/webqtl/main.py?FormID=editHtml"><img src="/images/modify.gif" alt="modify this page" border= 0 valign="middle"></A></P> + + + {% for news_item in news_items %} + <h4>{{ news_item.title }} ({{ news_item.date }})</h4> + {{ news_item.details | safe }} + <br /><br /> + {% endfor %} + + <p /> + + </TD> + </TR> + + + +<!-- End of body --> +{% endblock %} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 852e6a16..1ed3c1fd 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -15,6 +15,8 @@ from base import webqtlFormData from pprint import pformat as pf +import yaml + print("latest blue") @app.route("/") @@ -53,7 +55,16 @@ def search(): return render_template("search_result_page.html", **the_search.__dict__) - +@app.route("/whats_new") +def whats_new(): + #variables = whats_new.whats_new() + with open("/home/sam/gene/wqflask/wqflask/yaml_data/whats_new.yaml") as fh: + contents = fh.read() + yamilized = yaml.safe_load(contents) + news_items = yamilized['news'] + for news_item in news_items: + print("\nnews_item is: %s\n" % (news_item)) + return render_template("whats_new.html", news_items=news_items) @app.route("/showDatabaseBXD") def showDatabaseBXD(): diff --git a/wqflask/wqflask/yaml_data/whats_new.yaml b/wqflask/wqflask/yaml_data/whats_new.yaml new file mode 100644 index 00000000..8f41a8f2 --- /dev/null +++ b/wqflask/wqflask/yaml_data/whats_new.yaml @@ -0,0 +1,26 @@ +news: +- + date: 2012-1-20 + title: Mouse SNPs from dbSNP have been added to GeneNetwork + details: + 10 million mouse SNPs from dbSNP (build 128) have been added to Variant Browser. + They could be searched by name (e.g. rs31192936) (Implemented by Xiaodong Zhou and Ning Liu). + +- + date: 2012-1-20 + title: Literature correlation has been update to 2011 version + details: + Dr. Ramin Homayouni and Dr. Lijing Xu kindly provide the 2011 version of mouse gene-gene + literature correlation matrix to GeneNetwork. (Implemented by Xiaodong Zhou). + +- + date: 2012-1-16 + title: Expression data set for EPFL/LISP BXD Muscle Affy Mouse Gene 1.0 ST (Dec11) RMA ** has been entered in GeneNetwork + details: + Laboratory of Integrative and Systems Physiology + (<a href="http://auwerx-lab.epfl.ch/">LISP</a>). + This data set is not yet freely available for global analysis. + This data set has not yet been used or described in any publication. + Please contact Johan Auwerx or Evan Williams at evan.williams@epfl.ch + regarding use of these data. (Implemented by J Auwerx, E Williams, LA Rose, + RW Williams and A Centeno).
\ No newline at end of file |