aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wqflask/wqflask/do_search.py90
-rw-r--r--wqflask/wqflask/parser.py10
-rw-r--r--wqflask/wqflask/search_results.py217
-rw-r--r--wqflask/wqflask/templates/search_result_page.html34
4 files changed, 126 insertions, 225 deletions
diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py
index ac6014e7..61bfbaba 100644
--- a/wqflask/wqflask/do_search.py
+++ b/wqflask/wqflask/do_search.py
@@ -7,19 +7,18 @@ from pprint import pformat as pf
from dbFunction import webqtlDatabaseFunction
-
class DoSearch(object):
"""Parent class containing parameters/functions used for all searches"""
-
+
# Used to translate search phrases into classes
search_types = dict()
-
+
def __init__(self, search_term, dataset, cursor, db_conn):
self.search_term = search_term
self.dataset = dataset
self.db_conn = db_conn
self.cursor = cursor
-
+
#Get group information for dataset and the species id
self.dataset.get_group()
self.species_id = webqtlDatabaseFunction.retrieveSpeciesId(self.cursor, self.dataset.group)
@@ -40,7 +39,7 @@ class DoSearch(object):
"""Strips out newlines/extra spaces and replaces them with just spaces"""
step_one = " ".join(stringy.split())
return step_one
-
+
@classmethod
def get_search(cls, search_type):
return cls.search_types[search_type]
@@ -48,9 +47,9 @@ class DoSearch(object):
class ProbeSetSearch(DoSearch):
"""A search within an mRNA expression dataset"""
-
+
DoSearch.search_types['ProbeSet'] = "ProbeSetSearch"
-
+
base_query = """SELECT ProbeSet.Name as TNAME,
0 as thistable,
ProbeSetXRef.Mean as TMEAN,
@@ -63,9 +62,10 @@ class ProbeSetSearch(DoSearch):
FROM ProbeSetXRef, ProbeSet """
- def compile_final_query(self, from_clause, where_clause):
+ def compile_final_query(self, from_clause = '', where_clause = ''):
"""Generates the final query string"""
+ from_clause = ''
from_clause = self.normalize_spaces(from_clause)
query = (self.base_query +
@@ -78,12 +78,12 @@ class ProbeSetSearch(DoSearch):
self.escape(self.dataset.id)))
print("query is:", pf(query))
-
+
return query
def run(self):
"""Generates and runs a simple search of an mRNA expression dataset"""
-
+
print("Running ProbeSetSearch")
query = (self.base_query +
"""WHERE (MATCH (ProbeSet.Name,
@@ -106,9 +106,9 @@ class ProbeSetSearch(DoSearch):
class PhenotypeSearch(DoSearch):
"""A search within a phenotype dataset"""
-
+
DoSearch.search_types['Publish'] = "PhenotypeSearch"
-
+
base_query = """SELECT PublishXRef.Id,
PublishFreeze.createtime as thistable,
Publication.PubMed_ID as Publication_PubMed_ID,
@@ -125,7 +125,7 @@ class PhenotypeSearch(DoSearch):
'Publication.Title',
'Publication.Authors',
'PublishXRef.Id')
-
+
def get_where_clause(self):
"""Generate clause for WHERE portion of query"""
@@ -140,7 +140,7 @@ class PhenotypeSearch(DoSearch):
for field in self.search_fields:
where_clause.append('''%s REGEXP "%s"''' % (field, search_term))
where_clause = "(%s)" % ' OR '.join(where_clause)
-
+
return where_clause
def run(self):
@@ -164,7 +164,7 @@ class PhenotypeSearch(DoSearch):
class GenotypeSearch(DoSearch):
"""A search within a genotype dataset"""
-
+
DoSearch.search_types['Geno'] = "GenotypeSearch"
base_query = """SELECT Geno.Name,
@@ -185,7 +185,8 @@ class GenotypeSearch(DoSearch):
where_clause = []
for field in self.search_fields:
where_clause.append('''%s REGEXP "%s"''' % ("%s.%s" % (self.dataset.type, field),
- self.search_term))
+ self.escape(self.search_term)))
+ print("where_clause is:", pf(where_clause))
where_clause = "(%s)" % ' OR '.join(where_clause)
return where_clause
@@ -209,7 +210,7 @@ class GenotypeSearch(DoSearch):
class RifSearch(ProbeSetSearch):
"""Searches for traits with a Gene RIF entry including the search term."""
-
+
DoSearch.search_types['RIF'] = "RifSearch"
def run(self):
@@ -224,9 +225,9 @@ class RifSearch(ProbeSetSearch):
class WikiSearch(ProbeSetSearch):
"""Searches GeneWiki for traits other people have annotated"""
-
+
DoSearch.search_types['WIKI'] = "WikiSearch"
-
+
def run(self):
where_clause = """%s.symbol = GeneRIF.symbol
and GeneRIF.versionId=0 and GeneRIF.display>0
@@ -259,43 +260,44 @@ class GoSearch(ProbeSetSearch):
from_clause = """ , db_GeneOntology.term as GOterm,
db_GeneOntology.association as GOassociation,
db_GeneOntology.gene_product as GOgene_product """
-
+
query = self.compile_final_query(from_clause, where_clause)
return self.execute(query)
+#ZS: Not sure what the best way to deal with LRS searches is
class LrsSearch(ProbeSetSearch):
"""Searches for genes with a QTL within the given LRS values
-
+
LRS searches can take 2 different forms:
- LRS=(min_LRS max_LRS)
- LRS=(min_LRS max_LRS chromosome start_Mb end_Mb)
where min/max_LRS represent the range of LRS scores and start/end_Mb represent
the range in megabases on the given chromosome
-
+
"""
-
+
DoSearch.search_types['LRS'] = 'LrsSearch'
class CisLrsSearch(LrsSearch):
"""Searches for genes on a particular chromosome with a cis-eQTL within the given LRS values
-
+
A cisLRS search can take 2 forms:
- cisLRS=(min_LRS max_LRS)
- cisLRS=(min_LRS max_LRS mb_buffer)
where min/max_LRS represent the range of LRS scores and the mb_buffer is the range around
a particular QTL where its eQTL would be considered "cis". If there is no third parameter,
mb_buffer will default to 5 megabases.
-
+
A QTL is a cis-eQTL if a gene's expression is regulated by a QTL in roughly the same area
(where the area is determined by the mb_buffer that the user can choose).
-
+
"""
-
+
# This is tentatively a child of LrsSearch; I'll need to check what code, if any, overlaps
# between this and the LrsSearch code. In the original code, commands are divided by
# the number of inputs they take, so these commands are completely separate
-
+
DoSearch.search_types['CISLRS'] = "CisLrsSearch"
def run(self):
@@ -318,27 +320,28 @@ class CisLrsSearch(LrsSearch):
self.dataset.type,
min_threshold
)
-
else:
- NeedSomeErrorHere
+ NeedSomeErrorHere
- return None
+ query = self.compile_final_query(where_clause)
+
+ return self.execute(query)
class TransLrsSearch(LrsSearch):
"""Searches for genes on a particular chromosome with a cis-eQTL within the given LRS values
-
+
A transLRS search can take 2 forms:
- transLRS=(min_LRS max_LRS)
- transLRS=(min_LRS max_LRS mb_buffer)
where min/max_LRS represent the range of LRS scores and the mb_buffer is the range around
a particular QTL where its eQTL would be considered "cis". If there is no third parameter,
mb_buffer will default to 5 megabases.
-
+
A QTL is a trans-eQTL if a gene's expression is regulated by a QTL in a different location/area
(where the area is determined by the mb_buffer that the user can choose). Opposite of cis-eQTL.
-
+
"""
-
+
# This is tentatively a child of LrsSearch; I'll need to check what code, if any, overlaps
# between this and the LrsSearch code. In the original code, commands are divided by
# the number of inputs they take, so these commands are completely separate
@@ -370,8 +373,8 @@ class TransLrsSearch(LrsSearch):
NeedSomeErrorHere
return None
-
-
+
+
#itemCmd = item[0]
#lowerLimit = float(item[1])
#upperLimit = float(item[2])
@@ -402,15 +405,15 @@ class TransLrsSearch(LrsSearch):
# query.append(" (%s) " % clauseItem)
# self.orderByDefalut = itemCmd
# DescriptionText.append(HT.Span(' with ', HT.U(itemCmd), ' between %g and %g' % (min(lowerLimit, upperLimit), max(lowerLimit, upperLimit))))
-
-
+
+
class MeanSearch(ProbeSetSearch):
"""Searches for genes expressed within an interval (log2 units) determined by the user"""
-
+
DoSearch.search_types['MEAN'] = "MeanSearch"
-
+
def run(self):
-
+
return None
@@ -443,8 +446,9 @@ if __name__ == "__main__":
#results = RifSearch("diabetes", dataset, cursor, db_conn).run()
#results = WikiSearch("nicotine", dataset, cursor, db_conn).run()
results = CisLrsSearch(['9','99','10'], dataset, cursor, db_conn).run()
+ #results = TransLrsSearch(['9', '999', '10'], dataset, cursor, db_conn).run()
#results = PhenotypeSearch("brain", dataset, cursor, db_conn).run()
#results = GenotypeSearch("rs13475699", dataset, cursor, db_conn).run()
#results = GoSearch("0045202", dataset, cursor, db_conn).run()
-
+
print("results are:", pf(results)) \ No newline at end of file
diff --git a/wqflask/wqflask/parser.py b/wqflask/wqflask/parser.py
index b220f837..74343b8a 100644
--- a/wqflask/wqflask/parser.py
+++ b/wqflask/wqflask/parser.py
@@ -9,9 +9,9 @@ def parse(pstring):
pstring = re.split(r"""(?:(\w+\s*=\s*\([^)]*\))|(\w+\s*[=:]\w+)|(\w+))""", pstring)
pstring = [item.strip() for item in pstring if item and item.strip()]
print(pstring)
-
+
items = []
-
+
for item in pstring:
if ":" in item:
key, seperator, value = item.partition(':')
@@ -19,7 +19,7 @@ def parse(pstring):
key, seperator, value = item.partition('=')
else:
seperator = None
-
+
if seperator:
if '(' in value:
assert value.startswith("("), "Invalid token"
@@ -41,11 +41,11 @@ def parse(pstring):
term = dict(key=None,
seperator=None,
search_term = item)
-
+
items.append(term)
print(pf(items))
return(items)
-
+
if __name__ == '__main__':
parse("foo=(3 2 1)")
parse("shh")
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index 4aa1f2bc..dc3c72fc 100644
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -45,7 +45,6 @@ from utility import formatting
class SearchResultPage(templatePage):
maxReturn = 3000
- #NPerPage = 100
nkeywords = 0
def __init__(self, fd):
@@ -155,6 +154,13 @@ class SearchResultPage(templatePage):
'Publication.Title',
'Publication.Authors',
'PublishXRef.Id']
+ self.header_fields = ['',
+ 'ID',
+ 'Description',
+ 'Authors',
+ 'Year',
+ 'Max LRS',
+ 'Max LRS Location']
elif self.dataset.type == "ProbeSet":
self.search_fields = ['Name',
@@ -175,13 +181,19 @@ class SearchResultPage(templatePage):
'Max LRS Location']
elif self.dataset.type == "Geno":
self.search_fields = ['Name','Chr']
+ self.header_fields = ['',
+ 'ID',
+ 'Location']
self.search()
self.gen_search_result()
def gen_search_result(self):
-
+ """Get the info displayed in the search result table from the set of results computed in
+ the "search" function
+
+ """
self.trait_list = []
# result_set represents the results for each search term; a search of
# "shh grin2b" would have two sets of results, one for each term
@@ -192,52 +204,27 @@ class SearchResultPage(templatePage):
seq = 1
group = self.dataset.group
- self.form_name = form_name = 'show_dataset_'+group
- tblobj = {}
species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=group)
- #### Excel file
-
- # Todo: Replace this with official Python temp file naming functions?
- filename= webqtlUtil.genRandStr("Search_")
- #xlsUrl = HT.Input(type='button', value = 'Download Table', onClick= "location.href='/tmp/%s.xls'" % filename, Class='button')
- # Create a new Excel workbook
- #workbook = xl.Writer('%s.xls' % (webqtlConfig.TMPDIR+filename))
- #headingStyle = workbook.add_format(align = 'center', bold = 1, border = 1, size=13, fg_color = 0x1E, color="white")
-
- #XZ, 3/18/2010: pay attention to the line number of header in this file. As of today, there are 7 lines.
- #worksheet = self.createExcelFileWithTitleAndFooter(workbook=workbook, db=this_trait.db, returnNumber=len(self.trait_list))
- newrow = 7
-
- #### Excel file stuff stops
-
- if self.dataset.type == "ProbeSet":
- print("foo locals are:", locals())
- probe_set_id = result[0]
- this_trait = webqtlTrait(db=self.dataset, name=probe_set_id, cursor=self.cursor)
- this_trait.retrieveInfo(QTL=True)
- print("this_trait is:", pf(this_trait))
- self.trait_list.append(this_trait)
- #elif self.dataset.type == "Publish":
- # tblobj['body'] = self.getTableBodyForPublish(trait_list=self.trait_list, formName=mainfmName, worksheet=worksheet, species=species)
- #elif self.dataset.type == "Geno":
- # tblobj['body'] = self.getTableBodyForGeno(trait_list=self.trait_list, form_name=form_name, worksheet=worksheet)
-
- #traitForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name=thisFormName, submit=HT.Input(type='hidden'))
- hddn = {'FormID':'showDatabase','ProbeSetID':'_','database':'_','CellID':'_','group':group}
- hddn['incparentsf1']='ON'
+ #### Excel file needs to be generated ####
+
+ print("foo locals are:", locals())
+ trait_id = result[0]
+ this_trait = webqtlTrait(db=self.dataset, name=trait_id, cursor=self.cursor)
+ this_trait.retrieveInfo(QTL=True)
+ print("this_trait is:", pf(this_trait))
+ self.trait_list.append(this_trait)
if self.dataset.type == "ProbeSet":
- tblobj['body'] = self.getTableBodyForProbeSet(trait_list=self.trait_list, formName=self.form_name, species=species)
+ self.getTraitInfoForProbeSet(trait_list=self.trait_list, species=species)
elif self.dataset.type == "Publish":
- tblobj['body'] = self.getTableBodyForPublish(trait_list=self.trait_list, formName=self.form_name, species=species)
+ self.getTraitInfoForPublish(trait_list=self.trait_list, species=species)
elif self.dataset.type == "Geno":
- tblobj['body'] = self.getTableBodyForGeno(trait_list=self.trait_list, form_name=self.form_name)
+ self.getTraitInfoForGeno(trait_list=self.trait_list)
def search(self):
- print("fd.search_terms:", self.fd['search_terms'])
self.search_terms = parser.parse(self.fd['search_terms'])
print("After parsing:", self.search_terms)
@@ -267,6 +254,7 @@ class SearchResultPage(templatePage):
print("in the search results are:", self.results)
+ #ZS: This should be handled in the parser
def encregexp(self,str):
if not str:
return []
@@ -284,24 +272,12 @@ class SearchResultPage(templatePage):
return wildcardkeyword
- def getTableBodyForGeno(self, trait_list, formName=None):
-
- tblobj_body = []
-
- className = "fs12 fwn ffl b1 c222"
+ def getTraitInfoForGeno(self, trait_list):
for this_trait in trait_list:
- tr = []
-
if not this_trait.haveinfo:
this_trait.retrieveInfo()
- trId = str(this_trait)
-
- tr.append(TDCell(HT.TD(HT.Input(type="checkbox", Class="checkbox", name="searchResult",value=trId, onClick="highlight(this)"), nowrap="on", Class=className), text=trId))
-
- tr.append(TDCell(HT.TD(HT.Href(text=this_trait.name,url="javascript:showDatabase3('%s','%s','%s','')" % (formName, this_trait.db.name, this_trait.name), Class="fs12 fwn ffl"),align="left", Class=className), text=this_trait.name, val=this_trait.name.upper()))
-
#XZ: trait_location_value is used for sorting
trait_location_repr = 'N/A'
trait_location_value = 1000000
@@ -315,70 +291,37 @@ 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) )
+ this_trait.location_repr = 'Chr%s: %.4f' % (this_trait.chr, float(this_trait.mb) )
+ this_trait.location_value = trait_location_value
- tr.append(TDCell(HT.TD(trait_location_repr, Class="fs12 fwn b1 c222", nowrap="on"), trait_location_repr, trait_location_value))
- tblobj_body.append(tr)
-
- #for ncol, item in enumerate([this_trait.name, trait_location_repr]):
- # worksheet.write([newrow, ncol], item)
-
- return tblobj_body
-
-
- def getTableBodyForPublish(self, trait_list, formName=None, species=''):
-
- tblobj_body = []
-
- className = "fs12 fwn b1 c222"
+ def getTraitInfoForPublish(self, trait_list, species=''):
for this_trait in trait_list:
- tr = []
-
if not this_trait.haveinfo:
this_trait.retrieveInfo(QTL=1)
- trId = str(this_trait)
-
- tr.append(TDCell(HT.TD(HT.Input(type="checkbox", Class="checkbox", name="searchResult",value=trId, onClick="highlight(this)"), nowrap="on", Class=className), text=trId))
-
- tr.append(TDCell(HT.TD(HT.Href(text=this_trait.name,url="javascript:showDatabase3('%s','%s','%s','')" % (formName, this_trait.db.name, this_trait.name), Class="fs12 fwn"), nowrap="yes",align="center", Class=className),str(this_trait.name), this_trait.name))
-
- PhenotypeString = this_trait.post_publication_description
+ description = this_trait.post_publication_description
if this_trait.confidential:
if not webqtlUtil.hasAccessToConfidentialPhenotypeTrait(privilege=self.privilege, userName=self.userName, authorized_users=this_trait.authorized_users):
- PhenotypeString = this_trait.pre_publication_description
- tr.append(TDCell(HT.TD(PhenotypeString, Class=className), PhenotypeString, PhenotypeString.upper()))
-
- tr.append(TDCell(HT.TD(this_trait.authors, Class="fs12 fwn b1 c222 fsI"),this_trait.authors, this_trait.authors.strip().upper()))
+ description = this_trait.pre_publication_description
+ this_trait.description_display = description
try:
- PubMedLinkText = myear = repr = int(this_trait.year)
+ this_trait.pubmed_text = int(this_trait.year)
except:
- PubMedLinkText = repr = "N/A"
- myear = 0
+ this_trait.pubmed_text = "N/A"
if this_trait.pubmed_id:
- PubMedLink = HT.Href(text= repr,url= webqtlConfig.PUBMEDLINK_URL % this_trait.pubmed_id,target='_blank', Class="fs12 fwn")
- else:
- PubMedLink = repr
-
- tr.append(TDCell(HT.TD(PubMedLink, Class=className, align='center'), repr, myear))
+ this_trait.pubmed_link = webqtlConfig.PUBMEDLINK_URL % this_trait.pubmed_id
#LRS and its location
- LRS_score_repr = 'N/A'
- LRS_score_value = 0
- LRS_location_repr = 'N/A'
- LRS_location_value = 1000000
- LRS_flag = 1
-
+ this_trait.LRS_score_repr = 'N/A'
+ this_trait.LRS_score_value = 0
+ this_trait.LRS_location_repr = 'N/A'
+ this_trait.LRS_location_value = 1000000
if this_trait.lrs:
- LRS_score_repr = '%3.1f' % this_trait.lrs
- LRS_score_value = this_trait.lrs
- tr.append(TDCell(HT.TD(LRS_score_repr, Class=className), LRS_score_repr, LRS_score_value))
-
self.cursor.execute("""
select Geno.Chr, Geno.Mb from Geno, Species
where Species.Name = '%s' and
@@ -401,27 +344,14 @@ class SearchResultPage(templatePage):
else:
LRS_location_value = ord(str(LRS_chr).upper()[0])*1000 + float(LRS_Mb)
- LRS_location_repr = 'Chr%s: %.6f' % (LRS_Chr, float(LRS_Mb) )
- LRS_flag = 0
-
- tr.append(TDCell(HT.TD(LRS_location_repr, Class=className, nowrap="on"), LRS_location_repr, LRS_location_value))
-
- else:
- tr.append(TDCell(HT.TD("N/A", Class=className), "N/A", "N/A"))
- tr.append(TDCell(HT.TD("N/A", Class=className), "N/A", "N/A"))
-
- tblobj_body.append(tr)
-
- #for ncol, item in enumerate([this_trait.name, PhenotypeString, this_trait.authors, this_trait.year, this_trait.pubmed_id, LRS_score_repr, LRS_location_repr]):
- # worksheet.write([newrow, ncol], item)
+ 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: %.4f Mb' % (LRS_Chr, float(LRS_Mb) )
- return tblobj_body
+ def getTraitInfoForProbeSet(self, trait_list=None, species=''):
- def getTableBodyForProbeSet(self, trait_list=None, primaryTrait=None, formName=None, species=''):
# Note: setting trait_list to [] is probably not a great idea.
- tblobj_body = []
-
if not trait_list:
trait_list = []
@@ -435,27 +365,6 @@ class SearchResultPage(templatePage):
else:
this_trait.symbol = "N/A"
- tr = []
-
- trId = str(this_trait)
-
- #XZ, 12/08/2008: checkbox
- #tr.append(TDCell(HT.TD(HT.Input(type="checkbox", Class="checkbox", name="searchResult",value=trId, onClick="highlight(this)"), nowrap="on", Class="fs12 fwn ffl b1 c222"), text=trId))
-
- #XZ, 12/08/2008: probeset name
- #if this_trait.cellid:
- # tr.append(TDCell(HT.TD(HT.Href(text=this_trait.name, url="javascript:showDatabase3('%s','%s','%s','%s')" % (formName, this_trait.db.name,this_trait.name,this_trait.cellid), Class="fs12 fwn"), Class=className), this_trait.name, this_trait.name.upper()))
- #else:
- # tr.append(TDCell(HT.TD(HT.Href(text=this_trait.name, url="javascript:showDatabase3('%s','%s','%s','')" % (formName, this_trait.db.name,this_trait.name), Class="fs12 fwn"), Class=className), this_trait.name, this_trait.name.upper()))
- #
- #if this_trait.geneid:
- # symbolurl = HT.Href(text=this_trait.symbol,target='_blank',url="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=Retrieve&dopt=Graphics&list_uids=%s" % this_trait.geneid, Class="font_black fs12 fwn")
- #else:
- # symbolurl = HT.Href(text=this_trait.symbol,target='_blank',url="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?CMD=search&DB=gene&term=%s" % this_trait.symbol, Class="font_black fs12 fwn")
- #
- ##XZ, 12/08/2008: gene symbol
- #tr.append(TDCell(HT.TD(symbolurl, Class="fs12 fwn b1 c222 fsI"),this_trait.symbol, this_trait.symbol.upper()))
-
#XZ, 12/08/2008: description
#XZ, 06/05/2009: Rob asked to add probe target description
description_string = str(this_trait.description).strip()
@@ -487,8 +396,8 @@ class SearchResultPage(templatePage):
else:
trait_location_value = ord(str(this_trait.chr).upper()[0])*1000 + 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.location_repr = 'Chr %s: %.4f Mb' % (this_trait.chr, float(this_trait.mb) )
+ this_trait.location_value = trait_location_value
#this_trait.trait_location_value = trait_location_value
#XZ, 01/12/08: This SQL query is much faster.
@@ -517,11 +426,10 @@ class SearchResultPage(templatePage):
this_trait.mean = repr = "%2.3f" % mean
#LRS and its location
- LRS_score_repr = 'N/A'
- LRS_score_value = 0
- LRS_location_repr = 'N/A'
- LRS_location_value = 1000000
- LRS_flag = 1
+ this_trait.LRS_score_repr = 'N/A'
+ this_trait.LRS_score_value = 0
+ this_trait.LRS_location_repr = 'N/A'
+ this_trait.LRS_location_value = 1000000
#Max LRS and its Locus location
if this_trait.lrs and this_trait.locus:
@@ -550,28 +458,3 @@ 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: %.4f Mb' % (LRS_Chr, float(LRS_Mb) )
- LRS_flag = 0
-
- #if LRS_flag:
- #tr.append(TDCell(HT.TD(LRS_score_repr, Class=className), LRS_score_repr, LRS_score_value))
- #tr.append(TDCell(HT.TD(LRS_location_repr, Class=className), LRS_location_repr, LRS_location_value))
-
- #else:
- #tr.append(TDCell(HT.TD("N/A", Class=className), "N/A", "N/A"))
- #tr.append(TDCell(HT.TD("N/A", Class=className), "N/A", "N/A"))
-
- tblobj_body.append(tr)
-
- return tblobj_body
-
-
- def getSortByValue(self, datasetType=''):
-
- if datasetType == 'Geno':
- sortby = ("location", "up")
- elif datasetType == 'ProbeSet':
- sortby = ("symbol", "up")
- else: #Phenotype
- sortby = ("record_id", "down")
-
- return sortby
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html
index 65182e1f..e393ced6 100644
--- a/wqflask/wqflask/templates/search_result_page.html
+++ b/wqflask/wqflask/templates/search_result_page.html
@@ -50,18 +50,32 @@
</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() }}
+ dataset = dataset.name,
+ trait_id = this_trait.name,
+ group = dataset.group)}}">
+ {{ this_trait.name }}
</a>
</TD>
- <TD>{{ this_trait.symbol }}</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>
+ {% if dataset.type == 'ProbeSet' %}
+ <TD>{{ this_trait.symbol }}</TD>
+ <TD>{{ this_trait.description_display }}</TD>
+ <TD>{{ this_trait.location_repr }}</TD>
+ <TD>{{ this_trait.mean }}</TD>
+ <TD>{{ this_trait.LRS_score_repr }}</TD>
+ <TD>{{ this_trait.LRS_location_repr }}</TD>
+ {% elif dataset.type == 'Publish' %}
+ <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>
+ {% elif dataset.type == 'Geno' %}
+ <TD>{{ this_trait.location_repr }}</TD>
+ {% endif %}
</TR>
{% endfor %}
</tbody>