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 }} -
- - For all records that match: -
    - {% if search_terms %} -
  • - {% for word in search_terms %} - {{word.search_term}} {% if not loop.last %} or {% endif %} - {% endfor %} -
  • - {% endif %} -
+
+
+

Search Results

+

+ GeneNetwork found {{ numify(results|count, "record", "records") }}. +

+
+
-

GeneNetwork found {{ numify(results|count, "record", "records") }}.

- -

To study a record, click on its ID below.

- -

To add one or more records to your Selection window, use the checkbox and then click the Add to Collection button.

-
-
- - - - - - - -

- - - - - - - - - - -
- - - - - - - - - - - - -
- - Select All - - - Select None - - - - Invert Selection - - - - Add To Collection - -
  Select Deselect   Invert    Add
-
- -
-
- - - - - - - - - - - - {% for this_trait in trait_list %} - - - - - - - - - - - {% endfor %} -
- - Record -
ID
- -
- Symbol

-
- sortupon.gif - - sortdown.gif - -
-
- Description

- -
Location
Chr and Mb
- -
Mean
Expr
- -
Max
LRS
- -
Max LRS Location
Chr and Mb
- -
{{ loop.index }} - - - {# - #} - - {{ 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 }}
-
-
- -

-
- - +
+ + +

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.

+ +
+ + + + {% for header in header_fields %} + + {% endfor %} + + + + {% for this_trait in trait_list %} + + + + + + + + + + + {% endfor %} + + +
{{header}}
+ + + + {{ 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 }}
+ +
+ + + + + + +
+ +
+ {% endblock %} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index dd95f7ca..41d1d714 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -64,7 +64,7 @@ def search_page(): print("calling search_results.SearchResultPage") the_search = search_results.SearchResultPage(request.args) print("template_vars is:", pf(the_search.__dict__)) - print("trait_list is:", pf(the_search.__dict__['trait_list'][0].__dict__)) + #print("trait_list is:", pf(the_search.__dict__['trait_list'][0].__dict__)) return render_template("search_result_page.html", **the_search.__dict__) -- cgit v1.2.3