aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Ockman2012-06-06 04:49:20 -0400
committerSam Ockman2012-06-06 04:49:20 -0400
commita6386179f0f94df749d7af232060ff10a68c42f6 (patch)
tree18a8344d0b6d48c15cb6247d17fa9dee38cfca0f
parent96cab107810b3a3ac8c804335e14c00b93e9061d (diff)
downloadgenenetwork2-a6386179f0f94df749d7af232060ff10a68c42f6.tar.gz
Most of the top fields working
-rwxr-xr-xwqflask/base/webqtlTrait.py66
-rwxr-xr-xwqflask/wqflask/show_trait/DataEditingPage.py87
-rw-r--r--wqflask/wqflask/show_trait/show_trait_page.py1
-rw-r--r--wqflask/wqflask/templates/trait_data_and_analysis.html17
4 files changed, 105 insertions, 66 deletions
diff --git a/wqflask/base/webqtlTrait.py b/wqflask/base/webqtlTrait.py
index 812d112a..23b98238 100755
--- a/wqflask/base/webqtlTrait.py
+++ b/wqflask/base/webqtlTrait.py
@@ -590,3 +590,69 @@ class webqtlTrait:
setDescription.append( ' --- FROM : ')
setDescription.append(self.db.genHTML(Class='cori'))
return setDescription
+
+ @property
+ def description_fmt(self):
+ '''Return a text formated description'''
+ if self.description:
+ formatted = self.description
+ if self.probe_target_description:
+ formatted += "; " + self.probe_target_description
+ else:
+ formatted = "Not available"
+ return formatted
+
+ @property
+ def alias_fmt(self):
+ '''Return a text formatted alias'''
+ if self.alias:
+ alias = string.replace(self.alias, ";", " ")
+ alias = string.join(string.split(alias), ", ")
+ return alias
+
+
+ @property
+ def location_fmt(self):
+ '''Return a text formatted location
+
+ While we're at it we set self.location in case we need it later (do we?)
+
+ '''
+
+ if self.chr and self.mb:
+ self.location = 'Chr %s @ %s Mb' % (self.chr,self.mb)
+ elif self.chr:
+ self.location = 'Chr %s @ Unknown position' % (self.chr)
+ else:
+ self.location = 'Not available'
+
+ fmt = self.location
+ ##XZ: deal with direction
+ if self.strand_probe == '+':
+ fmt += (' on the plus strand ')
+ elif self.strand_probe == '-':
+ fmt += (' on the minus strand ')
+
+ return fmt
+
+
+ def get_database(self):
+ """
+ Returns the database, and the url referring to the database if it exists
+
+ We're going to to return two values here, and we don't want to have to call this twice from
+ the template. So it's not a property called from the template, but instead is called from the view
+
+ """
+ if self.cellid:
+ self.cursor.execute("""
+ select ProbeFreeze.Name from ProbeFreeze, ProbeSetFreeze
+ where
+ ProbeFreeze.Id = ProbeSetFreeze.ProbeFreezeId AND
+ ProbeSetFreeze.Id = %d""" % thisTrait.db.id)
+ probeDBName = self.cursor.fetchone()[0]
+ return dict(name = probeDBName,
+ url = None)
+ else:
+ return dict(name = self.db.fullname,
+ url = webqtlConfig.INFOPAGEHREF % self.db.name)
diff --git a/wqflask/wqflask/show_trait/DataEditingPage.py b/wqflask/wqflask/show_trait/DataEditingPage.py
index 1aef0349..fda26322 100755
--- a/wqflask/wqflask/show_trait/DataEditingPage.py
+++ b/wqflask/wqflask/show_trait/DataEditingPage.py
@@ -345,44 +345,7 @@ class DataEditingPage(templatePage):
HT.TD(HT.Span('Not available', Class="fs13 fsI"), valign="top")
))
- #XZ: Gene Alias
- if thisTrait.alias:
- alias = string.replace(thisTrait.alias, ";", " ")
- alias = string.join(string.split(alias), ", ")
- thisTrait.alias_fmt = alias
-
-
- #XZ: Description
- if thisTrait.description:
- thisTrait.description_fmt = thisTrait.description
- if thisTrait.probe_target_description:
- thisTrait.description_fmt += "; " + this.trait.probe_target_description
- else:
- thisTrait.description_fmt = "Not available"
-
- #XZ: Location
-
- #XZ: deal with Chr and Mb
- if thisTrait.chr and thisTrait.mb:
- thisTrait.location = 'Chr %s @ %s Mb' % (thisTrait.chr,thisTrait.mb)
- elif thisTrait.chr:
- thisTrait.location = 'Chr %s @ Unknown position' % (thisTrait.chr)
- else:
- thisTrait.location = 'Not available'
- ##XZ: deal with direction
- #if thisTrait.strand_probe == '+':
- # tSpan.append(' on the plus strand ')
- #elif thisTrait.strand_probe == '-':
- # tSpan.append(' on the minus strand ')
- #else:
- # pass
- #
- #tbl.append(HT.TR(
- # HT.TD('Location: ', Class="fwb fs13", valign="top", nowrap="on"),
- # HT.TD(width=10, valign="top"),
- # HT.TD(tSpan, valign="top")
- # ))
##display Verify Location button
try:
@@ -474,18 +437,18 @@ class DataEditingPage(templatePage):
#probeButton.append(probeButton_img)
probeText = "Probes"
- tSpan = HT.Span(Class="fs13")
+ #tSpan = HT.Span(Class="fs13")
#XZ: deal with blat score and blat specificity.
- if thisTrait.probe_set_specificity or thisTrait.probe_set_blat_score:
- if thisTrait.probe_set_specificity:
- pass
- #tSpan.append(HT.Href(url="/blatInfo.html", target="_blank", title="Values higher than 2 for the specificity are good", text="BLAT specificity", Class="non_bold"),": %.1f" % float(thisTrait.probe_set_specificity), " "*3)
- if thisTrait.probe_set_blat_score:
- pass
- #tSpan.append("Score: %s" % int(thisTrait.probe_set_blat_score), " "*2)
+ #if thisTrait.probe_set_specificity or thisTrait.probe_set_blat_score:
+ # if thisTrait.probe_set_specificity:
+ # pass
+ # #tSpan.append(HT.Href(url="/blatInfo.html", target="_blank", title="Values higher than 2 for the specificity are good", text="BLAT specificity", Class="non_bold"),": %.1f" % float(thisTrait.probe_set_specificity), " "*3)
+ # if thisTrait.probe_set_blat_score:
+ # pass
+ # #tSpan.append("Score: %s" % int(thisTrait.probe_set_blat_score), " "*2)
- onClick="openNewWin('/blatInfo.html')"
+ #onClick="openNewWin('/blatInfo.html')"
#tbl.append(HT.TR(
# HT.TD('Target Score: ', Class="fwb fs13", valign="top", nowrap="on"),
@@ -502,26 +465,28 @@ class DataEditingPage(templatePage):
# HT.TD(tSpan, valign="top")
# ))
- if thisTrait.cellid:
- self.cursor.execute("""
- select ProbeFreeze.Name from ProbeFreeze, ProbeSetFreeze
- where
- ProbeFreeze.Id = ProbeSetFreeze.ProbeFreezeId AND
- ProbeSetFreeze.Id = %d""" % thisTrait.db.id)
- probeDBName = self.cursor.fetchone()[0]
- tbl.append(HT.TR(
- HT.TD('Database: ', Class="fs13 fwb", valign="top", nowrap="on"),
- HT.TD(width=10, valign="top"),
- HT.TD(HT.Span('%s' % probeDBName, Class="non_bold"), valign="top")
- ))
- else:
+ #if thisTrait.cellid:
+ # self.cursor.execute("""
+ # select ProbeFreeze.Name from ProbeFreeze, ProbeSetFreeze
+ # where
+ # ProbeFreeze.Id = ProbeSetFreeze.ProbeFreezeId AND
+ # ProbeSetFreeze.Id = %d""" % thisTrait.db.id)
+ # probeDBName = self.cursor.fetchone()[0]
+ # tbl.append(HT.TR(
+ # HT.TD('Database: ', Class="fs13 fwb", valign="top", nowrap="on"),
+ # HT.TD(width=10, valign="top"),
+ # HT.TD(HT.Span('%s' % probeDBName, Class="non_bold"), valign="top")
+ # ))
+ #else:
#tbl.append(HT.TR(
# HT.TD('Database: ', Class="fs13 fwb", valign="top", nowrap="on"),
# HT.TD(width=10, valign="top"),
# HT.TD(HT.Href(text=thisTrait.db.fullname, url = webqtlConfig.INFOPAGEHREF % thisTrait.db.name,
# target='_blank', Class="fs13 fwn non_bold"), valign="top")
# ))
- pass
+ #pass
+
+ thisTrait.database = thisTrait.get_database()
#XZ: ID links
if thisTrait.genbankid or thisTrait.geneid or thisTrait.unigeneid or thisTrait.omim or thisTrait.homologeneid:
@@ -534,7 +499,7 @@ class DataEditingPage(templatePage):
if thisTrait.omim:
gurl = HT.Href(text= 'OMIM', target='_blank', \
url= webqtlConfig.OMIM_ID % thisTrait.omim,Class="fs14 fwn", title="Summary from On Mendelian Inheritance in Man")
- tSpan.append(HT.Span(gurl, style=idStyle), " "*2)
+ #tSpan.append(HT.Span(gurl, style=idStyle), " "*2)
if thisTrait.unigeneid:
try:
gurl = HT.Href(text= 'UniGene',target='_blank',\
diff --git a/wqflask/wqflask/show_trait/show_trait_page.py b/wqflask/wqflask/show_trait/show_trait_page.py
index 57c68a1c..b1f71e55 100644
--- a/wqflask/wqflask/show_trait/show_trait_page.py
+++ b/wqflask/wqflask/show_trait/show_trait_page.py
@@ -43,6 +43,7 @@ class ShowTraitPage(DataEditingPage):
def __init__(self, fd, traitInfos = None):
#templatePage.__init__(self, fd)
+ self.fd = fd
if not self.openMysql():
return
diff --git a/wqflask/wqflask/templates/trait_data_and_analysis.html b/wqflask/wqflask/templates/trait_data_and_analysis.html
index 0eb1e012..1e67834c 100644
--- a/wqflask/wqflask/templates/trait_data_and_analysis.html
+++ b/wqflask/wqflask/templates/trait_data_and_analysis.html
@@ -68,7 +68,7 @@
<td valign="top" width="10"></td>
- <td valign="top"><span class="fs13">{{ thisTrait.location }}<br></span></td>
+ <td valign="top"><span class="fs13">{{ thisTrait.location_fmt }}<br></span></td>
</tr>
<tr>
@@ -76,8 +76,14 @@
<td valign="top" width="10"></td>
- <td valign="top"><span class="fs13"><a href="/blatInfo.html" target="_blank" class="non_bold" title=
- "Values higher than 2 for the specificity are good">BLAT specificity</a>: 12.0&nbsp;&nbsp;&nbsp;Score: 240&nbsp;&nbsp;</span></td>
+ <td valign="top">
+ <span class="fs13">
+ <a href="/blatInfo.html" target="_blank" class="non_bold" title="Values higher than 2 for the specificity are good">
+ BLAT specificity
+ </a>: {{ "%.1f" % (thisTrait.probe_set_specificity) }}&nbsp;&nbsp;&nbsp;
+ Score: {{ "%i" % (thisTrait.probe_set_blat_score) }}&nbsp;&nbsp;
+ </span>
+ </td>
</tr>
<tr>
@@ -93,8 +99,9 @@
<td valign="top" width="10"></td>
- <td valign="top"><a href="/dbdoc/HC_M2_0606_P.html" target="_blank" class="fs13 fwn non_bold">Hippocampus Consortium M430v2 (Jun06)
- PDNN</a></td>
+ <td valign="top">
+ <a href="{{ thisTrait.database.url }}" target="_blank" class="fs13 fwn non_bold">{{ thisTrait.database.name }}</a>
+ </td>
</tr>
<tr>