aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/search_results.py33
-rw-r--r--wqflask/wqflask/static/packages/bootstrap/css/docs.css2
-rw-r--r--wqflask/wqflask/templates/search_result_page.html269
-rw-r--r--wqflask/wqflask/views.py2
4 files changed, 106 insertions, 200 deletions
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 %}
<!-- Start of body -->
- <TR>
- <TD bgColor=#eeeeee class="solidBorder">
- <Table width= "100%" cellSpacing=0 cellPadding=5>
- <TR>
- <TD valign="top" height="200" width="100%" bgcolor="#eeeeee">
- <P class="title">Search Results</P>
- <BLOCKQUOTE>GeneNetwork searched:
- <a href="/dbdoc/{{dataset.fullname}}">{{ dataset.fullname }}</a>
- <br />
-
- For all records that match:
- <ul>
- {% if search_terms %}
- <li>
- {% for word in search_terms %}
- <strong>{{word.search_term}}</strong> {% if not loop.last %} or {% endif %}
- {% endfor %}
- </li>
- {% endif %}
- </ul>
+ <header class="jumbotron subhead" id="overview">
+ <div class="container">
+ <h1>Search Results</h1>
+ <p class="lead">
+ GeneNetwork found {{ numify(results|count, "record", "records") }}.
+ </p>
+ </div>
+ </header>
- <P>GeneNetwork found <strong>{{ numify(results|count, "record", "records") }}</strong>.</P>
-
- <P>To study a record, click on its ID below.</P>
-
- <P>To add one or more records to your Selection window, use the checkbox and then click the <STRONG>Add to Collection</STRONG> button.</P>
- </BLOCKQUOTE>
- <FORM METHOD="GET" ACTION="/search" ENCTYPE="multipart/form-data" NAME="show_trait">
-
- <INPUT TYPE="hidden" NAME="database" VALUE="_">
- <INPUT TYPE="hidden" NAME="incparentsf1" VALUE="ON">
- <INPUT TYPE="hidden" NAME="FormID" VALUE="showDatabase">
- <INPUT TYPE="hidden" NAME="ProbeSetID" VALUE="_">
- <INPUT TYPE="hidden" NAME="RISet" VALUE="BXD">
- <INPUT TYPE="hidden" NAME="CellID" VALUE="_">
- <P>
- <TABLE border="0" cellpadding="0" cellspacing="2" width="100%">
- <TR>
- <TD>
- <TABLE border="0" cellpadding="0" cellspacing="2" width="20%">
- <TR>
- <TD width="25%">
- <A HREF="#" onClick="checkAll(document.getElementsByName('show_trait')[0]);">
- <IMG src="/images/select_all2_final.jpg" alt="Select All" name="selectall" style="border:none;" title="Select All"></A>
- </TD>
- <TD width="25%">
- <A HREF="#" onClick="checkNone(document.getElementsByName('show_trait')[0]);">
- <IMG src="/images/select_none2_final.jpg" alt="Select None" style="border:none;" title="Select None">
- </A>
- </TD>
- <TD width="25%">
- <A HREF="#" onClick="checkInvert(document.getElementsByName('show_trait')[0]);">
- <IMG src="/images/invert_selection2_final.jpg" alt="Invert Selection" name="selectinvert" style="border:none;" title="Invert Selection">
- </A>
- </TD>
- <TD width="25%">
- <A HREF="#">
- <IMG src="/images/add_collection1_final.jpg" alt="Add To Collection" name="addselect" style="border:none;" title="Add To Collection">
- </A>
- </TD>
- </TR>
- <TR>
- <TD width="25%">&nbsp;&nbsp;Select</TD>
- <TD width="255">&nbsp;Deselect</TD>
- <TD width="25%">&nbsp;&nbsp;&nbsp;Invert</TD>
- <TD width="25%">&nbsp;&nbsp;&nbsp;&nbsp;Add</TD>
- </TR></TABLE>
- </TD>
- </TR>
- <TR>
- <TD height="40">
- <INPUT TYPE="button" NAME="Default_Name" class="button" VALUE="Download Table" onClick="location.href='/tmp/Search_fYr7h2Hn.xls'">
- </TD>
- </TR>
- <TR>
- <TD>
- <DIV id="sortable">
- <TABLE class="collap b2" cellpadding="5" cellspacing="1">
- <TR>
- <TD class="fs13 fwb ffl b1 cw cbrb" nowrap="ON">
- </TD>
- <TD class="fs13 fwb ffl b1 cw cbrb">
- Record
- <BR>ID<BR>
- <DIV style="float: bottom;">
- <A HREF="javascript:xmlhttpPost('/webqtl/main.py?FormID=AJAX_table', 'sortable', 'sort=record_id&order=up&file=Search_fYr7h2Hn&tableID=sortable&addIndex=1&hiddenColumns=')">
- <IMG src="/images/sortup.gif" alt="sortup.gif" border="0">
- </A>
- <A HREF="javascript:xmlhttpPost('/webqtl/main.py?FormID=AJAX_table', 'sortable', 'sort=record_id&order=down&file=Search_fYr7h2Hn&tableID=sortable&addIndex=1&hiddenColumns=')">
- <IMG src="/images/sortdown.gif" alt="sortdown.gif" border="0">
- </A>
- </DIV>
- </TD>
- <TD class="fs13 fwb ffl b1 cw cbrb">
- Symbol<BR><BR>
- <DIV style="float: bottom;">
- <IMG src="/images/sortupon.gif" alt="sortupon.gif" border="0">
- <A HREF="javascript:xmlhttpPost('/webqtl/main.py?FormID=AJAX_table', 'sortable', 'sort=symbol&order=down&file=Search_fYr7h2Hn&tableID=sortable&addIndex=1&hiddenColumns=')">
- <IMG src="/images/sortdown.gif" alt="sortdown.gif" border="0">
- </A>
- </DIV>
- </TD>
- <TD class="fs13 fwb ffl b1 cw cbrb">
- Description<BR><BR>
- <DIV style="float: bottom;">
- <A HREF="javascript:xmlhttpPost('/webqtl/main.py?FormID=AJAX_table', 'sortable', 'sort=desc&order=up&file=Search_fYr7h2Hn&tableID=sortable&addIndex=1&hiddenColumns=')">
- <IMG src="/images/sortup.gif" alt="sortup.gif" border="0">
- </A>
- <A HREF="javascript:xmlhttpPost('/webqtl/main.py?FormID=AJAX_table', 'sortable', 'sort=desc&order=down&file=Search_fYr7h2Hn&tableID=sortable&addIndex=1&hiddenColumns=')">
- <IMG src="/images/sortdown.gif" alt="sortdown.gif" border="0">
- </A>
- </DIV>
- </TD>
- <TD class="fs13 fwb ffl b1 cw cbrb">Location<BR>Chr and Mb<BR>
- <DIV style="float: bottom;">
- <A HREF="javascript:xmlhttpPost('/webqtl/main.py?FormID=AJAX_table', 'sortable', 'sort=location&order=up&file=Search_fYr7h2Hn&tableID=sortable&addIndex=1&hiddenColumns=')">
- <IMG src="/images/sortup.gif" alt="sortup.gif" border="0">
- </A>
- <A HREF="javascript:xmlhttpPost('/webqtl/main.py?FormID=AJAX_table', 'sortable', 'sort=location&order=down&file=Search_fYr7h2Hn&tableID=sortable&addIndex=1&hiddenColumns=')">
- <IMG src="/images/sortdown.gif" alt="sortdown.gif" border="0">
- </A>
- </DIV>
- </TD>
- <TD class="fs13 fwb ffl b1 cw cbrb">Mean<BR>Expr<BR>
- <DIV style="float: bottom;">
- <A HREF="javascript:xmlhttpPost('/webqtl/main.py?FormID=AJAX_table', 'sortable', 'sort=mean&order=up&file=Search_fYr7h2Hn&tableID=sortable&addIndex=1&hiddenColumns=')">
- <IMG src="/images/sortup.gif" alt="sortup.gif" border="0">
- </A>
- <A HREF="javascript:xmlhttpPost('/webqtl/main.py?FormID=AJAX_table', 'sortable', 'sort=mean&order=down&file=Search_fYr7h2Hn&tableID=sortable&addIndex=1&hiddenColumns=')">
- <IMG src="/images/sortdown.gif" alt="sortdown.gif" border="0">
- </A>
- </DIV>
- </TD>
- <TD class="fs13 fwb ffl b1 cw cbrb" nowrap="ON">Max<BR>LRS<BR>
- <DIV style="float: bottom;">
- <A HREF="javascript:xmlhttpPost('/webqtl/main.py?FormID=AJAX_table', 'sortable', 'sort=lrs&order=up&file=Search_fYr7h2Hn&tableID=sortable&addIndex=1&hiddenColumns=')">
- <IMG src="/images/sortup.gif" alt="sortup.gif" border="0">
- </A>
- <A HREF="javascript:xmlhttpPost('/webqtl/main.py?FormID=AJAX_table', 'sortable', 'sort=lrs&order=down&file=Search_fYr7h2Hn&tableID=sortable&addIndex=1&hiddenColumns=')">
- <IMG src="/images/sortdown.gif" alt="sortdown.gif" border="0">
- </A>
- </DIV>
- </TD>
- <TD class="fs13 fwb ffl b1 cw cbrb" nowrap="ON">Max LRS Location<BR>Chr and Mb<BR>
- <DIV style="float: bottom;">
- <A HREF="javascript:xmlhttpPost('/webqtl/main.py?FormID=AJAX_table', 'sortable', 'sort=lrs_location&order=up&file=Search_fYr7h2Hn&tableID=sortable&addIndex=1&hiddenColumns=')">
- <IMG src="/images/sortup.gif" alt="sortup.gif" border="0">
- </A>
- <A HREF="javascript:xmlhttpPost('/webqtl/main.py?FormID=AJAX_table', 'sortable', 'sort=lrs_location&order=down&file=Search_fYr7h2Hn&tableID=sortable&addIndex=1&hiddenColumns=')">
- <IMG src="/images/sortdown.gif" alt="sortdown.gif" border="0">
- </A>
- </DIV>
- </TD>
- </TR>
- {% for this_trait in trait_list %}
- <TR id="{{ this_trait }}">
- <TD class="fs12 fwn ffl b1 c222" nowrap="on">{{ loop.index }}
- <INPUT TYPE="checkbox" NAME="searchResult" class="checkbox" VALUE="{{ this_trait }}" onClick="highlight(this)">
- </TD>
- <TD class="stdcell">
- {# <A HREF="javascript:showDatabase3('{{ thisFormName }}','{{this_trait.db.name}}','{{ this_trait.name }}','{{ this_trait.cellid }}')" class="fs12 fwn"> - </a> #}
- <a href="{{ url_for('show_trait_page', database=this_trait.db.name, ProbeSetID=this_trait.name, incparentsf1='ON', RISet='BXD')}}" class="fs12 fwn">
- {{ this_trait.name.upper() }}
- </a>
- </TD>
- <TD class="fs12 fwn b1 c222 fsI">
- <A HREF="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=Retrieve&dopt=Graphics&list_uids={{this_trait.geneid}}" TARGET="_blank" class="font_black fs12 fwn">
- {{ this_trait.symbol }}
- </A>
- </TD>
- <TD class="stdcell">{{ this_trait.description_display }}</TD>
- <TD class="stdcell" nowrap="on">{{ this_trait.trait_location_repr }}</TD>
- <TD class="stdcell" nowrap="ON" align="right">{{ this_trait.mean }}</TD>
- <TD class="stdcell" nowrap="on" align="right">{{ this_trait.LRS_score_repr }}</TD>
- <TD class="stdcell" nowrap="on">{{ this_trait.LRS_location_repr }}</TD>
- </TR>
- {% endfor %}
- </TABLE>
- </DIV>
- </TD>
- </TR>
- </TABLE>
- <INPUT TYPE="hidden" NAME="Default_Name">
- </FORM>
- </TD>
- </TR>
- </TABLE>
- </TD>
- </TR>
+ <div class="container">
+ <div class="page-header">
+ <h1>Your Search</h1>
+ </div>
+
+ <p>We searched <a href="/dbdoc/{{dataset.fullname}}">{{ dataset.fullname }}</a><//>
+
+ <p>To find all records that match:</p>
+ <ul>
+ {% if search_terms %}
+ <li>
+ {% for word in search_terms %}
+ <strong>{{word.search_term}}</strong> {% if not loop.last %} or {% endif %}
+ {% endfor %}
+ </li>
+ {% endif %}
+ </ul>
+
+ <p>To study a record, click on its ID below.<br />
+ Check records below and click Add button to add to selection.</p>
+
+ <div class="bs-docs-example">
+ <table class="table table-hover">
+ <thead>
+ <tr>
+ {% for header in header_fields %}
+ <th>{{header}}</th>
+ {% endfor %}
+ </thead>
+
+ <tbody>
+ {% for this_trait in trait_list %}
+ <TR id="{{ this_trait }}">
+ <TD>
+ <INPUT TYPE="checkbox" NAME="searchResult" class="checkbox"
+ VALUE="{{ this_trait }}">
+ </TD>
+ <TD>
+ <a href="{{ url_for('show_trait_page',
+ database=this_trait.db.name,
+ ProbeSetID=this_trait.name, incparentsf1='ON',
+ RISet='BXD')}}">
+ {{ this_trait.name.upper() }}
+ </a>
+ </TD>
+ <TD>
+ <A HREF=
+ "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=Retrieve&dopt=Graphics&list_uids={{this_trait.geneid}}" TARGET="_blank">
+ {{ this_trait.symbol }}
+ </A>
+ </TD>
+ <TD>{{ this_trait.description_display }}</TD>
+ <TD>{{ this_trait.trait_location_repr }}</TD>
+ <TD>{{ this_trait.mean }}</TD>
+ <TD>{{ this_trait.LRS_score_repr }}</TD>
+ <TD>{{ this_trait.LRS_location_repr }}</TD>
+ </TR>
+ {% endfor %}
+ </tbody>
+
+ </table>
+
+ <br />
+
+ <button class="btn"><i class="icon-ok"></i> Select</button>
+ <button class="btn"><i class="icon-remove"></i> Deselect</button>
+ <button class="btn"><i class="icon-resize-vertical"></i> Invert</button>
+ <button class="btn"><i class="icon-plus-sign"></i> Add</button>
+ <button class="btn btn-primary pull-right"><i class="icon-download icon-white"></i> Download Table</button>
+ </div>
+
+ </div>
+
<!-- End of body -->
{% 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__)