about summary refs log tree commit diff
diff options
context:
space:
mode:
authorzsloan2020-11-10 14:15:43 -0600
committerzsloan2020-11-10 14:15:43 -0600
commit4f9a389795d3ecade1a988347c834103f258e6dc (patch)
tree23b812f6a7d0193ff474f09055423868e0140267
parentb695ea7f5ee11c80c9b1c547fedd1216b459acd4 (diff)
downloadgenenetwork2-4f9a389795d3ecade1a988347c834103f258e6dc.tar.gz
* wqflask/wqflask/correlation/show_corr_results.py - Changed some of the parameters sent to the correlation table
* wqflask/wqflask/templates_correlation_page.html - Fixed some column defs and removed unused table configuration code
-rw-r--r--wqflask/wqflask/correlation/show_corr_results.py22
-rw-r--r--wqflask/wqflask/templates/correlation_page.html120
2 files changed, 26 insertions, 116 deletions
diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py
index ebfea8fe..07b45860 100644
--- a/wqflask/wqflask/correlation/show_corr_results.py
+++ b/wqflask/wqflask/correlation/show_corr_results.py
@@ -522,19 +522,19 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap
                 results_dict['tissue_corr'] = "%0.3f" % float(trait.tissue_corr)
                 results_dict['tissue_pvalue'] = "%0.3e" % float(trait.tissue_pvalue)
         elif target_dataset.type == "Publish":
-            results_dict['abbreviation'] = trait.abbreviation
-            if len(trait.abbreviation) > 20:
+            results_dict['abbreviation'] = "N/A"
+            if trait.abbreviation and len(trait.abbreviation) > 20:
                 results_dict['abbreviation_display'] = trait.abbreviation[:20] + "..."
             else:
                 results_dict['abbreviation_display'] = trait.abbreviation
-            if len(trait.description_display) > 40:
-                results_dict['description'] = trait.description_display[:40] + "..."
-            else:
-                results_dict['description'] = trait.description_display
+            # if len(trait.description_display) > 40:
+            #     results_dict['description'] = trait.description_display[:40] + "..."
+            # else:
+            results_dict['description'] = trait.description_display
             results_dict['authors'] = trait.authors
             authors_list = trait.authors.split(',')
-            if len(authors_list > 6):
-                results_dict['authors_display'] = authors_list[:6].join(", ") + ", et al."
+            if len(authors_list) > 6:
+                results_dict['authors_display'] = ", ".join(authors_list[:6]) + ", et al."
             else:
                 results_dict['authors_display'] = trait.authors
             if trait.pubmed_id:
@@ -542,13 +542,15 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap
                     results_dict['pubmed_id'] = trait.pubmed_id
                     results_dict['year'] = trait.pubmed_text
                 else:
-                    results_dict['pubmed'] = "<a href='" + trait.pubmed_link + "'> " + trait.pubmed_text + "</a>"
+                    results_dict['pubmed_link'] = trait.pubmed_link
+                    results_dict['pubmed_text'] = trait.pubmed_text
             else:
                 if for_api:
                     results_dict['pubmed_id'] = "N/A"
                     results_dict['year'] = "N/A"
                 else:
-                    results_dict['pubmed'] = "N/A"
+                    results_dict['pubmed_link'] = "N/A"
+                    results_dict['pubmed_text'] = "N/A"
             results_dict['lrs_score'] = trait.LRS_score_repr
             results_dict['lrs_location'] = trait.LRS_location_repr
             if trait.additive and trait.additive != "":
diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html
index 6f92fcb5..2b79770a 100644
--- a/wqflask/wqflask/templates/correlation_page.html
+++ b/wqflask/wqflask/templates/correlation_page.html
@@ -260,7 +260,6 @@
 
             console.time("Creating table");
 
-            {% if target_dataset.type == "ProbeSet" %}
             table_conf = {
                 buttons: [
                     {
@@ -400,10 +399,10 @@
                       'width': "500px",
                       'data': null,
                       'render': function(data, type, row, meta) {
-			            try {
-                            return decodeURIComponent(escape(data.abbreviation))
-			            } catch(err){
-			                return data.abbreviation
+			                  try {
+                          return decodeURIComponent(escape(data.abbreviation))
+			                  } catch(err){
+			                    return data.abbreviation
                         }
                       }
                     },
@@ -413,10 +412,10 @@
                       'width': "500px",
                       'data': null,
                       'render': function(data, type, row, meta) {
-			            try {
-                            return decodeURIComponent(escape(data.description))
-			            } catch(err){
-			                return data.description
+			                  try {
+                          return decodeURIComponent(escape(data.description))
+			                  } catch(err){
+			                    return data.description
                         }
                       }
                     },
@@ -426,11 +425,12 @@
                       'width': "500px",
                       'data': null,
                       'render': function(data, type, row, meta) {
-			            try {
-                            return decodeURIComponent(escape(data.authors_display))
-			            } catch(err){
-			                return data.authors_display
+			                  try {
+                          return decodeURIComponent(escape(data.authors_display))
+			                  } catch(err){
+			                    return data.authors_display
                         }
+                      }
                     },
                     {
                       'title': "Year",
@@ -520,7 +520,7 @@
                     "orderable": false
                 } ],
                 "order": [[9, "asc" ]],
-                "sDom": "Bpitirp",
+                "sDom": "Bitir",
                 "autoWidth": true,
                 "bSortClasses": false,
                 "scrollY": "50vh",
@@ -528,98 +528,6 @@
                 "scrollCollapse": true
             }
 
-            {% elif target_dataset.type == "Publish" %}
-            table_conf =  {
-                "drawCallback": function( settings ) {
-                     $('#trait_table tr').click(function(event) {
-                         if (event.target.type !== 'checkbox') {
-                             $(':checkbox', this).trigger('click');
-                         }
-                     });
-                     $('.trait_checkbox:checkbox').on("change", change_buttons);
-                },
-                "buttons": [
-                    {
-                        extend: 'columnsToggle',
-                        columns: function( idx, data, node ) {
-                          if (idx != 0) {
-                            return true;
-                          } else {
-                            return false;
-                          }
-                        },
-                        postfixButtons: [ 'colvisRestore' ]
-                    }
-                ],
-                "columnDefs": [ 
-                    { "targets": 0, "orderable": false }
-                ],  
-                "columns": [
-                    { "type": "natural" },
-                    { "type": "natural" },
-                    { "type": "natural" },
-                    { "type": "natural" },
-                    { "type": "natural", "width": "20%" },
-                    { "type": "natural", "width": "12%" },
-                    { "type": "natural-minus-na" },
-                    { "orderDataType": "dom-innertext", 'orderSequence': [ "desc", "asc"] },
-                    { "type": "natural" },
-                    { "type": "scientific" },
-                    { "type": "natural-minus-na" },
-                    { "type": "natural-minus-na" },
-                    { "type": "natural-minus-na" }
-                ],
-                "order": [[9, "asc" ]],
-                "sDom": "Btir",
-                "iDisplayLength": -1,
-                "autoWidth": false,
-                "processing": true,
-                "deferRender": true,
-                "bSortClasses": false,
-                "scrollY": "50vh",
-                "scroller":  true,
-                "scrollCollapse": true
-            }
-            {% elif target_dataset.type == "Geno" %}
-            table_conf = {
-                "paging": false,
-                buttons: [
-                    {
-                        extend: 'columnsToggle',
-                        columns: function( idx, data, node ) {
-                          if (idx != 0) {
-                            return true;
-                          } else {
-                            return false;
-                          }
-                        },
-                        postfixButtons: [ 'colvisRestore' ]
-                    }
-                ],
-                "columnDefs": [ 
-                    { "targets": 0, "orderable": false }
-                ],  
-                "columns": [
-                    { "type": "natural" },
-                    { "type": "natural" },
-                    { "type": "natural" },
-                    { "type": "natural" },
-                    { "orderDataType": "dom-innertext", 'orderSequence': [ "desc", "asc"] },
-                    { "type": "natural-minus-na" },
-                    { "type": "scientific" }
-                ],
-                "order": [[6, "asc" ]],
-                "sDom": "Btir",
-                "autoWidth": false,
-                "bDeferRender": true,
-                "scrollY": "800px",
-                "scrollCollapse": false,
-                "scrollY": "50vh",
-                "scroller":  true,
-                "scrollCollapse": true
-            }
-            {% endif %}
-
             the_table = $('#trait_table').DataTable(table_conf);
 
             the_table.on( 'order.dt search.dt draw.dt', function () {