aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wqflask/wqflask/show_trait/show_trait.py18
-rw-r--r--wqflask/wqflask/templates/show_trait_details.html6
2 files changed, 23 insertions, 1 deletions
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index 4efaa968..10ce38a7 100644
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -5,6 +5,7 @@ import os
import datetime
import cPickle
import uuid
+import requests
import json as json
from collections import OrderedDict
@@ -129,6 +130,8 @@ class ShowTrait(object):
self.get_external_links()
self.build_correlation_tools()
+ self.ncbi_summary = get_ncbi_summary(self.this_trait)
+
#Get nearest marker for composite mapping
if not self.temp_trait:
if check_if_attr_exists(self.this_trait, 'locus_chr') and self.dataset.type != "Geno" and self.dataset.type != "Publish":
@@ -560,4 +563,17 @@ def check_if_attr_exists(the_trait, id_type):
else:
return True
else:
- return False \ No newline at end of file
+ return False
+
+def get_ncbi_summary(this_trait):
+ if check_if_attr_exists(this_trait, 'geneid'):
+ #ZS: Need to switch this try/except to something that checks the output later
+ try:
+ response = requests.get("http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=gene&id=%s&retmode=json" % this_trait.geneid)
+ logger.debug("NCBI:", json.loads(response.content)['result'][this_trait.geneid])
+ summary = json.loads(response.content)['result'][this_trait.geneid]['summary']
+ return summary
+ except:
+ return None
+ else:
+ return None \ No newline at end of file
diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html
index 3584be22..20dee54e 100644
--- a/wqflask/wqflask/templates/show_trait_details.html
+++ b/wqflask/wqflask/templates/show_trait_details.html
@@ -50,6 +50,12 @@
<td>{{ this_trait.location_fmt }}</td>
</tr>
{% endif %}
+ {% if ncbi_summary != None and ncbi_summary != "" %}
+ <tr>
+ <td><b>Summary</b></td>
+ <td>{{ ncbi_summary }}</td>
+ </tr>
+ {% endif %}
<tr>
<td><b>Database</b></td>
<td>