From eb2fb5c936ff8e2351ef3c1f9cf4968790528bdb Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 1 Aug 2019 15:16:39 -0500 Subject: 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 --- wqflask/base/trait.py | 16 +++++++++++----- wqflask/wqflask/templates/show_trait_details.html | 12 +++++++++--- 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 @@ -122,17 +122,23 @@ class GeneralTrait(object): def alias_fmt(self): '''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 @@ - + {% if this_trait.dataset.type == 'Publish' %} @@ -18,7 +18,7 @@ - + {% else %} @@ -35,8 +35,14 @@ {% endif %} - + + {% if this_trait.alias_fmt != "Not Available" %} + + + + + {% endif %} {% endif %} {% if this_trait.dataset.type != 'Publish' %} -- cgit v1.2.3
Species and GroupSpecies and Group {{ this_trait.dataset.group.species }}, {{ this_trait.dataset.group.name }}
Journal{{ this_trait.journal }} ({{ this_trait.year }}){{ this_trait.journal }} ({% if this_trait.pubmed_id %}{{ this_trait.year }}{% else %}{{ this_trait.year }}{% endif %})
Aliases{{ this_trait.alias_fmt|replace(",",";") }}Wikidata: {{ this_trait.wikidata_alias_fmt|replace(",",";") }}
GeneNetwork: {{ this_trait.alias_fmt|replace(",",";") }}