From 0b760c8282031043e6a9a62ce61bd66eee0f9faf Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 3 Jun 2021 20:22:17 +0000 Subject: Made the code for setting some trait fields (like additive, mean, max_lrs_text) clearer and more consistent, and fixed issue where an error would be thrown if this_trait['locus_chr'] or this_trait['locus_mb'] was None (it's unnecessary to pass those values to the template to begin with, since they're just used to set this_trait['max_lrs_text'] --- wqflask/wqflask/gsearch.py | 76 ++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 8f66f7e9..e541b705 100644 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -92,19 +92,30 @@ class GSearch: if (line[8] != "NULL" and line[8] != "") and (line[9] != 0): this_trait['location_repr'] = 'Chr%s: %.6f' % ( line[8], float(line[9])) - try: - this_trait['mean'] = '%.3f' % line[10] - except: - this_trait['mean'] = "N/A" + this_trait['LRS_score_repr'] = "N/A" + this_trait['additive'] = "N/A" + this_trait['mean'] = "N/A" + if line[11] != "" and line[11] != None: - this_trait['LRS_score_repr'] = '%3.1f' % line[11] + this_trait['LRS_score_repr'] = f"{line[11]:.3f}" + if line[14] != "" and line[14] != None: + this_trait['additive'] = f"{line[14]:.3f}" + if line[10] != "" and line[10] != None: + this_trait['mean'] = f"{line[10]:.3f}" + + locus_chr = line[16] + locus_mb = line[17] + + 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['additive'] = "N/A" if line[14] != "" and line[14] != None: this_trait['additive'] = '%.3f' % line[14] this_trait['dataset_id'] = line[15] - this_trait['locus_chr'] = line[16] - this_trait['locus_mb'] = line[17] dataset_ob = SimpleNamespace( id=this_trait["dataset_id"], type="ProbeSet", species=this_trait["species"]) @@ -120,11 +131,6 @@ class GSearch: if permissions['data'] == 'no-access': continue - max_lrs_text = "N/A" - if this_trait['locus_chr'] and this_trait['locus_mb']: - max_lrs_text = f"Chr{str(this_trait['locus_chr'])}: {str(this_trait['locus_mb'])}" - this_trait['max_lrs_text'] = max_lrs_text - trait_list.append(this_trait) self.trait_count = len(trait_list) @@ -230,32 +236,38 @@ class GSearch: 'utf-8', 'replace') else: this_trait['description'] = "N/A" - if line[13] != None and line[13] != "": - this_trait['mean'] = f"{line[13]:.3f}" - else: - this_trait['mean'] = "N/A" this_trait['dataset_id'] = line[14] - this_trait['locus_chr'] = line[15] - this_trait['locus_mb'] = line[16] + + this_trait['LRS_score_repr'] = "N/A" + this_trait['additive'] = "N/A" + this_trait['mean'] = "N/A" + + if line[10] != "" and line[10] != None: + this_trait['LRS_score_repr'] = f"{line[10]:.3f}" + if line[11] != "" and line[11] != None: + this_trait['additive'] = f"{line[11]:.3f}" + if line[13] != "" and line[13] != None: + this_trait['mean'] = f"{line[13]:.3f}" + + locus_chr = line[16] + locus_mb = line[17] + + 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'] - else: - this_trait['pubmed_text'] = "N/A" if line[9] != "" and line[9] != None: this_trait['pubmed_link'] = webqtlConfig.PUBMEDLINK_URL % line[8] - else: - this_trait['pubmed_link'] = "N/A" if line[12]: this_trait['display_name'] = line[12] + \ "_" + str(this_trait['name']) - this_trait['LRS_score_repr'] = "N/A" - if line[10] != "" and line[10] != None: - this_trait['LRS_score_repr'] = '%3.1f' % line[10] - this_trait['additive'] = "N/A" - if line[11] != "" and line[11] != None: - this_trait['additive'] = '%.3f' % line[11] dataset_ob = SimpleNamespace(id=this_trait["dataset_id"], type="Publish", species=this_trait["species"]) permissions = check_resource_availability(dataset_ob, this_trait['name']) @@ -266,14 +278,6 @@ class GSearch: if permissions['data'] == 'no-access': continue - this_trait['max_lrs_text'] = "N/A" - if this_trait['dataset'] == this_trait['group'] + "Publish": - try: - if this_trait['locus_chr'] and this_trait['locus_mb']: - this_trait['max_lrs_text'] = f"Chr{str(this_trait['locus_chr'])}: {str(this_trait['locus_mb'])}" - except: - this_trait['max_lrs_text'] = "N/A" - trait_list.append(this_trait) self.trait_count = len(trait_list) -- cgit v1.2.3 From a32988be49cb84834b24029224b9507e48b4241d Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 3 Jun 2021 20:27:30 +0000 Subject: Implemented Scroller with gene global search; for the time being this disables the server-side processing, since that was assuming pagination and caused slow-downs when scrolling or sorting (likely because it's acting as if the full list of results are one page) --- wqflask/wqflask/templates/gsearch_gene.html | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index 48953d98..5d2260c1 100644 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -48,6 +48,7 @@ {% block js %} + @@ -66,6 +67,10 @@ }; + + -- cgit v1.2.3 From 792095994bcc999779235bb953e85430f5073552 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 3 Jun 2021 20:41:05 +0000 Subject: Changed gsearch_pheno template to use Scroller and also set column widths --- wqflask/wqflask/templates/gsearch_pheno.html | 58 ++++++++++++++-------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html index af9740ae..5f1465d7 100644 --- a/wqflask/wqflask/templates/gsearch_pheno.html +++ b/wqflask/wqflask/templates/gsearch_pheno.html @@ -48,6 +48,7 @@ {% block js %} + @@ -66,6 +67,10 @@ }; + + -- cgit v1.2.3 From 91ca999f8d24ab135d3fa31bbbbd97cd0648889c Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 3 Jun 2021 20:41:43 +0000 Subject: Change LRS scores of 0.000 to N/A since they're listed wrong in the DB + fix issue where locus_chr and locus_mb pointing to the wrong positions in the query results --- wqflask/wqflask/gsearch.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index e541b705..2516e4fb 100644 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -244,13 +244,16 @@ class GSearch: if line[10] != "" and line[10] != None: this_trait['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 line[11] != "" and line[11] != None: this_trait['additive'] = f"{line[11]:.3f}" if line[13] != "" and line[13] != None: this_trait['mean'] = f"{line[13]:.3f}" - locus_chr = line[16] - locus_mb = line[17] + locus_chr = line[15] + locus_mb = line[16] max_lrs_text = "N/A" if locus_chr and locus_mb: -- cgit v1.2.3 From ad6a034b1acfd95d6bb25d15aeb865e399fe52d0 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 4 Jun 2021 05:46:33 +0000 Subject: Set widths for column in gene global search + set min-width for table as a whole --- wqflask/wqflask/templates/gsearch_gene.html | 33 +++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index 5d2260c1..8ff36c1b 100644 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -7,7 +7,7 @@ {% block content %} -
Loading... |
@@ -156,9 +156,10 @@
},
'data': trait_list,
'columns': [
- {
- 'data': null,
+ {
'orderDataType': "dom-checkbox",
+ 'width': "25px",
+ 'data': null,
'render': function(data, type, row, meta) {
return ''
}
@@ -166,45 +167,53 @@
{
'title': "Index",
'type': "natural",
+ 'width': "30px",
'data': "index"
},
{
'title': "Record",
'type': "natural",
- 'data': null,
'orderDataType': "dom-inner-text",
+ 'width': "60px",
+ 'data': null,
'render': function(data, type, row, meta) {
return '' + data.name + ''
}
},
{
'title': "Species",
- 'type': "natural",
+ 'type': "natural",
+ 'width': "60px",
'data': "species"
},
{
'title': "Group",
'type': "natural",
+ 'width': "150px",
'data': "group"
},
{
'title': "Tissue",
'type': "natural",
+ 'width': "150px",
'data': "tissue"
},
{
'title': "Dataset",
'type': "natural",
+ 'width': "300px",
'data': "dataset_fullname"
},
{
'title': "Symbol",
'type': "natural",
+ 'width': "60px",
'data': "symbol"
},
{
'title': "Description",
'type': "natural",
+ 'width': "300px",
'data': null,
'render': function(data, type, row, meta) {
try {
@@ -217,25 +226,27 @@
{
'title': "Location",
'type': "natural-minus-na",
- 'width': "100px",
+ 'width': "125px",
'data': "location_repr"
},
{
'title': "Mean",
'type': "natural-minus-na",
- 'data': "mean",
- 'orderSequence': [ "desc", "asc"]
+ 'orderSequence': [ "desc", "asc"],
+ 'width': "30px",
+ 'data': "mean"
},
{
'title': "Max