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 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'wqflask/base') 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 -- cgit v1.2.3