diff options
-rw-r--r-- | wqflask/base/trait.py | 16 | ||||
-rw-r--r-- | 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 @@ -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> |