From 4353a903c4661f5c12c4d653044122cf59ef373a Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Fri, 26 Oct 2012 18:27:22 -0500 Subject: Changed search page appearance using bootstrap Headers/information displays correctly for single mRNA expression trait searches --- wqflask/wqflask/search_results.py | 33 ++- .../wqflask/static/packages/bootstrap/css/docs.css | 2 +- wqflask/wqflask/templates/search_result_page.html | 269 +++++++-------------- wqflask/wqflask/views.py | 2 +- 4 files changed, 106 insertions(+), 200 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index 8fc12b16..a2b0596c 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -182,6 +182,14 @@ class SearchResultPage(templatePage): 'GenbankId', 'UniGeneId', 'RefSeq_TranscriptId'] + self.header_fields = ['', + 'ID', + 'Symbol', + 'Description', + 'Location', + 'Mean Expr', + 'Max LRS', + 'Max LRS Location'] elif self.dataset.type == "Geno": self.search_fields = ['Name','Chr'] @@ -693,8 +701,7 @@ class SearchResultPage(templatePage): and ProbeSetXRef.ProbeSetFreezeId = %s """ % (self.db_conn.escape_string(search_term), self.db_conn.escape_string(str(self.dataset.id)))) - - print("query is:", query) + self.cursor.execute(query) #print("query is:", pf(self.query)) @@ -1252,19 +1259,25 @@ class SearchResultPage(templatePage): else: trait_location_value = ord(str(this_trait.chr).upper()[0])*1000 + this_trait.mb - trait_location_repr = 'Chr%s: %.6f' % (this_trait.chr, float(this_trait.mb) ) + trait_location_repr = 'Chr %s: %.4f Mb' % (this_trait.chr, float(this_trait.mb) ) this_trait.trait_location_repr = trait_location_repr #this_trait.trait_location_value = trait_location_value tr.append(TDCell(HT.TD(trait_location_repr, Class=className, nowrap="on"), trait_location_repr, trait_location_value)) #XZ, 01/12/08: This SQL query is much faster. - self.cursor.execute(""" - select ProbeSetXRef.mean from ProbeSetXRef, ProbeSet - where ProbeSetXRef.ProbeSetFreezeId = %d and - ProbeSet.Id = ProbeSetXRef.ProbeSetId and - ProbeSet.Name = '%s' - """ % (this_trait.db.id, this_trait.name)) + query = ( +"""select ProbeSetXRef.mean from ProbeSetXRef, ProbeSet + where ProbeSetXRef.ProbeSetFreezeId = %s and + ProbeSet.Id = ProbeSetXRef.ProbeSetId and + ProbeSet.Name = '%s' + """ % (self.db_conn.escape_string(str(this_trait.db.id)), + self.db_conn.escape_string(this_trait.name))) + + print("query is:", pf(query)) + + self.cursor.execute(query) result = self.cursor.fetchone() + if result: if result[0]: mean = result[0] @@ -1310,7 +1323,7 @@ class SearchResultPage(templatePage): this_trait.LRS_score_repr = LRS_score_repr = '%3.1f' % this_trait.lrs this_trait.LRS_score_value = LRS_score_value = this_trait.lrs - this_trait.LRS_location_repr = LRS_location_repr = 'Chr%s: %.6f' % (LRS_Chr, float(LRS_Mb) ) + this_trait.LRS_location_repr = LRS_location_repr = 'Chr %s: %.4f Mb' % (LRS_Chr, float(LRS_Mb) ) LRS_flag = 0 #tr.append(TDCell(HT.TD(HT.Href(text=LRS_score_repr,url="javascript:showIntervalMapping('%s', '%s : %s')" % (formName, this_trait.db.shortname, this_trait.name), Class="fs12 fwn"), Class=className, align='right', nowrap="on"),LRS_score_repr, LRS_score_value)) diff --git a/wqflask/wqflask/static/packages/bootstrap/css/docs.css b/wqflask/wqflask/static/packages/bootstrap/css/docs.css index a6fff3c3..7efd72cd 100644 --- a/wqflask/wqflask/static/packages/bootstrap/css/docs.css +++ b/wqflask/wqflask/static/packages/bootstrap/css/docs.css @@ -560,7 +560,7 @@ h2 + .row { /* Echo out a label for the example */ .bs-docs-example:after { - content: "Example"; + content: "Results"; position: absolute; top: -1px; left: -1px; diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 06458818..abf2dba7 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -2,195 +2,88 @@ {% block title %}Search Results{% endblock %} {% block content %} -
- Search Results -GeneNetwork searched: - {{ dataset.fullname }} -- - |
-
We searched {{ dataset.fullname }}/> + +
To find all records that match:
+To study a record, click on its ID below.
+ Check records below and click Add button to add to selection.
{{header}} | + {% endfor %} +|||||||
---|---|---|---|---|---|---|---|
+ + | ++ + {{ this_trait.name.upper() }} + + | ++ + {{ this_trait.symbol }} + + | +{{ this_trait.description_display }} | +{{ this_trait.trait_location_repr }} | +{{ this_trait.mean }} | +{{ this_trait.LRS_score_repr }} | +{{ this_trait.LRS_location_repr }} | +