From 2168d7942dc8db8a92689042e4028904e84cb046 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 19 May 2022 20:02:59 +0000 Subject: Include json version of collection trait list, so it can be passed directly to DataTables --- wqflask/wqflask/collect.py | 1 + 1 file changed, 1 insertion(+) diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py index 891da437..b46e1859 100644 --- a/wqflask/wqflask/collect.py +++ b/wqflask/wqflask/collect.py @@ -285,6 +285,7 @@ def view_collection(): else: return render_template( "collections/view.html", + traits_json=json_version, trait_info_str=trait_info_str, **collection_info) -- cgit v1.2.3 From 03a92ba1b2ed0e79a74e5a791fdecf73304ee2e0 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 16 Jun 2022 20:43:33 +0000 Subject: Initial commit for create_datatable.js This file will contain the generic function for initializing datatables, that will take the table ID, table data, column definitions, and custom settings as input (custom settings being additional DataTables settings or settings differing from the defaults) --- .../static/new/javascript/create_datatable.js | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 wqflask/wqflask/static/new/javascript/create_datatable.js diff --git a/wqflask/wqflask/static/new/javascript/create_datatable.js b/wqflask/wqflask/static/new/javascript/create_datatable.js new file mode 100644 index 00000000..18a4f9d7 --- /dev/null +++ b/wqflask/wqflask/static/new/javascript/create_datatable.js @@ -0,0 +1,92 @@ +create_table = function(tableId, tableData, columnDefs, customSettings) { + + loadDataTable(tableId=tableId, tableFata=tableData, tableSettings=tableSettings, firstRun=true) + + function loadDataTable(tableId, tableData, tableSettings, firstRun=false){ + if (!firstRun){ + setUserColumnsDefWidths(tableId); + } + + tableSettings = { + 'data': tableData, + 'columns': columnDefs, + "sDom": "iti", + "destroy": true, + "autoWidth": false, + "bSortClasses": false, + "scrollY": "100vh", + "scrollCollapse": true, + "scroller": true, + "iDisplayLength": -1, + "initComplete": function (settings) { + // Add JQueryUI resizable functionality to each th in the ScrollHead table + $('#' + table_id + '_wrapper .dataTables_scrollHead thead th').resizable({ + handles: "e", + alsoResize: '#' + tableId + '_wrapper .dataTables_scrollHead table', //Not essential but makes the resizing smoother + resize: function( event, ui ) { + widthChange = ui.size.width - ui.originalSize.width; + }, + stop: function () { + saveColumnSettings(table_id, the_table); + loadDataTable(first_run=false, table_id, table_data); + } + }); + } + } + + // Replace default settings with custom settings or add custom settings if not already set in default settings + $.each(customSettings, function(key, value)) { + tableSettings[key] = value + } + } + + if (!firstRun){ + $('#' + tableId + '_container').css("width", String($('#' + tableId).width() + widthChange + 17) + "px"); // Change the container width by the change in width of the adjusted column, so the overall table size adjusts properly + + let checkedRows = getCheckedRows(tableId); + theTable = $('#' + tableId).DataTable(tableSettings); + if (checkedRows.length > 0){ + recheckRows(theTable, checkedRows); + } + } else { + theTable = $('#' + tableId).DataTable(tableSettings); + theTable.draw(); + } + + theTable.on( 'order.dt search.dt draw.dt', function () { + theTable.column(1, {search:'applied', order:'applied'}).nodes().each( function (cell, i) { + cell.innerHTML = i+1; + } ); + } ).draw(); + + if (firstRun){ + $('#' + tableId + '_container').css("width", String($('#' + tableId).width() + 17) + "px"); + } + + $('#' + tableId + '_searchbox').on( 'keyup', function () { + theTable.search($(this).val()).draw(); + } ); + + $('.toggle-vis').on('click', function (e) { + e.preventDefault(); + + function toggleColumn(column) { + // Toggle column visibility + column.visible( ! column.visible() ); + if (column.visible()){ + $(this).removeClass("active"); + } else { + $(this).addClass("active"); + } + } + + // Get the column API object + var targetCols = $(this).attr('data-column').split(",") + for (let i = 0; i < targetCols.length; i++){ + var column = theTable.column( target_cols[i] ); + toggleColumn(column); + } + } ); + + } +} -- cgit v1.2.3 From 251aabe1c2e5712a7bd587fe393c408bf5dc4851 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 16 Jun 2022 20:47:04 +0000 Subject: Replace DataTables code in collection view page with call to new create_table.js --- wqflask/wqflask/templates/collections/view.html | 75 +++++++++---------------- 1 file changed, 27 insertions(+), 48 deletions(-) diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index 39df161d..3ebee77c 100644 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -181,6 +181,8 @@ + + @@ -190,55 +192,32 @@ - - + + - - @@ -276,7 +276,12 @@ ] table_settings = { - "order": [[1, "asc" ]] + "order": [[1, "asc" ]], + {% if traits_json|length > 10 %} + "scroller": true + {% else %} + "scroller": false + {% endif %} } create_table(table_id, traits_json, column_defs, table_settings) -- cgit v1.2.3 From 8e9423e0cdf771fe9603a7c1968ceac34bd4a64a Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 23 Jun 2022 20:57:38 +0000 Subject: Add columnDefs as parameter for setUserColumnDefWidths Now that the function is in a separate JS file it needs the parameter to be directly provided --- wqflask/wqflask/static/new/javascript/table_functions.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wqflask/wqflask/static/new/javascript/table_functions.js b/wqflask/wqflask/static/new/javascript/table_functions.js index 22732397..ea2cf60c 100644 --- a/wqflask/wqflask/static/new/javascript/table_functions.js +++ b/wqflask/wqflask/static/new/javascript/table_functions.js @@ -26,7 +26,7 @@ getCheckedRows = function(tableId){ return checkedRows } -function setUserColumnsDefWidths(tableId) { +function setUserColumnsDefWidths(tableId, columnDefs) { var userColumnDef; // Get the settings for this table from localStorage @@ -57,6 +57,8 @@ function setUserColumnsDefWidths(tableId) { }) } }); + + return columnDefs } function saveColumnSettings(tableId, traitTable) { -- cgit v1.2.3 From 2e0e3aaa2c78c355e83cfae21c9655554451200b Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 23 Jun 2022 20:59:11 +0000 Subject: Fix manual column width change feature to work in create_datatable.js --- .../static/new/javascript/create_datatable.js | 40 +++++++++++++--------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/wqflask/wqflask/static/new/javascript/create_datatable.js b/wqflask/wqflask/static/new/javascript/create_datatable.js index 7b495a8b..217e99be 100644 --- a/wqflask/wqflask/static/new/javascript/create_datatable.js +++ b/wqflask/wqflask/static/new/javascript/create_datatable.js @@ -2,9 +2,11 @@ create_table = function(tableId, tableData, columnDefs, customSettings) { loadDataTable(tableId=tableId, tableFata=tableData, customSettings=customSettings, firstRun=true) + var widthChange = 0; //ZS: For storing the change in width so overall table width can be adjusted by that amount function loadDataTable(tableId, tableData, customSettings, firstRun=false){ + if (!firstRun){ - setUserColumnsDefWidths(tableId); + columnDefs = setUserColumnsDefWidths(tableId, columnDefs); } tableSettings = { @@ -20,15 +22,15 @@ create_table = function(tableId, tableData, columnDefs, customSettings) { "iDisplayLength": -1, "initComplete": function (settings) { // Add JQueryUI resizable functionality to each th in the ScrollHead table - $('#' + table_id + '_wrapper .dataTables_scrollHead thead th').resizable({ + $('#' + tableId + '_wrapper .dataTables_scrollHead thead th').resizable({ handles: "e", alsoResize: '#' + tableId + '_wrapper .dataTables_scrollHead table', //Not essential but makes the resizing smoother resize: function( event, ui ) { widthChange = ui.size.width - ui.originalSize.width; }, stop: function () { - saveColumnSettings(table_id, the_table); - loadDataTable(first_run=false, table_id, table_data); + saveColumnSettings(tableId, theTable); + loadDataTable(tableId, tableData, firstRun=false); } }); } @@ -38,19 +40,23 @@ create_table = function(tableId, tableData, columnDefs, customSettings) { $.each(customSettings, function(key, value) { tableSettings[key] = value }); - } - if (!firstRun){ - $('#' + tableId + '_container').css("width", String($('#' + tableId).width() + widthChange + 17) + "px"); // Change the container width by the change in width of the adjusted column, so the overall table size adjusts properly + if (!firstRun){ + $('#' + tableId + '_container').css("width", String($('#' + tableId).width() + widthChange + 17) + "px"); // Change the container width by the change in width of the adjusted column, so the overall table size adjusts properly - let checkedRows = getCheckedRows(tableId); - theTable = $('#' + tableId).DataTable(tableSettings); - if (checkedRows.length > 0){ - recheckRows(theTable, checkedRows); + let checkedRows = getCheckedRows(tableId); + theTable = $('#' + tableId).DataTable(tableSettings); + if (checkedRows.length > 0){ + recheckRows(theTable, checkedRows); + } + } else { + theTable = $('#' + tableId).DataTable(tableSettings); + theTable.draw(); + } + + if (firstRun){ + $('#' + tableId + '_container').css("width", String($('#' + tableId).width() + 17) + "px"); } - } else { - theTable = $('#' + tableId).DataTable(tableSettings); - theTable.draw(); } theTable.on( 'order.dt search.dt draw.dt', function () { @@ -59,9 +65,9 @@ create_table = function(tableId, tableData, columnDefs, customSettings) { } ); } ).draw(); - if (firstRun){ - $('#' + tableId + '_container').css("width", String($('#' + tableId).width() + 17) + "px"); - } + window.addEventListener('resize', function(){ + theTable.columns.adjust(); + }); $('#' + tableId + '_searchbox').on( 'keyup', function () { theTable.search($(this).val()).draw(); -- cgit v1.2.3 From f22983a304d0c621ef3dab9aac8e824911e66485 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 19 Jul 2022 20:05:07 +0000 Subject: Change JS variables to camelCase and assign ID to table container div --- wqflask/wqflask/templates/collections/view.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index a12c1369..2349e16d 100644 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -94,7 +94,7 @@
Show/Hide Columns:
-
+
@@ -126,14 +126,14 @@ + + + {% if mapping_method == "gemma" or mapping_method == "reaper" %} {% endif %} + + {% endblock %} -- cgit v1.2.3 From 467603f6f1891dd79f39909b8ef7640f53b7e65f Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 27 Jul 2022 18:32:35 +0000 Subject: Set default value for tableId parameter in creatae_table, since most tables will have this ID --- wqflask/wqflask/static/new/javascript/create_datatable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wqflask/wqflask/static/new/javascript/create_datatable.js b/wqflask/wqflask/static/new/javascript/create_datatable.js index 2953655c..8f24df1e 100644 --- a/wqflask/wqflask/static/new/javascript/create_datatable.js +++ b/wqflask/wqflask/static/new/javascript/create_datatable.js @@ -1,4 +1,4 @@ -create_table = function(tableId, tableData = [], columnDefs = [], customSettings = {}) { +create_table = function(tableId="trait_table", tableData = [], columnDefs = [], customSettings = {}) { loadDataTable(tableId=tableId, tableData=tableData, customSettings, firstRun=true) -- cgit v1.2.3 From 5f4722b894c7ff18fb191b82bbc3bcfb881da004 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 27 Jul 2022 19:04:37 +0000 Subject: Change threshold for using scroller on View Collection page --- wqflask/wqflask/templates/collections/view.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index 8dee5244..4f1c82f0 100644 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -298,7 +298,7 @@ $('td', row).eq(10).attr('data-export', $('td', row).eq(9).text()); }, "order": [[1, "asc" ]], - {% if traits_json|length > 10 %} + {% if traits_json|length > 20 %} "scroller": true {% else %} "scroller": false -- cgit v1.2.3 From 6144a94c440d322bdd0dabca7dbe8389d99bda43 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 27 Jul 2022 19:29:37 +0000 Subject: Add table redraw function to create_datatable.js since it applies to multiple tables --- wqflask/wqflask/static/new/javascript/create_datatable.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wqflask/wqflask/static/new/javascript/create_datatable.js b/wqflask/wqflask/static/new/javascript/create_datatable.js index 8f24df1e..68296f06 100644 --- a/wqflask/wqflask/static/new/javascript/create_datatable.js +++ b/wqflask/wqflask/static/new/javascript/create_datatable.js @@ -109,4 +109,10 @@ create_table = function(tableId="trait_table", tableData = [], columnDefs = [], toggleColumn(column); } } ); + + $('#redraw').on('click', function (e) { + e.preventDefault(); + trait_table.columns().visible( true ); + $('.toggle-vis.active').removeClass('active'); + }); } -- cgit v1.2.3 From b4ba085d8761951c8220d67cd79fa6e8ff7107cb Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 27 Jul 2022 19:31:18 +0000 Subject: Convert Correlation table to use create_datatable.js --- wqflask/wqflask/templates/correlation_page.html | 667 +++++++++++------------- 1 file changed, 309 insertions(+), 358 deletions(-) diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index ceaa34b1..dbab2ffc 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -131,9 +131,6 @@ {% endblock %} {% block js %} - - - @@ -143,10 +140,13 @@ + + + {% endblock %} -- cgit v1.2.3 From 6e0d422b23d2219298758cfe4bfa4da261f1cf9d Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 27 Jul 2022 19:39:44 +0000 Subject: Convert gene global search to use create_datatable.js --- wqflask/wqflask/templates/gsearch_gene.html | 84 +++-------------------------- 1 file changed, 8 insertions(+), 76 deletions(-) diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index 69281ec5..36739ba3 100644 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -56,6 +56,7 @@ + + {% endblock %} -- cgit v1.2.3 From 4f40cdf5aad12c719201c45c03bf570f6aa787be Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 27 Jul 2022 21:42:47 +0000 Subject: Fix one target_cols variable I forgot to switch to camelCase --- wqflask/wqflask/static/new/javascript/create_datatable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wqflask/wqflask/static/new/javascript/create_datatable.js b/wqflask/wqflask/static/new/javascript/create_datatable.js index 68296f06..d42301f9 100644 --- a/wqflask/wqflask/static/new/javascript/create_datatable.js +++ b/wqflask/wqflask/static/new/javascript/create_datatable.js @@ -105,7 +105,7 @@ create_table = function(tableId="trait_table", tableData = [], columnDefs = [], // Get the column API object var targetCols = $(this).attr('data-column').split(",") for (let i = 0; i < targetCols.length; i++){ - var column = theTable.column( target_cols[i] ); + var column = theTable.column( targetCols[i] ); toggleColumn(column); } } ); -- cgit v1.2.3 From f3d2cc63d95aefccb5f78233e12e4b145cb3e29a Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 27 Jul 2022 21:44:03 +0000 Subject: Add necessary new JS files to show_trait.html and make formatting of all js imports the same --- wqflask/wqflask/templates/show_trait.html | 63 ++++++++++--------------------- 1 file changed, 19 insertions(+), 44 deletions(-) diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index f366d33f..0f93188b 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -131,19 +131,19 @@ $('.collapse').collapse() - - - - - - - - + + + + + + + + - - - - + + + + @@ -151,12 +151,13 @@ - - - - - - + + + + + + + \ No newline at end of file + -- cgit v1.2.3 From 268415b5fe1dd4c355b80e4a74359ef346be1565 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 1 Aug 2022 15:06:18 +0000 Subject: Change min-width to something more reasonable (will put this in CSS later) --- wqflask/wqflask/templates/search_result_page.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 0bce6793..d129a7cd 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -131,7 +131,7 @@ {% endif %} {% endif %} -
+

Loading...
-- cgit v1.2.3 From 7bad8d7d86a72932ab49498c44c0e345ec93f43e Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 2 Aug 2022 19:04:18 +0000 Subject: Condense some conditional logic --- wqflask/wqflask/static/new/javascript/create_datatable.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/wqflask/wqflask/static/new/javascript/create_datatable.js b/wqflask/wqflask/static/new/javascript/create_datatable.js index d42301f9..7635cae0 100644 --- a/wqflask/wqflask/static/new/javascript/create_datatable.js +++ b/wqflask/wqflask/static/new/javascript/create_datatable.js @@ -68,9 +68,6 @@ create_table = function(tableId="trait_table", tableData = [], columnDefs = [], } else { theTable = $('#' + tableId).DataTable(tableSettings); theTable.draw(); - } - - if (firstRun){ $('#' + tableId + '_container').css("width", String($('#' + tableId).width() + 17) + "px"); } } -- cgit v1.2.3 From 1c13e5aa3f221a85448c8d453e8e79ef19c05ed0 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 2 Aug 2022 19:07:53 +0000 Subject: Remove unused parameters from column render functions in search_result_page.html --- wqflask/wqflask/templates/search_result_page.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index d129a7cd..62ee93cc 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -193,7 +193,7 @@ 'width': "5px", 'orderDataType': "dom-checkbox", 'targets': 0, - 'render': function(data, type, row, meta) { + 'render': function(data) { return '' } }, @@ -213,7 +213,7 @@ 'data': null, 'width': "{{ max_widths.display_name * 8 }}px", 'targets': 2, - 'render': function(data, type, row, meta) { + 'render': function(data) { return '' + data.display_name + '' } }, @@ -229,7 +229,7 @@ 'type': "natural", 'data': null, 'targets': 4, - 'render': function(data, type, row, meta) { + 'render': function(data) { try { return decodeURIComponent(escape(data.description)) } catch(err){ @@ -281,7 +281,7 @@ 'width': "{{ max_widths.display_name * 9 }}px", 'data': null, 'targets': 2, - 'render': function(data, type, row, meta) { + 'render': function(data) { return '' + data.display_name + '' } }, @@ -295,7 +295,7 @@ {% endif %} 'data': null, 'targets': 3, - 'render': function(data, type, row, meta) { + 'render': function(data) { try { return decodeURIComponent(escape(data.description)) } catch(err){ @@ -321,7 +321,7 @@ {% endif %} 'data': null, 'targets': 5, - 'render': function(data, type, row, meta) { + 'render': function(data) { author_list = data.authors.split(",") if (author_list.length >= 2) { author_string = author_list.slice(0, 2).join(",") + ", et al." @@ -337,7 +337,7 @@ 'data': null, 'width': "50px", 'targets': 6, - 'render': function(data, type, row, meta) { + 'render': function(data) { if (data.pubmed_id != "N/A"){ return '' + data.pubmed_text + '' } else { @@ -375,7 +375,7 @@ 'width': "{{ max_widths.display_name * 9 }}px", 'data': null, 'targets': 2, - 'render': function(data, type, row, meta) { + 'render': function(data) { return '' + data.display_name + '' } }, -- cgit v1.2.3 From a27af20d34190ab5320350dfe73d0a4ce6e116d7 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 2 Aug 2022 19:09:01 +0000 Subject: Remove unused parameters from correlation_page.html column render functions --- wqflask/wqflask/templates/correlation_page.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index dbab2ffc..8e9af648 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -232,7 +232,7 @@ 'width': "25px", 'orderDataType': "dom-checkbox", 'orderSequence': [ "desc", "asc"], - 'render': function(data, type, row, meta) { + 'render': function(data) { return '' } }, @@ -247,7 +247,7 @@ 'type': "natural-minus-na", 'data': null, 'width': "60px", - 'render': function(data, type, row, meta) { + 'render': function(data) { return '' + data.trait_id + '' } }{% if target_dataset.type == 'ProbeSet' %}, @@ -261,7 +261,7 @@ 'title': "Description", 'type': "natural", 'data': null, - 'render': function(data, type, row, meta) { + 'render': function(data) { try { return decodeURIComponent(escape(data.description)) } catch(err){ @@ -288,7 +288,7 @@ 'width': "40px", 'data': null, 'orderSequence': [ "desc", "asc"], - 'render': function(data, type, row, meta) { + 'render': function(data) { if (data.sample_r != "N/A") { return "" + data.sample_r + "" } else { @@ -356,7 +356,7 @@ 'type': "natural", 'width': "200px", 'data': null, - 'render': function(data, type, row, meta) { + 'render': function(data) { try { return decodeURIComponent(escape(data.abbreviation_display)) } catch(err){ @@ -368,7 +368,7 @@ 'title': "Description", 'type': "natural", 'data': null, - 'render': function(data, type, row, meta) { + 'render': function(data) { try { return decodeURIComponent(escape(data.description)) } catch(err){ @@ -388,7 +388,7 @@ 'type': "natural", 'width': "400px", 'data': null, - 'render': function(data, type, row, meta) { + 'render': function(data) { try { return decodeURIComponent(escape(data.authors_display)) } catch(err){ @@ -401,7 +401,7 @@ 'type': "natural-minus-na", 'data': null, 'width': "80px", - 'render': function(data, type, row, meta) { + 'render': function(data) { if (data.pubmed_id != "N/A"){ return '' + data.pubmed_text + '' } else { @@ -416,7 +416,7 @@ 'width': "40px", 'data': null, 'orderSequence': [ "desc", "asc"], - 'render': function(data, type, row, meta) { + 'render': function(data) { if (data.sample_r != "N/A") { return "" + data.sample_r + "" } else { @@ -470,7 +470,7 @@ 'width': "40px", 'data': null, 'orderSequence': [ "desc", "asc"], - 'render': function(data, type, row, meta) { + 'render': function(data) { if (data.sample_r != "N/A") { return "" + data.sample_r + "" } else { -- cgit v1.2.3 From 12d9c5d87c75e5b2eee69f3533ea4452d88b1b35 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 2 Aug 2022 19:12:10 +0000 Subject: Remove unused parameters from collections/view.html column render functions --- wqflask/wqflask/templates/collections/view.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index 4f1c82f0..a9c84cb0 100644 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -139,7 +139,7 @@ 'width': "5px", 'orderDataType': "dom-checkbox", 'targets': 0, - 'render': function(data, type, row, meta) { + 'render': function(data) { return '' } }, @@ -166,7 +166,7 @@ 'width': "120px", 'targets': 3, 'data': null, - 'render': function(data, type, row, meta) { + 'render': function(data) { return '' + data.display_name + '' } }, @@ -175,7 +175,7 @@ 'type': "natural", 'targets': 4, 'data': null, - 'render': function(data, type, row, meta) { + 'render': function(data) { if (Object.hasOwn(data, 'symbol')){ return data.symbol } else { @@ -188,7 +188,7 @@ 'type': "natural", 'targets': 5, 'data': null, - 'render': function(data, type, row, meta) { + 'render': function(data) { if (Object.hasOwn(data, 'description')){ try { return decodeURIComponent(escape(data.description)) @@ -206,7 +206,7 @@ 'width': "125px", 'targets': 6, 'data': null, - 'render': function(data, type, row, meta) { + 'render': function(data) { if (Object.hasOwn(data, 'location')){ return data.location } else { @@ -221,7 +221,7 @@ 'data': null, 'targets': 7, 'orderSequence': [ "desc", "asc"], - 'render': function(data, type, row, meta) { + 'render': function(data) { if (Object.hasOwn(data, 'mean')){ return data.mean.toFixed(3) } else { @@ -236,7 +236,7 @@ 'width': "60px", 'targets': 8, 'orderSequence': [ "desc", "asc"], - 'render': function(data, type, row, meta) { + 'render': function(data) { if (Object.hasOwn(data, 'lrs_score')){ return (data.lrs_score / 4.61).toFixed(3) } else { @@ -250,7 +250,7 @@ 'data': null, 'width': "125px", 'targets': 9, - 'render': function(data, type, row, meta) { + 'render': function(data) { if (Object.hasOwn(data, 'lrs_location')){ return data.lrs_location } else { @@ -265,7 +265,7 @@ 'width': "85px", 'targets': 10, 'orderSequence': [ "desc", "asc"], - 'render': function(data, type, row, meta) { + 'render': function(data) { if (Object.hasOwn(data, 'additive')){ return data.additive.toFixed(3) } else { -- cgit v1.2.3 From e7db621fa700ec8749dddc183e75fa3b1bd7460e Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 2 Aug 2022 19:13:27 +0000 Subject: Remove unused parameters from gsearch_gene.html's column render functions --- wqflask/wqflask/templates/gsearch_gene.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index 36739ba3..39c46f02 100644 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -84,7 +84,7 @@ 'width': "5px", 'data': null, 'targets': 0, - 'render': function(data, type, row, meta) { + 'render': function(data) { return '' } }, @@ -102,7 +102,7 @@ 'width': "60px", 'data': null, 'targets': 2, - 'render': function(data, type, row, meta) { + 'render': function(data) { return '' + data.name + '' } }, @@ -147,7 +147,7 @@ 'data': null, 'width': "120px", 'targets': 8, - 'render': function(data, type, row, meta) { + 'render': function(data) { try { return decodeURIComponent(escape(data.description)) } catch(err) { -- cgit v1.2.3 From dd89575d502e691157f210cdebbd2afb8c292bff Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 2 Aug 2022 19:14:07 +0000 Subject: Remove unused parameters from gsearch_pheno.html's column render functions --- wqflask/wqflask/templates/gsearch_pheno.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html index 8824ce55..a7357b03 100644 --- a/wqflask/wqflask/templates/gsearch_pheno.html +++ b/wqflask/wqflask/templates/gsearch_pheno.html @@ -84,7 +84,7 @@ 'orderDataType': "dom-checkbox", 'width': "10px", 'targets': 0, - 'render': function(data, type, row, meta) { + 'render': function(data) { return '' } }, @@ -116,7 +116,7 @@ 'width': "60px", 'targets': 4, 'orderDataType': "dom-inner-text", - 'render': function(data, type, row, meta) { + 'render': function(data) { return '' + data.display_name + '' } }, @@ -126,7 +126,7 @@ 'width': "500px", 'targets': 5, 'data': null, - 'render': function(data, type, row, meta) { + 'render': function(data) { try { return decodeURIComponent(escape(data.description)) } catch(err) { @@ -147,7 +147,7 @@ 'width': "300px", 'targets': 7, 'data': null, - 'render': function(data, type, row, meta) { + 'render': function(data) { author_list = data.authors.split(",") if (author_list.length >= 6) { author_string = author_list.slice(0, 6).join(",") + ", et al." @@ -164,7 +164,7 @@ 'orderDataType': "dom-inner-text", 'width': "25px", 'targets': 8, - 'render': function(data, type, row, meta) { + 'render': function(data) { if (data.pubmed_id != "N/A"){ return '' + data.pubmed_text + '' } else { -- cgit v1.2.3 From 6a30e25598b2ca665746954bb26a6c6e08021b34 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 2 Aug 2022 19:16:07 +0000 Subject: Remove unused parameters from trait page sample table's column render functions --- .../static/new/javascript/initialize_show_trait_tables.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js b/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js index 2765a880..cfc4f39e 100644 --- a/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js +++ b/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js @@ -17,7 +17,7 @@ buildColumns = function() { 'searchable' : false, 'targets': 0, 'width': "25px", - 'render': function(data, type, row, meta) { + 'render': function() { return '' } }, @@ -35,7 +35,7 @@ buildColumns = function() { 'data': null, 'targets': 2, 'width': "60px", - 'render': function(data, type, row, meta) { + 'render': function(data) { return '' + data.name + '' } }, @@ -46,7 +46,7 @@ buildColumns = function() { 'data': null, 'targets': 3, 'width': "60px", - 'render': function(data, type, row, meta) { + 'render': function(data) { if (data.value == null) { return '' } else { @@ -67,7 +67,7 @@ buildColumns = function() { 'targets': 4, 'searchable' : false, 'width': "25px", - 'render': function(data, type, row, meta) { + 'render': function() { return '±' } }, @@ -78,7 +78,7 @@ buildColumns = function() { 'data': null, 'targets': 5, 'width': "60px", - 'render': function(data, type, row, meta) { + 'render': function(data) { if (data.variance == null) { return '' } else { @@ -98,7 +98,7 @@ buildColumns = function() { 'data': null, 'targets': 6, 'width': "60px", - 'render': function(data, type, row, meta) { + 'render': function(data) { if (data.num_cases == null || data.num_cases == undefined) { return '' } else { @@ -120,7 +120,7 @@ buildColumns = function() { 'data': null, 'targets': 4, 'width': "60px", - 'render': function(data, type, row, meta) { + 'render': function(data) { if (data.num_cases == null || data.num_cases == undefined) { return '' } else { -- cgit v1.2.3 From a64daab776d2b5637a11204848dc871e3f762308 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 2 Aug 2022 19:26:28 +0000 Subject: Move logic for creating authors display string to the server-side Python code --- wqflask/wqflask/search_results.py | 4 ++++ wqflask/wqflask/templates/search_result_page.html | 13 ++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index a82390cb..eb8879dd 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -172,6 +172,10 @@ class SearchResultPage: trait_dict['pubmed_text'] = result[4] trait_dict['authors'] = result[3] + trait_dict['authors_display'] = trait_dict['authors'] + author_list = trait_dict['authors'].split(",") + if len(author_list) >= 2: + trait_dict['authors_display'] = (",").join(author_list[:2]) + ", et al." if result[6] != "" and result[6] != None: trait_dict['mean'] = f"{result[6]:.3f}" diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 62ee93cc..bd832420 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -319,17 +319,8 @@ {% else %} 'width': "500px", {% endif %} - 'data': null, - 'targets': 5, - 'render': function(data) { - author_list = data.authors.split(",") - if (author_list.length >= 2) { - author_string = author_list.slice(0, 2).join(",") + ", et al." - } else{ - author_string = data.authors - } - return author_string - } + 'data': "authors_display", + 'targets': 5 }, { 'title': "
Year
", -- cgit v1.2.3 From e3930602e3c76200d617542833469c0850fb0449 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 2 Aug 2022 19:32:41 +0000 Subject: Move logic for creating authors display string to the server-side Python code + change this_trait to trait_dict to be more consistent with the regular search variable names --- wqflask/wqflask/gsearch.py | 135 ++++++++++++++------------- wqflask/wqflask/templates/gsearch_pheno.html | 11 +-- 2 files changed, 72 insertions(+), 74 deletions(-) diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 53a124d0..9df7b2e1 100644 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -72,38 +72,38 @@ class GSearch: dataset_to_permissions = {} with Bench("Creating trait objects"): for i, line in enumerate(re): - this_trait = {} - this_trait['index'] = i + 1 - this_trait['name'] = line[5] - this_trait['dataset'] = line[3] - this_trait['dataset_fullname'] = line[4] - this_trait['hmac'] = hmac.data_hmac( + trait_dict = {} + trait_dict['index'] = i + 1 + trait_dict['name'] = line[5] + trait_dict['dataset'] = line[3] + trait_dict['dataset_fullname'] = line[4] + trait_dict['hmac'] = hmac.data_hmac( '{}:{}'.format(line[5], line[3])) - this_trait['species'] = line[0] - this_trait['group'] = line[1] - this_trait['tissue'] = line[2] - this_trait['symbol'] = "N/A" + trait_dict['species'] = line[0] + trait_dict['group'] = line[1] + trait_dict['tissue'] = line[2] + trait_dict['symbol'] = "N/A" if line[6]: - this_trait['symbol'] = line[6] - this_trait['description'] = "N/A" + trait_dict['symbol'] = line[6] + trait_dict['description'] = "N/A" if line[7]: - this_trait['description'] = line[7].decode( + trait_dict['description'] = line[7].decode( 'utf-8', 'replace') - this_trait['location_repr'] = "N/A" + trait_dict['location_repr'] = "N/A" if (line[8] != "NULL" and line[8] != "") and (line[9] != 0): - this_trait['location_repr'] = 'Chr%s: %.6f' % ( + trait_dict['location_repr'] = 'Chr%s: %.6f' % ( line[8], float(line[9])) - this_trait['LRS_score_repr'] = "N/A" - this_trait['additive'] = "N/A" - this_trait['mean'] = "N/A" + trait_dict['LRS_score_repr'] = "N/A" + trait_dict['additive'] = "N/A" + trait_dict['mean'] = "N/A" if line[11] != "" and line[11] != None: - this_trait['LRS_score_repr'] = f"{line[11]:.3f}" + trait_dict['LRS_score_repr'] = f"{line[11]:.3f}" if line[14] != "" and line[14] != None: - this_trait['additive'] = f"{line[14]:.3f}" + trait_dict['additive'] = f"{line[14]:.3f}" if line[10] != "" and line[10] != None: - this_trait['mean'] = f"{line[10]:.3f}" + trait_dict['mean'] = f"{line[10]:.3f}" locus_chr = line[16] locus_mb = line[17] @@ -111,15 +111,15 @@ class GSearch: max_lrs_text = "N/A" if locus_chr and locus_mb: max_lrs_text = f"Chr{locus_chr}: {locus_mb}" - this_trait['max_lrs_text'] = max_lrs_text + trait_dict['max_lrs_text'] = max_lrs_text - this_trait['additive'] = "N/A" + trait_dict['additive'] = "N/A" if line[14] != "" and line[14] != None: - this_trait['additive'] = '%.3f' % line[14] - this_trait['dataset_id'] = line[15] + trait_dict['additive'] = '%.3f' % line[14] + trait_dict['dataset_id'] = line[15] dataset_ob = SimpleNamespace( - id=this_trait["dataset_id"], type="ProbeSet", name=this_trait["dataset"], species=this_trait["species"]) + id=trait_dict["dataset_id"], type="ProbeSet", name=trait_dict["dataset"], species=trait_dict["species"]) if dataset_ob.id not in dataset_to_permissions: permissions = check_resource_availability(dataset_ob) dataset_to_permissions[dataset_ob.id] = permissions @@ -132,7 +132,7 @@ class GSearch: if permissions['data'] == 'no-access': continue - trait_list.append(this_trait) + trait_list.append(trait_dict) self.trait_count = len(trait_list) self.trait_list = trait_list @@ -215,43 +215,43 @@ class GSearch: trait_list = [] with Bench("Creating trait objects"): for i, line in enumerate(re): - this_trait = {} - this_trait['index'] = i + 1 - this_trait['name'] = str(line[4]) + trait_dict = {} + trait_dict['index'] = i + 1 + trait_dict['name'] = str(line[4]) if len(str(line[12])) == 3: - this_trait['display_name'] = str( - line[12]) + "_" + this_trait['name'] + trait_dict['display_name'] = str( + line[12]) + "_" + trait_dict['name'] else: - this_trait['display_name'] = this_trait['name'] - this_trait['dataset'] = line[2] - this_trait['dataset_fullname'] = line[3] - this_trait['hmac'] = hmac.data_hmac( + trait_dict['display_name'] = trait_dict['name'] + trait_dict['dataset'] = line[2] + trait_dict['dataset_fullname'] = line[3] + trait_dict['hmac'] = hmac.data_hmac( '{}:{}'.format(line[4], line[2])) - this_trait['species'] = line[0] - this_trait['group'] = line[1] + trait_dict['species'] = line[0] + trait_dict['group'] = line[1] if line[9] != None and line[6] != None: - this_trait['description'] = line[6].decode( + trait_dict['description'] = line[6].decode( 'utf-8', 'replace') elif line[5] != None: - this_trait['description'] = line[5].decode( + trait_dict['description'] = line[5].decode( 'utf-8', 'replace') else: - this_trait['description'] = "N/A" - this_trait['dataset_id'] = line[14] + trait_dict['description'] = "N/A" + trait_dict['dataset_id'] = line[14] - this_trait['LRS_score_repr'] = "N/A" - this_trait['additive'] = "N/A" - this_trait['mean'] = "N/A" + trait_dict['LRS_score_repr'] = "N/A" + trait_dict['additive'] = "N/A" + trait_dict['mean'] = "N/A" if line[10] != "" and line[10] != None: - this_trait['LRS_score_repr'] = f"{line[10]:.3f}" + trait_dict['LRS_score_repr'] = f"{line[10]:.3f}" # Some Max LRS values in the DB are wrongly listed as 0.000, but shouldn't be displayed - if this_trait['LRS_score_repr'] == "0.000": - this_trait['LRS_score_repr'] = "N/A" + if trait_dict['LRS_score_repr'] == "0.000": + trait_dict['LRS_score_repr'] = "N/A" if line[11] != "" and line[11] != None: - this_trait['additive'] = f"{line[11]:.3f}" + trait_dict['additive'] = f"{line[11]:.3f}" if line[13] != "" and line[13] != None: - this_trait['mean'] = f"{line[13]:.3f}" + trait_dict['mean'] = f"{line[13]:.3f}" locus_chr = line[15] locus_mb = line[16] @@ -259,22 +259,29 @@ class GSearch: max_lrs_text = "N/A" if locus_chr and locus_mb: max_lrs_text = f"Chr{locus_chr}: {locus_mb}" - this_trait['max_lrs_text'] = max_lrs_text - - this_trait['authors'] = line[7] - this_trait['year'] = line[8] - this_trait['pubmed_text'] = "N/A" - this_trait['pubmed_link'] = "N/A" - if this_trait['year'].isdigit(): - this_trait['pubmed_text'] = this_trait['year'] + trait_dict['max_lrs_text'] = max_lrs_text + + trait_dict['authors'] = line[7] + + trait_dict['authors'] = line[7] + trait_dict['authors_display'] = trait_dict['authors'] + author_list = trait_dict['authors'].split(",") + if len(author_list) >= 2: + trait_dict['authors_display'] = (",").join(author_list[:2]) + ", et al." + + trait_dict['year'] = line[8] + trait_dict['pubmed_text'] = "N/A" + trait_dict['pubmed_link'] = "N/A" + if trait_dict['year'].isdigit(): + trait_dict['pubmed_text'] = trait_dict['year'] if line[9] != "" and line[9] != None: - this_trait['pubmed_link'] = webqtlConfig.PUBMEDLINK_URL % line[8] + trait_dict['pubmed_link'] = webqtlConfig.PUBMEDLINK_URL % line[8] if line[12]: - this_trait['display_name'] = line[12] + \ - "_" + str(this_trait['name']) + trait_dict['display_name'] = line[12] + \ + "_" + str(trait_dict['name']) - dataset_ob = SimpleNamespace(id=this_trait["dataset_id"], type="Publish", species=this_trait["species"]) - permissions = check_resource_availability(dataset_ob, this_trait['name']) + dataset_ob = SimpleNamespace(id=trait_dict["dataset_id"], type="Publish", species=trait_dict["species"]) + permissions = check_resource_availability(dataset_ob, trait_dict['name']) if type(permissions['data']) is list: if "view" not in permissions['data']: continue @@ -282,7 +289,7 @@ class GSearch: if permissions['data'] == 'no-access': continue - trait_list.append(this_trait) + trait_list.append(trait_dict) self.trait_count = len(trait_list) self.trait_list = trait_list diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html index a7357b03..0d18a0bf 100644 --- a/wqflask/wqflask/templates/gsearch_pheno.html +++ b/wqflask/wqflask/templates/gsearch_pheno.html @@ -146,16 +146,7 @@ 'type': "natural", 'width': "300px", 'targets': 7, - 'data': null, - 'render': function(data) { - author_list = data.authors.split(",") - if (author_list.length >= 6) { - author_string = author_list.slice(0, 6).join(",") + ", et al." - } else{ - author_string = data.authors - } - return author_string - } + 'data': "authors_display" }, { 'title': "Year", -- cgit v1.2.3 From e0626f40d8fe4fa83daba52b82c1b459b34b1849 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 2 Aug 2022 19:47:16 +0000 Subject: Define ROrRho and corr_method in JS to get rid of some of the template logic that was mixed into the JS --- wqflask/wqflask/templates/correlation_page.html | 32 +++++++++++++++---------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 8e9af648..c6cd2544 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -226,6 +226,14 @@ tableId = "trait_table"; + {% if corr_method == 'pearson' %} + rOrRho = "r" + corr_method = "pearson" + {% else %} + rOrRho = "rho" + corr_method = "spearman" + {% endif %} + columnDefs = [ { 'data': null, @@ -283,14 +291,14 @@ 'orderSequence': [ "desc", "asc"] }, { - 'title': "Sample {% if corr_method == 'pearson' %}r{% else %}rho{% endif %}", + 'title': "Sample " + rOrRho, 'type': "natural-minus-na", 'width': "40px", 'data': null, 'orderSequence': [ "desc", "asc"], 'render': function(data) { if (data.sample_r != "N/A") { - return "" + data.sample_r + "" + return "" + data.sample_r + "" } else { return data.sample_r } @@ -304,28 +312,28 @@ 'orderSequence': [ "desc", "asc"] }, { - 'title': "Sample p({% if corr_method == 'pearson' %}r{% else %}rho{% endif %})", + 'title': "Sample p(" + rOrRho + ")", 'type': "scientific", 'width': "65px", 'data': "sample_p", 'orderSequence': [ "desc", "asc"] }, { - 'title': "Lit {% if corr_method == 'pearson' %}r{% else %}rho{% endif %}", + 'title': "Lit " + rOrRho, 'type': "natural-minus-na", 'width': "40px", 'data': "lit_corr", 'orderSequence': [ "desc", "asc"] }, { - 'title': "Tissue {% if corr_method == 'pearson' %}r{% else %}rho{% endif %}", + 'title': "Tissue " + rOrRho, 'type': "natural-minus-na", 'width': "40px", 'data': "tissue_corr", 'orderSequence': [ "desc", "asc"] }, { - 'title': "Tissue p({% if corr_method == 'pearson' %}r{% else %}rho{% endif %})", + 'title': "Tissue p(" + rOrRho + ")", 'type': "natural-minus-na", 'width': "40px", 'data': "tissue_pvalue", @@ -411,14 +419,14 @@ 'orderSequence': [ "desc", "asc"] }, { - 'title': "Sample {% if corr_method == 'pearson' %}r{% else %}rho{% endif %}", + 'title': "Sample " + rOrRho, 'type': "natural-minus-na", 'width': "40px", 'data': null, 'orderSequence': [ "desc", "asc"], 'render': function(data) { if (data.sample_r != "N/A") { - return "" + data.sample_r + "" + return "" + data.sample_r + "" } else { return data.sample_r } @@ -432,7 +440,7 @@ 'orderSequence': [ "desc", "asc"] }, { - 'title': "Sample p({% if corr_method == 'pearson' %}r{% else %}rho{% endif %})", + 'title': "Sample p(" + rOrRho + ")", 'type': "scientific", 'width': "65px", 'data': "sample_p", @@ -465,14 +473,14 @@ 'data': "location" }, { - 'title': "Sample {% if corr_method == 'pearson' %}r{% else %}rho{% endif %}", + 'title': "Sample " + rOrRho, 'type': "natural-minus-na", 'width': "40px", 'data': null, 'orderSequence': [ "desc", "asc"], 'render': function(data) { if (data.sample_r != "N/A") { - return "" + data.sample_r + "" + return "" + data.sample_r + "" } else { return data.sample_r } @@ -486,7 +494,7 @@ 'orderSequence': [ "desc", "asc"] }, { - 'title': "Sample p({% if corr_method == 'pearson' %}r{% else %}rho{% endif %})", + 'title': "Sample p(" + rOrRho + ")", 'type': "scientific", 'width': "65px", 'data': "sample_p", -- cgit v1.2.3

Loading...