From 7932f962aff0ac35dd53b84e483f405de81c0612 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 5 Nov 2020 15:07:58 -0600 Subject: Imported Scroller and used it with correlation page table --- wqflask/wqflask/templates/correlation_page.html | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index bc0b592c..06499ec6 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -215,6 +215,7 @@ + + @@ -331,10 +333,10 @@ 'orderSequence': [ "desc", "asc"] }, { - 'title': "High P ?", + 'title': "High P ", 'type': "natural-minus-na", 'data': "lrs_score", - 'width': "60px", + 'width': "65px", 'orderSequence': [ "desc", "asc"] }, { @@ -344,10 +346,10 @@ 'data': "lrs_location" }, { - 'title': "Effect Size ?", + 'title': "Effect Size ", 'type': "natural-minus-na", 'data': "additive", - 'width': "85px", + 'width': "90px", 'orderSequence': [ "desc", "asc"] }{% elif dataset.type == 'Publish' %}, { @@ -400,7 +402,7 @@ 'orderSequence': [ "desc", "asc"] }, { - 'title': "High P ?", + 'title': "High P ", 'type': "natural-minus-na", 'data': "lrs_score", 'width': "80px", @@ -413,7 +415,7 @@ 'data': "lrs_location" }, { - 'title': "Effect Size ?", + 'title': "Effect Size ", 'type': "natural-minus-na", 'width': "120px", 'data': "additive", -- cgit v1.2.3 From db0e80bef73eb163bfb747ec4d137d5c5069ade8 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 13 Nov 2020 13:40:40 -0600 Subject: Added cdn imports for fontawesome to correlation page and changed superscript i's to fontawesome icons for the glossary links in column headers --- wqflask/wqflask/templates/correlation_page.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index bb7d3df6..6ea86609 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -4,6 +4,7 @@ + {% endblock %} {% block content %} @@ -145,7 +146,8 @@ - + + -- cgit v1.2.3 From 76d5b24b3d2e0b5e6be5b1cf4c125a9a812ff57a Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 13 Nov 2020 15:25:32 -0600 Subject: Switched to using boolean casting to check if various trait attributes exist --- wqflask/wqflask/correlation/show_corr_results.py | 59 ++++++++++++------------ 1 file changed, 29 insertions(+), 30 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 17d3de54..87dd7597 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -494,61 +494,60 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap results_dict['mean'] = "N/A" results_dict['lrs_score'] = "N/A" results_dict['additive'] = "N/A" - if trait.description_display: + if bool(trait.description_display): results_dict['description'] = trait.description_display - if trait.mean and trait.mean != "": + if bool(trait.mean): results_dict['mean'] = float(trait.mean) if trait.LRS_score_repr != "N/A": results_dict['lrs_score'] = "%.1f" % float(trait.LRS_score_repr) results_dict['lrs_location'] = trait.LRS_location_repr - if trait.additive and trait.additive != "": + if bool(trait.additive): results_dict['additive'] = "%0.3f" % float(trait.additive) results_dict['sample_r'] = "%0.3f" % float(trait.sample_r) results_dict['num_overlap'] = trait.num_overlap results_dict['sample_p'] = "%0.3e" % float(trait.sample_p) - if trait.lit_corr == "" or trait.lit_corr == 0: - results_dict['lit_corr'] = "--" - else: + results_dict['lit_corr'] = "--" + results_dict['tissue_corr'] = "--" + results_dict['tissue_pvalue'] = "--" + if bool(trait.lit_corr): results_dict['lit_corr'] = "%0.3f" % float(trait.lit_corr) - if trait.tissue_corr == "" or trait.tissue_corr == 0: - results_dict['tissue_corr'] = "--" - results_dict['tissue_pvalue'] = "--" - else: + if bool(trait.tissue_corr): 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_display'] = "N/A" - if trait.abbreviation: - results_dict['abbreviation_display'] = trait.abbreviation results_dict['description'] = "N/A" - if trait.description_display: - 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'] = ", ".join(authors_list[:6]) + ", et al." + results_dict['authors_display'] = "N/A" + results_dict['additive'] = "N/A" + if for_api: + results_dict['pubmed_id'] = "N/A" + results_dict['year'] = "N/A" else: - results_dict['authors_display'] = trait.authors - if trait.pubmed_id: + results_dict['pubmed_link'] = "N/A" + results_dict['pubmed_text'] = "N/A" + + if bool(trait.abbreviation): + results_dict['abbreviation_display'] = trait.abbreviation + if bool(trait.description_display): + results_dict['description'] = trait.description_display + if bool(trait.authors): + authors_list = trait.authors.split(',') + if len(authors_list) > 6: + results_dict['authors_display'] = ", ".join(authors_list[:6]) + ", et al." + else: + results_dict['authors_display'] = trait.authors + if bool(trait.pubmed_id): if for_api: results_dict['pubmed_id'] = trait.pubmed_id results_dict['year'] = trait.pubmed_text else: 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_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 != "": + if bool(trait.additive): results_dict['additive'] = "%0.3f" % float(trait.additive) - else: - results_dict['additive'] = "N/A" results_dict['sample_r'] = "%0.3f" % trait.sample_r results_dict['num_overlap'] = trait.num_overlap results_dict['sample_p'] = "%0.3e" % float(trait.sample_p) -- cgit v1.2.3 From 678d9cd4e073c3936c34d3b9b54f1e6c590def27 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 13 Nov 2020 15:37:49 -0600 Subject: Switched to using f-strings instead of the older method of string formatting --- wqflask/wqflask/correlation/show_corr_results.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 87dd7597..1b801b1d 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -499,21 +499,21 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap if bool(trait.mean): results_dict['mean'] = float(trait.mean) if trait.LRS_score_repr != "N/A": - results_dict['lrs_score'] = "%.1f" % float(trait.LRS_score_repr) + results_dict['lrs_score'] = f"{float(trait.LRS_score_repr):.1f}" results_dict['lrs_location'] = trait.LRS_location_repr if bool(trait.additive): - results_dict['additive'] = "%0.3f" % float(trait.additive) - results_dict['sample_r'] = "%0.3f" % float(trait.sample_r) + results_dict['additive'] = f"{float(trait.additive):.3f}" + results_dict['sample_r'] = f"{float(trait.sample_r):.3f}" results_dict['num_overlap'] = trait.num_overlap - results_dict['sample_p'] = "%0.3e" % float(trait.sample_p) + results_dict['sample_p'] = f"{float(trait.sample_p):.3e}" results_dict['lit_corr'] = "--" results_dict['tissue_corr'] = "--" results_dict['tissue_pvalue'] = "--" if bool(trait.lit_corr): - results_dict['lit_corr'] = "%0.3f" % float(trait.lit_corr) + results_dict['lit_corr'] = f"{float(trait.lit_corr):.3f}" if bool(trait.tissue_corr): - results_dict['tissue_corr'] = "%0.3f" % float(trait.tissue_corr) - results_dict['tissue_pvalue'] = "%0.3e" % float(trait.tissue_pvalue) + results_dict['tissue_corr'] = f"{float(trait.tissue_corr):.3f}" + results_dict['tissue_pvalue'] = f"{float(trait.tissue_pvalue):.3e}" elif target_dataset.type == "Publish": results_dict['abbreviation_display'] = "N/A" results_dict['description'] = "N/A" @@ -547,15 +547,15 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap results_dict['lrs_score'] = trait.LRS_score_repr results_dict['lrs_location'] = trait.LRS_location_repr if bool(trait.additive): - results_dict['additive'] = "%0.3f" % float(trait.additive) - results_dict['sample_r'] = "%0.3f" % trait.sample_r + results_dict['additive'] = f"{float(trait.additive):.3f}" + results_dict['sample_r'] = f"{float(trait.sample_r):.3f}" results_dict['num_overlap'] = trait.num_overlap - results_dict['sample_p'] = "%0.3e" % float(trait.sample_p) + results_dict['sample_p'] = f"{float(trait.sample_p):.3e}" else: results_dict['location'] = trait.location_repr - results_dict['sample_r'] = "%0.3f" % trait.sample_r + results_dict['sample_r'] = f"{float(trait.sample_r):.3f}" results_dict['num_overlap'] = trait.num_overlap - results_dict['sample_p'] = "%0.3e" % float(trait.sample_p) + results_dict['sample_p'] = f"{float(trait.sample_p):.3e}" results_list.append(results_dict) -- cgit v1.2.3 From d2db01fd8e69afdc6c21b4be529674fffe62b830 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 25 Nov 2020 15:45:18 -0600 Subject: Fixed the "Reset Columns" button to work with the new way of showing/hiding columns (that no longer uses DataTables buttons plug-in) --- wqflask/wqflask/templates/correlation_page.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 3d543c35..6419b185 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -572,7 +572,7 @@ console.timeEnd("Creating table"); - $('.toggle-vis').on( 'click', function (e) { + $('.toggle-vis').on('click', function (e) { e.preventDefault(); // Get the column API object @@ -588,6 +588,12 @@ } } ); + $('#redraw').on('click', function (e) { + e.preventDefault(); + trait_table.columns().visible( true ); + $('.toggle-vis.active').removeClass('active'); + }); + submit_special = function(url) { $("#correlation_form").attr("action", url); return $("#correlation_form").submit(); -- cgit v1.2.3