aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Sloan2012-10-02 14:52:40 -0500
committerZachary Sloan2012-10-02 14:52:40 -0500
commite5ba48c06a76ac1d4d4725cf633de1cf3abfde2d (patch)
treee8d109e1d75136b0bafe16cd5ec527597d1ab8e3
parent8bd404246b83f46f34c9b162c39c2dfc6ab39049 (diff)
downloadgenenetwork2-e5ba48c06a76ac1d4d4725cf633de1cf3abfde2d.tar.gz
Renamed trait_data_and_analysis.html to show_trait.html, DataEditingPage.py to show_trait.py, and trait_data_and_analysis.coffee to show_trait.coffee
-rwxr-xr-xweb/webqtl/collection/ExportSelectionDetailInfoPage.py5
-rwxr-xr-xwqflask/wqflask/show_trait/show_trait.py (renamed from wqflask/wqflask/show_trait/DataEditingPage.py)2
-rw-r--r--wqflask/wqflask/static/new/javascript/show_trait.coffee (renamed from wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee)0
-rw-r--r--wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js207
-rw-r--r--wqflask/wqflask/templates/show_trait.html (renamed from wqflask/wqflask/templates/trait_data_and_analysis.html)0
-rw-r--r--wqflask/wqflask/views.py2
6 files changed, 6 insertions, 210 deletions
diff --git a/web/webqtl/collection/ExportSelectionDetailInfoPage.py b/web/webqtl/collection/ExportSelectionDetailInfoPage.py
index 69f293b2..a61b6f6e 100755
--- a/web/webqtl/collection/ExportSelectionDetailInfoPage.py
+++ b/web/webqtl/collection/ExportSelectionDetailInfoPage.py
@@ -128,7 +128,10 @@ class ExportSelectionDetailInfoPage(templatePage):
count = count + 1
except:
pass
- mean = sum/count
+ if count = 0:
+ mean = 0
+ else:
+ mean = sum/count
text[-1].append(mean)
text[-1] += testval
if len(text[0]) < 255 or len(text) < 255:
diff --git a/wqflask/wqflask/show_trait/DataEditingPage.py b/wqflask/wqflask/show_trait/show_trait.py
index 12e816f8..743e4ad6 100755
--- a/wqflask/wqflask/show_trait/DataEditingPage.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -29,7 +29,7 @@ from pprint import pformat as pf
-class DataEditingPage(templatePage):
+class ShowTrait(templatePage):
def __init__(self, fd):
self.fd = fd
diff --git a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee b/wqflask/wqflask/static/new/javascript/show_trait.coffee
index 803045d5..803045d5 100644
--- a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee
+++ b/wqflask/wqflask/static/new/javascript/show_trait.coffee
diff --git a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js
deleted file mode 100644
index 55bc1302..00000000
--- a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js
+++ /dev/null
@@ -1,207 +0,0 @@
-// Generated by CoffeeScript 1.3.3
-(function() {
- var is_number,
- __slice = [].slice;
-
- console.log("start_b");
-
- is_number = function(o) {
- return !isNaN((o - 0) && o !== null);
- };
-
- $(function() {
- var change_stats_value, edit_data_change, hide_tabs, make_table, on_corr_method_change, process_id, show_hide_outliers, stats_mdp_change, update_stat_values;
- hide_tabs = function(start) {
- var x, _i, _results;
- _results = [];
- for (x = _i = start; start <= 10 ? _i <= 10 : _i >= 10; x = start <= 10 ? ++_i : --_i) {
- _results.push($("#stats_tabs" + x).hide());
- }
- return _results;
- };
- hide_tabs(1);
- stats_mdp_change = function() {
- var selected;
- selected = $(this).val();
- hide_tabs(0);
- return $("#stats_tabs" + selected).show();
- };
- $(".stats_mdp").change(stats_mdp_change);
- change_stats_value = function(sample_sets, category, value_type, decimal_places) {
- var current_value, id, in_box, the_value;
- id = "#" + process_id(category, value_type);
- console.log("the_id:", id);
- in_box = $(id).html;
- current_value = parseFloat($(in_box)).toFixed(decimal_places);
- the_value = sample_sets[category][value_type]();
- if (decimal_places > 0) {
- the_value = the_value.toFixed(decimal_places);
- }
- if (the_value !== current_value) {
- return $(id).html(the_value).effect("highlight");
- }
- };
- update_stat_values = function(sample_sets) {
- var category, stat, _i, _len, _ref, _results;
- _ref = ['primary_only', 'other_only', 'all_cases'];
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- category = _ref[_i];
- change_stats_value(sample_sets, category, "n_of_samples", 0);
- _results.push((function() {
- var _j, _len1, _ref1, _results1;
- _ref1 = ["mean", "median", "std_dev", "std_error"];
- _results1 = [];
- for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
- stat = _ref1[_j];
- _results1.push(change_stats_value(sample_sets, category, stat, 2));
- }
- return _results1;
- })());
- }
- return _results;
- };
- edit_data_change = function() {
- var category, checkbox, checked, real_value, row, sample_sets, value, values, _i, _len;
- sample_sets = {
- primary_only: new Stats([]),
- other_only: new Stats([]),
- all_cases: new Stats([])
- };
- console.log("at beginning:", sample_sets);
- values = $('#value_table').find(".edit_sample_value");
- for (_i = 0, _len = values.length; _i < _len; _i++) {
- value = values[_i];
- real_value = $(value).val();
- row = $(value).closest("tr");
- category = row[0].id;
- checkbox = $(row).find(".edit_sample_checkbox");
- checked = $(checkbox).attr('checked');
- if (checked && is_number(real_value) && real_value !== "") {
- real_value = parseFloat(real_value);
- if (_(category).startsWith("Primary")) {
- sample_sets.primary_only.add_value(real_value);
- } else if (_(category).startsWith("Other")) {
- sample_sets.other_only.add_value(real_value);
- }
- sample_sets.all_cases.add_value(real_value);
- }
- }
- console.log("towards end:", sample_sets);
- return update_stat_values(sample_sets);
- };
- make_table = function() {
- var header, key, row, row_line, rows, table, the_id, the_rows, value, _i, _len, _ref, _ref1;
- header = "<thead><tr><th>&nbsp;</th>";
- console.log("js_data.sample_groups:", js_data.sample_groups);
- _ref = js_data.sample_groups;
- for (key in _ref) {
- value = _ref[key];
- console.log("aa key:", key);
- console.log("aa value:", value);
- the_id = process_id("column", key);
- header += "<th id=\"" + the_id + "\">" + value + "</th>";
- }
- header += "</thead>";
- console.log("windex header is:", header);
- rows = [
- {
- vn: "n_of_samples",
- pretty: "N of Samples"
- }, {
- vn: "mean",
- pretty: "Mean"
- }, {
- vn: "median",
- pretty: "Median"
- }, {
- vn: "std_error",
- pretty: "Standard Error (SE)"
- }, {
- vn: "std_dev",
- pretty: "Standard Deviation (SD)"
- }
- ];
- console.log("rows are:", rows);
- the_rows = "<tbody>";
- console.log("length of rows:", rows.length);
- for (_i = 0, _len = rows.length; _i < _len; _i++) {
- row = rows[_i];
- console.log("rowing");
- row_line = "<tr>";
- row_line += "<td id=\"" + row.vn + "\">" + row.pretty + "</td>";
- console.log("box - js_data.sample_groups:", js_data.sample_groups);
- _ref1 = js_data.sample_groups;
- for (key in _ref1) {
- value = _ref1[key];
- console.log("apple key:", key);
- the_id = process_id(key, row.vn);
- console.log("the_id:", the_id);
- row_line += "<td id=\"" + the_id + "\">foo</td>";
- }
- row_line += "</tr>";
- console.log("row line:", row_line);
- the_rows += row_line;
- }
- the_rows += "</tbody>";
- table = header + the_rows;
- console.log("table is:", table);
- return $("#stats_table").append(table);
- };
- 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
- */
-
- 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;
- };
- show_hide_outliers = function() {
- var label;
- console.log("FOOBAR in beginning of show_hide_outliers");
- label = $('#show_hide_outliers').val();
- console.log("lable is:", label);
- if (label === "Hide Outliers") {
- return $('#show_hide_outliers').val("Show Outliers");
- } else if (label === "Show Outliers") {
- console.log("Found Show Outliers");
- $('#show_hide_outliers').val("Hide Outliers");
- return console.log("Should be now Hide Outliers");
- }
- };
- on_corr_method_change = function() {
- var corr_method;
- console.log("in beginning of on_corr_method_change");
- corr_method = $('select[name=corr_method]').val();
- console.log("corr_method is:", corr_method);
- $('.correlation_desc').hide();
- $('#' + corr_method + "_r_desc").show().effect("highlight");
- if (corr_method === "lit") {
- return $("#corr_sample_method_options").hide();
- } else {
- return $("#corr_sample_method_options").show();
- }
- };
- $('select[name=corr_method]').change(on_corr_method_change);
- console.log("before registering show_hide_outliers");
- $('#show_hide_outliers').click(show_hide_outliers);
- console.log("after registering show_hide_outliers");
- _.mixin(_.str.exports());
- $('#value_table').change(edit_data_change);
- console.log("loaded");
- make_table();
- edit_data_change();
- return console.log("end");
- });
-
-}).call(this);
diff --git a/wqflask/wqflask/templates/trait_data_and_analysis.html b/wqflask/wqflask/templates/show_trait.html
index 7d0e671f..7d0e671f 100644
--- a/wqflask/wqflask/templates/trait_data_and_analysis.html
+++ b/wqflask/wqflask/templates/show_trait.html
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index bc80a1e6..4da1082f 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -76,7 +76,7 @@ def show_trait():
# Here it's currently too complicated not to use an fd that is a webqtlFormData
fd = webqtlFormData.webqtlFormData(request.args)
#template_vars = show_trait_page.ShowTraitPage(fd)
- template_vars = DataEditingPage.DataEditingPage(fd)
+ template_vars = show_trait.show_trait(fd)
template_vars.js_data = json.dumps(template_vars.js_data)
print("show_trait template_vars:", pf(template_vars.__dict__))