aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2019-08-01 15:16:39 -0500
committerzsloan2019-08-01 15:16:39 -0500
commiteb2fb5c936ff8e2351ef3c1f9cf4968790528bdb (patch)
tree7679ed0f5ec300bc4f91ceca57855d471d35c6ea
parentd49507350119c79c1ffb09b054d08b7545703a18 (diff)
downloadgenenetwork2-eb2fb5c936ff8e2351ef3c1f9cf4968790528bdb.tar.gz
Added wikidata aliases
Fixed year to not be a hyperlink when no pubmed id Fixed first column width so it doesn't go onto two lines for trait details
-rw-r--r--wqflask/base/trait.py16
-rw-r--r--wqflask/wqflask/templates/show_trait_details.html12
2 files changed, 20 insertions, 8 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 39dd075e..a0679041 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -123,16 +123,22 @@ class GeneralTrait(object):
'''Return a text formatted alias'''
alias = 'Not available'
+ if self.alias:
+ alias = string.replace(self.alias, ";", " ")
+ alias = string.join(string.split(alias), ", ")
+
+ return alias
+
+ @property
+ def wikidata_alias_fmt(self):
+ '''Return a text formatted alias'''
+
+ 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
diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html
index e6c68591..7714a1ab 100644
--- a/wqflask/wqflask/templates/show_trait_details.html
+++ b/wqflask/wqflask/templates/show_trait_details.html
@@ -1,6 +1,6 @@
<table class="table">
<tr>
- <td>Species and Group</td>
+ <td width="150px">Species and Group</td>
<td>{{ this_trait.dataset.group.species }}, {{ this_trait.dataset.group.name }}</td>
</tr>
{% if this_trait.dataset.type == 'Publish' %}
@@ -18,7 +18,7 @@
</tr>
<tr>
<td>Journal</td>
- <td>{{ this_trait.journal }} (<a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids={{ this_trait.pubmed_id }}&dop=Abstract" target="_blank" title="PubMed">{{ this_trait.year }}</a>)</td>
+ <td>{{ this_trait.journal }} ({% if this_trait.pubmed_id %}<a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids={{ this_trait.pubmed_id }}&dop=Abstract" target="_blank" title="PubMed">{{ this_trait.year }}</a>{% else %}{{ this_trait.year }}{% endif %})</td>
</tr>
{% else %}
<tr>
@@ -35,8 +35,14 @@
{% endif %}
<tr>
<td>Aliases</td>
- <td>{{ this_trait.alias_fmt|replace(",",";") }}</td>
+ <td>Wikidata: {{ this_trait.wikidata_alias_fmt|replace(",",";") }}</td>
</tr>
+ {% if this_trait.alias_fmt != "Not Available" %}
+ <tr>
+ <td></td>
+ <td>GeneNetwork: {{ this_trait.alias_fmt|replace(",",";") }}</td>
+ </tr>
+ {% endif %}
{% endif %}
{% if this_trait.dataset.type != 'Publish' %}
<tr>