aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2019-10-04 12:12:59 -0500
committerzsloan2019-10-04 12:12:59 -0500
commit5cffa1eacdb7fbb3d65b49744b0bee43e4cb130d (patch)
tree337d3569bfd574b52f02fedf4c918c02335a70cf /wqflask
parent4a1c68a1e63ade4eceab4e700fb22911885e8bbb (diff)
downloadgenenetwork2-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')
-rw-r--r--wqflask/base/trait.py22
-rw-r--r--wqflask/wqflask/do_search.py19
-rw-r--r--wqflask/wqflask/static/new/javascript/show_trait.js9
3 files changed, 30 insertions, 20 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
diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py
index 3ea841ab..c7f3fe41 100644
--- a/wqflask/wqflask/do_search.py
+++ b/wqflask/wqflask/do_search.py
@@ -888,17 +888,18 @@ def get_aliases(symbol, species):
elif species == "human":
symbol_string = symbol.upper()
+ filtered_aliases = []
response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + symbol_string)
- alias_list = json.loads(response.content)
+ if response:
+ alias_list = json.loads(response.content)
- filtered_aliases = []
- seen = set()
- for item in alias_list:
- if item in seen:
- continue
- else:
- filtered_aliases.append(item)
- seen.add(item)
+ seen = set()
+ for item in alias_list:
+ if item in seen:
+ continue
+ else:
+ filtered_aliases.append(item)
+ seen.add(item)
return filtered_aliases
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index 9813fca8..871582d2 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -864,10 +864,17 @@ if (Object.keys(js_data.sample_group_types).length > 1) {
root.modebar_options = {
modeBarButtonsToAdd:[{
name: 'Export as SVG',
- icon: Plotly.Icons.disk,
+ icon: Plotly.Icons.camera,
click: function(gd) {
Plotly.downloadImage(gd, {format: 'svg'})
}
+ },
+ {
+ name: 'Export as JPEG',
+ icon: Plotly.Icons.disk,
+ click: function(gd) {
+ Plotly.downloadImage(gd, {format: 'jpeg'})
+ }
}],
modeBarButtonsToRemove:['toImage', 'sendDataToCloud', 'hoverClosest', 'hoverCompare', 'hoverClosestCartesian', 'hoverCompareCartesian', 'lasso2d', 'toggleSpikelines'],
displaylogo: false