From 2ded076807c4c1232d23bf43caebc82424dbc56d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20=20MENAGER?= <herve.menager@pasteur.fr> Date: Thu, 16 Mar 2017 22:31:31 +0100 Subject: [PATCH] add first draft to retrieve uniprot info --- ippisite/ippidb/ws.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ippisite/ippidb/ws.py b/ippisite/ippidb/ws.py index 2cf9ecb8..422a5219 100644 --- a/ippisite/ippidb/ws.py +++ b/ippisite/ippidb/ws.py @@ -1,4 +1,6 @@ from bioservices.eutils import EUtils +from bioservices.uniprot import UniProt +from xml.etree.ElementTree import register_namespace import requests def get_pubmed_info(pmid): @@ -32,3 +34,12 @@ def get_epo_info(patent_number): 'journal_name': None, 'biblio_year': biblio_year, 'authors_list': authors} + +def get_uniprot_info(uniprot_id): + uniprot_client = Uniprot() + resp = uniprot_client.retrieve(uniprot_id) + recommended_name = res.root.findall('{http://uniprot.org/uniprot}entry/{http://uniprot.org/uniprot}protein/{http://uniprot.org/uniprot}recommendedName/{http://uniprot.org/uniprot}fullName')[0].text + organism = res.root.findall('{http://uniprot.org/uniprot}entry/{http://uniprot.org/uniprot}organism/{http://uniprot.org/uniprot}dbReference[@type="NCBI Taxonomy"]/@id') + return {'recommended_name': recommended_name, + 'organism': organism + } -- GitLab