From aedac6b640e40ae181eaa88da9714ea687dcc7d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20=20MENAGER?= <herve.menager@pasteur.fr> Date: Wed, 22 Mar 2017 09:47:49 +0100 Subject: [PATCH] correct uniprot web service and add taxonomy web service --- ippisite/ippidb/ws.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/ippisite/ippidb/ws.py b/ippisite/ippidb/ws.py index 422a5219..de60b857 100644 --- a/ippisite/ippidb/ws.py +++ b/ippisite/ippidb/ws.py @@ -36,10 +36,18 @@ def get_epo_info(patent_number): 'authors_list': authors} def get_uniprot_info(uniprot_id): - uniprot_client = Uniprot() + 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') + recommended_name = resp.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 = resp.root.findall('{http://uniprot.org/uniprot}entry/{http://uniprot.org/uniprot}organism/{http://uniprot.org/uniprot}dbReference[@type="NCBI Taxonomy"]')[0].attrib['id'] + gene = resp.root.findall('{http://uniprot.org/uniprot}entry/{http://uniprot.org/uniprot}gene/{http://uniprot.org/uniprot}name[@type="primary"]')[0].text return {'recommended_name': recommended_name, - 'organism': organism - } + 'organism': int(organism), + 'gene': gene + } + +def get_taxonomy_info(taxonomy_id): + eu = EUtils() + r = eu.EFetch('taxonomy', taxonomy_id, retmode='dict') + scientific_name = r['TaxaSet']['Taxon']['ScientificName'] + return {'scientific_name': scientific_name} -- GitLab