From 505cc52b2c0b7afb8e1b3c3e414ef68632f5e518 Mon Sep 17 00:00:00 2001 From: Lei Yan Date: Fri, 31 Jul 2015 18:53:36 +0000 Subject: Committer: Lei Yan On branch master --- wqflask/wqflask/gsearch.py | 21 ++++++++++++--- wqflask/wqflask/templates/gsearch_pheno.html | 38 +++++++++++++++------------- 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 @@

- +
- + - - - - - - - + + + + + + + - - {% for this_trait in results %} - - - {% for item in this_trait %} - - {% endfor %} + {% for this_trait in trait_list %} + + + + + + + + + + + {% endfor %} -
IndexIndex Species GroupRecord IDPhenotypeAuthorsYearMax LRSLocusAdditiveRecordDescriptionAuthorsYearMax  
LRS ?
Max LRS LocationAdditive
Effect ?
{{ loop.index }}{{ item }}
{{ loop.index }}{{ this_trait.dataset.group.species }}{{ this_trait.dataset.group.name }}{{ this_trait.name }}{{ this_trait.description_display }}{{ this_trait.authors }}{{ this_trait.pubmed_text }}{{ this_trait.LRS_score_repr }}{{ this_trait.LRS_location_repr }}{{ '%0.3f' % this_trait.additive|float }}
-- cgit v1.2.3