aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorLei Yan2015-07-31 18:53:36 +0000
committerLei Yan2015-07-31 18:53:36 +0000
commit505cc52b2c0b7afb8e1b3c3e414ef68632f5e518 (patch)
tree557d0461640c2c72132c6f59362d7ba7c18759b4 /wqflask
parent0682e3c081932c77cb4cbf856e41a9735bd09276 (diff)
downloadgenenetwork2-505cc52b2c0b7afb8e1b3c3e414ef68632f5e518.tar.gz
Committer: Lei Yan <lei@penguin.uthsc.edu>
On branch master
Diffstat (limited to 'wqflask')
-rwxr-xr-xwqflask/wqflask/gsearch.py21
-rwxr-xr-xwqflask/wqflask/templates/gsearch_pheno.html38
2 files changed, 39 insertions, 20 deletions
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py
index dd0815b1..396da4cf 100755
--- a/wqflask/wqflask/gsearch.py
+++ b/wqflask/wqflask/gsearch.py
@@ -1,6 +1,9 @@
from __future__ import absolute_import, print_function, division
from flask import Flask, g
+from base.data_set import create_dataset
+from base.trait import GeneralTrait
+from dbFunction import webqtlDatabaseFunction
class GSearch(object):
@@ -41,6 +44,7 @@ class GSearch(object):
SELECT
Species.`Name`,
InbredSet.`Name`,
+ PublishFreeze.`Name`,
PublishXRef.`Id`,
Phenotype.`Post_publication_description`,
Publication.`Authors`,
@@ -48,8 +52,9 @@ class GSearch(object):
PublishXRef.`LRS`,
PublishXRef.`Locus`,
PublishXRef.`additive`
- FROM Species,InbredSet,PublishXRef,Phenotype,Publication
+ FROM Species,InbredSet,PublishFreeze,PublishXRef,Phenotype,Publication
WHERE PublishXRef.`InbredSetId`=InbredSet.`Id`
+ AND PublishFreeze.`InbredSetId`=InbredSet.`Id`
AND InbredSet.`SpeciesId`=Species.`Id`
AND PublishXRef.`PhenotypeId`=Phenotype.`Id`
AND PublishXRef.`PublicationId`=Publication.`Id`
@@ -63,6 +68,16 @@ class GSearch(object):
OR Publication.Title REGEXP "[[:<:]]%s[[:>:]]"
OR Publication.Authors REGEXP "[[:<:]]%s[[:>:]]"
OR PublishXRef.Id REGEXP "[[:<:]]%s[[:>:]]")
- ORDER BY Species.`Name`, InbredSet.`Name`, Phenotype.`Post_publication_description`
+ ORDER BY Species.`Name`, InbredSet.`Name`, PublishXRef.`Id`
+ LIMIT 1000
""" % (self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms)
- self.results = g.db.execute(sql).fetchall()
+ re = g.db.execute(sql).fetchall()
+ self.trait_list = []
+ for line in re:
+ dataset = create_dataset(line[2], "Publish")
+ trait_id = line[3]
+ this_trait = GeneralTrait(dataset=dataset, name=trait_id, get_qtl_info=True)
+ self.trait_list.append(this_trait)
+ species = webqtlDatabaseFunction.retrieve_species(dataset.group.name)
+ dataset.get_trait_info([this_trait], species)
+
diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html
index f6b6efa3..8701673f 100755
--- a/wqflask/wqflask/templates/gsearch_pheno.html
+++ b/wqflask/wqflask/templates/gsearch_pheno.html
@@ -23,33 +23,37 @@
<button class="btn btn-primary pull-right"><span class="glyphicon glyphicon-download"></span> Download Table</button>
<br />
<br />
- <table class="table table-hover table-striped" id="trait_table">
+ <table class="table table-hover table-striped" id='trait_table' style="float: left;">
<thead>
<tr>
- <th>Index</th>
+ <th>Index</th>
<th>Species</th>
<th>Group</th>
- <th>Record ID</th>
- <th>Phenotype</th>
- <th>Authors</th>
- <th>Year</th>
- <th>Max LRS</th>
- <th>Locus</th>
- <th>Additive</th>
+ <th>Record</th>
+ <th>Description</th>
+ <th>Authors</th>
+ <th>Year</th>
+ <th style="text-align: right;">Max&nbsp;&nbsp;<br>LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th>
+ <th>Max LRS Location</th>
+ <th style="text-align: right;">Additive<br>Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th>
</tr>
</thead>
-
<tbody>
- {% for this_trait in results %}
- <TR>
- <td><input type="checkbox">{{ loop.index }}</td>
- {% for item in this_trait %}
- <TD>{{ item }}</TD>
- {% endfor %}
+ {% for this_trait in trait_list %}
+ <TR id="trait:{{ this_trait.name }}:{{ this_trait.dataset.name }}">
+ <TD>{{ loop.index }}<INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" VALUE="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}"></TD>
+ <TD>{{ this_trait.dataset.group.species }}</TD>
+ <TD>{{ this_trait.dataset.group.name }}</TD>
+ <TD><a href="{{ url_for('show_trait_page', trait_id = this_trait.name, dataset = this_trait.dataset.name)}}">{{ this_trait.name }}</a></TD>
+ <TD>{{ this_trait.description_display }}</TD>
+ <TD>{{ this_trait.authors }}</TD>
+ <TD><a href="{{ this_trait.pubmed_link }}">{{ this_trait.pubmed_text }}</a></TD>
+ <TD>{{ this_trait.LRS_score_repr }}</TD>
+ <TD>{{ this_trait.LRS_location_repr }}</TD>
+ <TD>{{ '%0.3f' % this_trait.additive|float }}</TD>
</TR>
{% endfor %}
</tbody>
-
</table>
</div>
</div>