aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/webqtlTrait.py
diff options
context:
space:
mode:
authorSam Ockman2012-06-06 04:49:20 -0400
committerSam Ockman2012-06-06 04:49:20 -0400
commita6386179f0f94df749d7af232060ff10a68c42f6 (patch)
tree18a8344d0b6d48c15cb6247d17fa9dee38cfca0f /wqflask/base/webqtlTrait.py
parent96cab107810b3a3ac8c804335e14c00b93e9061d (diff)
downloadgenenetwork2-a6386179f0f94df749d7af232060ff10a68c42f6.tar.gz
Most of the top fields working
Diffstat (limited to 'wqflask/base/webqtlTrait.py')
-rwxr-xr-xwqflask/base/webqtlTrait.py66
1 files changed, 66 insertions, 0 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)