aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/webqtlCaseData.py
diff options
context:
space:
mode:
authorzsloan2020-09-18 14:40:41 -0500
committerzsloan2020-09-18 14:40:41 -0500
commitf376eaca55643972943fc6d313a3ca00b32d66ae (patch)
tree557a7834a314651938153346cdbf4346ac4256f4 /wqflask/base/webqtlCaseData.py
parent870ddf6075f38c1ce5e7bf8f90742f06fe7d4805 (diff)
downloadgenenetwork2-f376eaca55643972943fc6d313a3ca00b32d66ae.tar.gz
Made a bunch of changes to move trait page DataTables initialization to
a separate file (initialize_show_trait_tables.js). The biggest complication was getting the order of attributes in the rows to sync with the order of atribute namees in the column headers. Previously this logic was all in the template. * wqflask/base/webqtlCaseData.py - added attribute first_attr_col as a very awkward solution to passing the column position into the column render function in situations where there are case attribute columns (which can be variable in number) * wqflask/wqflask/show_trait/show_trait.py - Replace "attribute_names" in js_data with "attributes" (which allows the JS access to more information) and also pass new se_exists and has_num_cases variables with js_data, so the javascript has access to whether or not those columns exist in the table * wqflask/wqflask/static/new/javascript/show_trait.js - Change case attribute-related logic to use js_data.attributes instead of js_data.attribute_names * wqflask/wqflask/templates/show_trait.html - Removed table initialization from template * wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js - new file that initializes tables and reproduces what the template logic used to do with JS logic
Diffstat (limited to 'wqflask/base/webqtlCaseData.py')
-rw-r--r--wqflask/base/webqtlCaseData.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/wqflask/base/webqtlCaseData.py b/wqflask/base/webqtlCaseData.py
index 2844cedd..3cf2d80d 100644
--- a/wqflask/base/webqtlCaseData.py
+++ b/wqflask/base/webqtlCaseData.py
@@ -41,6 +41,8 @@ class webqtlCaseData:
self.this_id = None # Set a sane default (can't be just "id" cause that's a reserved word)
self.outlier = None # Not set to True/False until later
+ self.first_attr_col = self.get_first_attr_col()
+
def __repr__(self):
case_data_string = "<webqtlCaseData> "
if self.value is not None:
@@ -79,3 +81,12 @@ class webqtlCaseData:
if self.num_cases is not None:
return "%s" % self.num_cases
return "x"
+
+ def get_first_attr_col(self):
+ col_num = 4
+ if self.variance is not None:
+ col_num += 2
+ if self.num_cases is not None:
+ col_num += 1
+
+ return col_num \ No newline at end of file