diff options
author | zsloan | 2022-08-02 19:47:16 +0000 |
---|---|---|
committer | zsloan | 2022-08-02 19:47:16 +0000 |
commit | e0626f40d8fe4fa83daba52b82c1b459b34b1849 (patch) | |
tree | 9df4e9bff018e94739668633747bb0fd0ca92286 | |
parent | e3930602e3c76200d617542833469c0850fb0449 (diff) | |
download | genenetwork2-e0626f40d8fe4fa83daba52b82c1b459b34b1849.tar.gz |
Define ROrRho and corr_method in JS to get rid of some of the template logic that was mixed into the JS
-rw-r--r-- | wqflask/wqflask/templates/correlation_page.html | 32 |
1 files 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 "<a target\"_blank\" href=\"corr_scatter_plot?method={% if corr_method == 'spearman' %}spearman{% else %}pearson{% endif %}&dataset_1={% if this_dataset.name == 'Temp' %}Temp_{{ this_dataset.group }}{% else %}{{ this_dataset.name }}{% endif %}&dataset_2=" + data.dataset + "&trait_1={{ this_trait.name }}&trait_2=" + data.trait_id + "\">" + data.sample_r + "</a>" + return "<a target\"_blank\" href=\"corr_scatter_plot?method=" + corr_method + "&dataset_1={% if this_dataset.name == 'Temp' %}Temp_{{ this_dataset.group }}{% else %}{{ this_dataset.name }}{% endif %}&dataset_2=" + data.dataset + "&trait_1={{ this_trait.name }}&trait_2=" + data.trait_id + "\">" + data.sample_r + "</a>" } 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 "<a target\"_blank\" href=\"corr_scatter_plot?method={% if corr_method == 'spearman' %}spearman{% else %}pearson{% endif %}&dataset_1={% if this_dataset.name== 'Temp' %}Temp_{{ this_dataset.group }}{% else %}{{ this_dataset.name }}{% endif %}&dataset_2=" + data.dataset + "&trait_1={{ this_trait.name }}&trait_2=" + data.trait_id + "\">" + data.sample_r + "</a>" + return "<a target\"_blank\" href=\"corr_scatter_plot?method=" + corr_method + "&dataset_1={% if this_dataset.name== 'Temp' %}Temp_{{ this_dataset.group }}{% else %}{{ this_dataset.name }}{% endif %}&dataset_2=" + data.dataset + "&trait_1={{ this_trait.name }}&trait_2=" + data.trait_id + "\">" + data.sample_r + "</a>" } 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 "<a target\"_blank\" href=\"corr_scatter_plot?method={% if corr_method == 'spearman' %}spearman{% else %}pearson{% endif %}&dataset_1={% if this_dataset.name == 'Temp' %}Temp_{{ this_dataset.group }}{% else %}{{ this_dataset.name }}{% endif %}&dataset_2=" + data.dataset + "&trait_1={{ this_trait.name }}&trait_2=" + data.trait_id + "\">" + data.sample_r + "</a>" + return "<a target\"_blank\" href=\"corr_scatter_plot?method=" + corr_method + "&dataset_1={% if this_dataset.name == 'Temp' %}Temp_{{ this_dataset.group }}{% else %}{{ this_dataset.name }}{% endif %}&dataset_2=" + data.dataset + "&trait_1={{ this_trait.name }}&trait_2=" + data.trait_id + "\">" + data.sample_r + "</a>" } 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", |