aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2019-08-01 17:13:07 -0500
committerzsloan2019-08-01 17:13:07 -0500
commit1fd5271ebd12cff537e8ce68d9f8d706e531eb51 (patch)
treed14cc961dc40415ba26d2e2cefe8795f369d38e0 /wqflask
parenteb2fb5c936ff8e2351ef3c1f9cf4968790528bdb (diff)
downloadgenenetwork2-1fd5271ebd12cff537e8ce68d9f8d706e531eb51.tar.gz
Updated aliases to get all species aliases and remove duplicates
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/base/trait.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index a0679041..58169b5c 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -135,9 +135,20 @@ class GeneralTrait(object):
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)
+ human_response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + self.symbol.upper())
+ mouse_response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + self.symbol.capitalize())
+ other_response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + self.symbol.lower())
+ alias_list = json.loads(human_response.content) + json.loads(mouse_response.content) + json.loads(other_response.content)
+
+ filtered_aliases = []
+ seen = set()
+ for item in alias_list:
+ if item in seen:
+ continue
+ else:
+ filtered_aliases.append(item)
+ seen.add(item)
+ alias = "; ".join(filtered_aliases)
return alias