diff options
author | zsloan | 2019-10-04 12:12:59 -0500 |
---|---|---|
committer | zsloan | 2019-10-04 12:12:59 -0500 |
commit | 5cffa1eacdb7fbb3d65b49744b0bee43e4cb130d (patch) | |
tree | 337d3569bfd574b52f02fedf4c918c02335a70cf /wqflask/base | |
parent | 4a1c68a1e63ade4eceab4e700fb22911885e8bbb (diff) | |
download | genenetwork2-5cffa1eacdb7fbb3d65b49744b0bee43e4cb130d.tar.gz |
Fixed issue where there was an error if the REST API used for aliases was down
Added option to download as JPEG in addition to SVG for basic stats figures
Diffstat (limited to 'wqflask/base')
-rw-r--r-- | wqflask/base/trait.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 58169b5c..322fb252 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -138,17 +138,19 @@ class GeneralTrait(object): 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) + if human_response and mouse_response and other_response: + 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 |