From ab133cc37015ea469f4d41155b58f0435d9001f3 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 3 Jun 2016 16:59:25 +0000 Subject: Changed appearance of tables to more easily differentiate them from the rest of the page (still not totally pleased with them though) Fixed issue where some N/A lrs scores and additive effects were being changed to 0's, which was misleading and kept them from always being sorted at the bottom. They now appear as N/A. --- wqflask/base/trait.py | 15 +++--- .../DataTables/js/dataTables.naturalSort.js | 8 ++-- wqflask/wqflask/templates/base.html | 2 +- wqflask/wqflask/templates/collections/view.html | 20 ++++---- wqflask/wqflask/templates/gsearch_gene.html | 53 +++++++++++++++------- wqflask/wqflask/templates/gsearch_pheno.html | 43 ++++++++++++------ wqflask/wqflask/templates/search_result_page.html | 27 ++++++++--- 7 files changed, 109 insertions(+), 59 deletions(-) diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 0c962331..a71d8157 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -444,9 +444,9 @@ class GeneralTrait(object): self.locus_chr = result[0] self.locus_mb = result[1] else: - self.locus = self.locus_chr = self.locus_mb = "" + self.locus = self.locus_chr = self.locus_mb = self.additive = "" else: - self.locus = self.locus_chr = self.locus_mb = "" + self.locus = self.locus_chr = self.locus_mb = self.additive = "" else: self.locus = self.locus_chr = self.locus_mb = self.lrs = self.pvalue = self.mean = self.additive = "" @@ -476,9 +476,9 @@ class GeneralTrait(object): self.locus_chr = result[0] self.locus_mb = result[1] else: - self.locus = self.locus_chr = self.locus_mb = "" + self.locus = self.locus_chr = self.locus_mb = self.additive = "" else: - self.locus = self.locus_chr = self.locus_mb = "" + self.locus = self.locus_chr = self.locus_mb = self.additive = "" else: self.locus = self.lrs = self.additive = "" @@ -492,9 +492,10 @@ class GeneralTrait(object): else: LRS_location_value = ord(str(self.locus_chr).upper()[0])*1000 + float(self.locus_mb) - self.LRS_location_repr = LRS_location_repr = 'Chr%s: %.6f' % (self.locus_chr, float(self.locus_mb)) - self.LRS_score_repr = LRS_score_repr = '%3.1f' % self.lrs - self.LRS_score_value = LRS_score_value = self.lrs + self.LRS_location_repr = LRS_location_repr = 'Chr%s: %.6f' % (self.locus_chr, float(self.locus_mb)) + if self.lrs != "": + self.LRS_score_repr = LRS_score_repr = '%3.1f' % self.lrs + self.LRS_score_value = LRS_score_value = self.lrs else: raise KeyError, `self.name`+' information is not found in the database.' diff --git a/wqflask/wqflask/static/new/packages/DataTables/js/dataTables.naturalSort.js b/wqflask/wqflask/static/new/packages/DataTables/js/dataTables.naturalSort.js index 0198fd48..dbb40446 100755 --- a/wqflask/wqflask/static/new/packages/DataTables/js/dataTables.naturalSort.js +++ b/wqflask/wqflask/static/new/packages/DataTables/js/dataTables.naturalSort.js @@ -49,16 +49,16 @@ function naturalSort (a, b) { jQuery.extend( jQuery.fn.dataTableExt.oSort, { "natural-asc": function ( a, b ) { // first check if null or n/a - if (a == "N/A" || a == "NA") return 1; - else if (b == "N/A" || b == "NA") return -1; + if (a == "N/A" || a == "NA" || a == "") return 1; + else if (b == "N/A" || b == "NA" || b == "") return -1; else { return naturalSort(a,b); } }, "natural-desc": function ( a, b ) { - if (a == "N/A" || a == "NA") return 1; - else if (b == "N/A" || b == "NA") return -1; + if (a == "N/A" || a == "NA" || a == "") return 1; + else if (b == "N/A" || b == "NA" || b == "") return -1; else { return naturalSort(a,b) * -1; } diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index b4fdbd8e..759c4a8d 100755 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -19,7 +19,7 @@ -
+ diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index ff4254aa..70cafcfe 100755 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -23,24 +23,24 @@- | Index | -Species | -Group | -Tissue | -Dataset | -Record | -Symbol | -Description | -Location | -Mean | -Max LRS ? |
- Max LRS Location | -Additive Effect ? |
+ + | Index | +Species | +Group | +Tissue | +Dataset | +Record | +Symbol | +Description | +Location | +Mean | +Max LRS ? |
+ Max LRS Location | +Additive Effect ? |
{{ this_trait.description_display }} | {{ this_trait.location_repr }} | {{ '%0.3f' % this_trait.mean|float }} | -{{ '%0.1f' % this_trait.LRS_score_repr|float }} | +{% if this_trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % this_trait.LRS_score_repr|float }}{% else %}N/A{% endif %} | {{ this_trait.LRS_location_repr }} | -{{ '%0.3f' % this_trait.additive|float }} | +{% if this_trait.additive != "" %}{{ '%0.3f' % this_trait.additive|float }}{% else %}N/A{% endif %} | {% endfor %} + + +
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ | Index | +Species | +Group | +Tissue | +Dataset | +Record | +Symbol | +Description | +Location | +Mean | +Max LRS ? |
+ Max LRS Location | +Additive Effect ? |
+
- | Index | -Species | -Group | -Record | -Description | -Authors | -Year | -Max LRS ? |
- Max LRS Location | -Additive Effect ? |
+ + | Index | +Species | +Group | +Record | +Description | +Authors | +Year | +Max LRS ? |
+ Max LRS Location | +Additive Effect ? |
{{ this_trait.description_display }} | {{ this_trait.authors }} | {{ this_trait.pubmed_text }} | -{{ '%0.1f' % this_trait.LRS_score_repr|float }} | +{% if this_trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % this_trait.LRS_score_repr|float }}{% else %}N/A{% endif %} | {{ this_trait.LRS_location_repr }} | -{{ '%0.3f' % this_trait.additive|float }} | +{% if this_trait.additive != "" %}{{ this_trait.additive }}{% else %}N/A{% endif %} | {% endfor %} + +
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ | Index | +Species | +Group | +Record | +Description | +Authors | +Year | +Max LRS ? |
+ Max LRS Location | +Additive Effect ? |
+
+ | {% for header in header_fields %} {% if header == 'Max LRS' %} - | Max LRS |
+ Max LRS |
{% elif header == 'Additive Effect' %}
- Additive Effect ? |
+ Additive Effect ? |
{% else %}
- {{header}} | +{{header}} | {% endif %} {% endfor %}
---|---|---|---|---|---|---|---|
+ {% for header in header_fields %} + {% if header == 'Max LRS' %} + | Max LRS |
+ {% elif header == 'Additive Effect' %}
+ Additive Effect ? |
+ {% else %}
+ {{header}} | + {% endif %} + {% endfor %} +