diff options
-rw-r--r-- | wqflask/base/trait.py | 22 | ||||
-rw-r--r-- | wqflask/wqflask/templates/correlation_page.html | 39 |
2 files changed, 41 insertions, 20 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index ec8c40a0..50bd8874 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -25,19 +25,19 @@ def create_trait(**kw): assert bool(kw.get('dataset')) != bool( kw.get('dataset_name')), "Needs dataset ob. or name" - if kw.get('name'): - if kw.get('dataset_name'): - if kw.get('dataset_name') != "Temp": - dataset = create_dataset(kw.get('dataset_name')) - else: - dataset = kw.get('dataset') + assert bool(kw.get('name')), "Needs trait name" + if kw.get('dataset_name'): if kw.get('dataset_name') != "Temp": - if dataset.type == 'Publish': - permissions = check_resource_availability( - dataset, kw.get('name')) - else: - permissions = check_resource_availability(dataset) + dataset = create_dataset(kw.get('dataset_name')) + else: + dataset = kw.get('dataset') + + if dataset.type == 'Publish': + permissions = check_resource_availability( + dataset, kw.get('name')) + else: + permissions = check_resource_availability(dataset) if "view" in permissions['data']: the_trait = GeneralTrait(**kw) diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 06ee9056..68566ee5 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -345,8 +345,15 @@ 'title': "Sample {% if corr_method == 'pearson' %}r{% else %}rho{% endif %}", 'type': "natural-minus-na", 'width': "40px", - 'data': "sample_r", - 'orderSequence': [ "desc", "asc"] + 'data': null, + 'orderSequence': [ "desc", "asc"], + 'render': function(data, type, row, meta) { + if (data.sample_r != "N/A") { + return "<a target\"_blank\" href=\"corr_scatter_plot?dataset_1={% if dataset.name == 'Temp' %}Temp_{{ dataset.group.name }}{% else %}{{ 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 + } + } }, { 'title': "N", @@ -357,7 +364,7 @@ }, { 'title': "Sample p({% if corr_method == 'pearson' %}r{% else %}rho{% endif %})", - 'type': "natural-minus-na", + 'type': "scientific", 'width': "65px", 'data': "sample_p", 'orderSequence': [ "desc", "asc"] @@ -459,8 +466,15 @@ 'title': "Sample {% if corr_method == 'pearson' %}r{% else %}rho{% endif %}", 'type': "natural-minus-na", 'width': "40px", - 'data': "sample_r", - 'orderSequence': [ "desc", "asc"] + 'data': null, + 'orderSequence': [ "desc", "asc"], + 'render': function(data, type, row, meta) { + if (data.sample_r != "N/A") { + return "<a target\"_blank\" href=\"corr_scatter_plot?dataset_1={% if dataset.name == 'Temp' %}Temp_{{ dataset.group.name }}{% else %}{{ 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 + } + } }, { 'title': "N", @@ -471,7 +485,7 @@ }, { 'title': "Sample p({% if corr_method == 'pearson' %}r{% else %}rho{% endif %})", - 'type': "natural-minus-na", + 'type': "scientific", 'width': "65px", 'data': "sample_p", 'orderSequence': [ "desc", "asc"] @@ -506,8 +520,15 @@ 'title': "Sample {% if corr_method == 'pearson' %}r{% else %}rho{% endif %}", 'type': "natural-minus-na", 'width': "40px", - 'data': "sample_r", - 'orderSequence': [ "desc", "asc"] + 'data': null, + 'orderSequence': [ "desc", "asc"], + 'render': function(data, type, row, meta) { + if (data.sample_r != "N/A") { + return "<a target\"_blank\" href=\"corr_scatter_plot?dataset_1={% if dataset.name == 'Temp' %}Temp_{{ dataset.group.name }}{% else %}{{ 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 + } + } }, { 'title': "N", @@ -518,7 +539,7 @@ }, { 'title': "Sample p({% if corr_method == 'pearson' %}r{% else %}rho{% endif %})", - 'type': "natural-minus-na", + 'type': "scientific", 'width': "65px", 'data': "sample_p", 'orderSequence': [ "desc", "asc"] |