aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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