From b09fc33754dd8f250332180eefa988e77a6f898c Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 8 Oct 2020 13:21:27 -0500 Subject: When generating links to correlation scatterplots (in corr results and corr matrix), append the group name to Temp dataset names so temp traits can be used in scatterplot * wqflask/wqflask/correlation/corr_scatter_plot.py - Create the dataset object using the group name included with Temp dataset names (which take the form "Temp_(group_name)") * wqflask/wqflask/templates/correlation_matrix.html - Change scatterplot links to include the group name if the dataset name is "Temp" * wqflask/wqflask/templates/correlation_page.html - Change scatterplot links to include the group name if the dataset name is "Temp" + a couple minor style changes --- wqflask/wqflask/correlation/corr_scatter_plot.py | 11 +++++++++-- wqflask/wqflask/templates/correlation_matrix.html | 2 +- wqflask/wqflask/templates/correlation_page.html | 12 ++++++------ 3 files changed, 16 insertions(+), 9 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/correlation/corr_scatter_plot.py b/wqflask/wqflask/correlation/corr_scatter_plot.py index 819836b1..0f3d455c 100644 --- a/wqflask/wqflask/correlation/corr_scatter_plot.py +++ b/wqflask/wqflask/correlation/corr_scatter_plot.py @@ -17,8 +17,15 @@ class CorrScatterPlot(object): """Page that displays a correlation scatterplot with a line fitted to it""" def __init__(self, params): - self.dataset_1 = data_set.create_dataset(params['dataset_1']) - self.dataset_2 = data_set.create_dataset(params['dataset_2']) + if "Temp" in params['dataset_1']: + self.dataset_1 = data_set.create_dataset(dataset_name = "Temp", dataset_type = "Temp", group_name = params['dataset_1'].split("_")[1]) + else: + self.dataset_1 = data_set.create_dataset(params['dataset_1']) + if "Temp" in params['dataset_2']: + self.dataset_2 = data_set.create_dataset(dataset_name = "Temp", dataset_type = "Temp", group_name = params['dataset_2'].split("_")[1]) + else: + self.dataset_2 = data_set.create_dataset(params['dataset_2']) + #self.dataset_3 = data_set.create_dataset(params['dataset_3']) self.trait_1 = create_trait(name=params['trait_1'], dataset=self.dataset_1) self.trait_2 = create_trait(name=params['trait_2'], dataset=self.dataset_2) diff --git a/wqflask/wqflask/templates/correlation_matrix.html b/wqflask/wqflask/templates/correlation_matrix.html index 9b96de1c..d556f31a 100644 --- a/wqflask/wqflask/templates/correlation_matrix.html +++ b/wqflask/wqflask/templates/correlation_matrix.html @@ -51,7 +51,7 @@ {% if result[0].name == trait.name and result[0].dataset == trait.dataset %} n
{{ result[2] }}
{% else %} - {{ '%0.2f' % result[1] }}
{{ result[2] }}
+ {{ '%0.2f' % result[1] }}
{{ result[2] }}
{% endif %} {% endfor %} diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index bb2a697f..fb218e29 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -144,7 +144,7 @@ {{ trait.description_display }} {{ trait.location_repr }} {{ '%0.3f' % trait.mean|float }} - {{ '%0.3f'|format(trait.sample_r) }} + {{ '%0.3f'|format(trait.sample_r) }} {{ trait.num_overlap }} {{ '%0.3e'|format(trait.sample_p) }} {% if trait.lit_corr == "" or trait.lit_corr == 0.000 %} @@ -164,15 +164,15 @@ {% if trait.additive != "" %}{{ '%0.3f' % trait.additive|float }}{% else %}N/A{% endif %} {% elif target_dataset.type == "Publish" %} {% if trait.abbreviation %} - {% if trait.abbreviation|length > 20 %}{{ trait.abbreviation[:20] }}...{% else %}{{ trait.abbreviation }}{% endif %} + {% if trait.abbreviation|length > 20 %}{{ trait.abbreviation[:20] }}...{% else %}{{ trait.abbreviation }}{% endif %} {% else %} - N/A + N/A {% endif %} {% if trait.description_display|length > 70 %}{{ trait.description_display[:70] }}...{% else %}{{ trait.description_display }}{% endif %} {% if trait.authors %} {% if trait.authors.split(',') > 6 %}{{ trait.authors.split(',')[:6]|join(', ') }}, et al.{% else %}{{ trait.authors }}{% endif %} {% else %} - N/A + N/A {% endif %} {% if trait.pubmed_text != "N/A" %} @@ -183,7 +183,7 @@ {{ trait.pubmed_text }} {% endif %} - {{ '%0.3f'|format(trait.sample_r) }} + {{ '%0.3f'|format(trait.sample_r) }} {{ trait.num_overlap }} {{ '%0.3e'|format(trait.sample_p) }} {{ trait.LRS_score_repr }} @@ -191,7 +191,7 @@ {% if trait.additive != "" %}{{ '%0.3f' % trait.additive|float }}{% else %}N/A{% endif %} {% elif target_dataset.type == "Geno" %} {{ trait.location_repr }} - {{ '%0.3f'|format(trait.sample_r) }} + {{ '%0.3f'|format(trait.sample_r) }} {{ trait.num_overlap }} {{ '%0.3e'|format(trait.sample_p) }} {% endif %} -- cgit v1.2.3