aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/trait.py
diff options
context:
space:
mode:
authorzsloan2019-08-01 12:08:33 -0500
committerzsloan2019-08-01 12:08:33 -0500
commit823169d970d8b64e955f7316e6df87c5204b4864 (patch)
tree7033865e45baea4b6b6b0b62813483c9bc8e37c2 /wqflask/base/trait.py
parent8cf60da3d6acd18c84381bb51fde9968dc3d75e5 (diff)
downloadgenenetwork2-823169d970d8b64e955f7316e6df87c5204b4864.tar.gz
Made some more aesthetic changes to various pages and charts/figures
Added some information to the mapping loading page
Diffstat (limited to 'wqflask/base/trait.py')
-rw-r--r--wqflask/base/trait.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 0527449b..39dd075e 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -3,6 +3,7 @@ from __future__ import absolute_import, division, print_function
import string
import resource
import codecs
+import requests
import redis
Redis = redis.StrictRedis()
@@ -120,11 +121,17 @@ class GeneralTrait(object):
@property
def alias_fmt(self):
'''Return a text formatted alias'''
- if self.alias:
- alias = string.replace(self.alias, ";", " ")
- alias = string.join(string.split(alias), ", ")
- else:
- alias = 'Not available'
+
+ alias = 'Not available'
+ if self.symbol:
+ response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + self.symbol)
+ alias_list = json.loads(response.content)
+ alias = "; ".join(alias_list)
+
+ if alias == 'Not available':
+ if self.alias:
+ alias = string.replace(self.alias, ";", " ")
+ alias = string.join(string.split(alias), ", ")
return alias