aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2016-05-31 20:59:35 +0000
committerzsloan2016-05-31 20:59:35 +0000
commitd93768983ec26e5dfd49069a3133e86aa6834de7 (patch)
tree7af9530f71cc890ad77d20738c2195dff949fafa /wqflask
parent134d5022477a0df8936e6f303cf56863d01fba11 (diff)
downloadgenenetwork2-d93768983ec26e5dfd49069a3133e86aa6834de7.tar.gz
Fixed error when MrnaAssay search results didn't have a geneid
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/base/trait.py55
1 files changed, 28 insertions, 27 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index d1c0be83..0c962331 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -346,33 +346,34 @@ class GeneralTrait(object):
self.homologeneid = None
- if self.dataset.type == 'ProbeSet' and self.dataset.group and self.geneid:
- #XZ, 05/26/2010: From time to time, this query get error message because some geneid values in database are not number.
- #XZ: So I have to test if geneid is number before execute the query.
- #XZ: The geneid values in database should be cleaned up.
- #try:
- # float(self.geneid)
- # geneidIsNumber = True
- #except ValueError:
- # geneidIsNumber = False
- #if geneidIsNumber:
- query = """
- SELECT
- HomologeneId
- FROM
- Homologene, Species, InbredSet
- WHERE
- Homologene.GeneId =%s AND
- InbredSet.Name = '%s' AND
- InbredSet.SpeciesId = Species.Id AND
- Species.TaxonomyId = Homologene.TaxonomyId
- """ % (escape(str(self.geneid)), escape(self.dataset.group.name))
- result = g.db.execute(query).fetchone()
- #else:
- # result = None
-
- if result:
- self.homologeneid = result[0]
+ if self.dataset.type == 'ProbeSet' and self.dataset.group:
+ if self.geneid:
+ #XZ, 05/26/2010: From time to time, this query get error message because some geneid values in database are not number.
+ #XZ: So I have to test if geneid is number before execute the query.
+ #XZ: The geneid values in database should be cleaned up.
+ #try:
+ # float(self.geneid)
+ # geneidIsNumber = True
+ #except ValueError:
+ # geneidIsNumber = False
+ #if geneidIsNumber:
+ query = """
+ SELECT
+ HomologeneId
+ FROM
+ Homologene, Species, InbredSet
+ WHERE
+ Homologene.GeneId =%s AND
+ InbredSet.Name = '%s' AND
+ InbredSet.SpeciesId = Species.Id AND
+ Species.TaxonomyId = Homologene.TaxonomyId
+ """ % (escape(str(self.geneid)), escape(self.dataset.group.name))
+ result = g.db.execute(query).fetchone()
+ #else:
+ # result = None
+
+ if result:
+ self.homologeneid = result[0]
description_string = unicode(str(self.description).strip(codecs.BOM_UTF8), 'utf-8')
target_string = unicode(str(self.probe_target_description).strip(codecs.BOM_UTF8), 'utf-8')