diff --git a/ippisite/ippidb/ws.py b/ippisite/ippidb/ws.py index f52d2e768f0f1cda92a5e2b69473b112c180020b..768d0afb7775f26deba7d7a32b0da3231a776ee3 100644 --- a/ippisite/ippidb/ws.py +++ b/ippisite/ippidb/ws.py @@ -37,15 +37,16 @@ def get_epo_info(patent_number): def get_uniprot_info(uniprot_id): uniprot_client = UniProt() + ns = {'u':'http://uniprot.org/uniprot'} resp = uniprot_client.retrieve(uniprot_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 - entry_name = resp.root.findall('{http://uniprot.org/uniprot}entry/{http://uniprot.org/uniprot}name')[0].text - go_els = resp.root.findall('{http://uniprot.org/uniprot}entry/{http://uniprot.org/uniprot}dbReference[@type="GO"]') + recommended_name = resp.root.findall('u:entry/u:protein/u:recommendedName/u:fullName', ns)[0].text + organism = resp.root.findall('u:entry/u:organism/u:dbReference[@type="NCBI Taxonomy"]', ns)[0].attrib['id'] + gene = resp.root.findall('u:entry/u:gene/u:name[@type="primary"]', ns)[0].text + entry_name = resp.root.findall('u:entry/u:name', ns)[0].text + go_els = resp.root.findall('u:entry/u:dbReference[@type="GO"]', ns) molecular_functions = [] for go_el in go_els: - term_property_value = go_el.findall('{http://uniprot.org/uniprot}property[@type="term"]')[0].attrib['value'] + term_property_value = go_el.findall('u:property[@type="term"]', ns)[0].attrib['value'] if term_property_value[0:2]=='F:': molecular_functions.append('GO_'+go_el.attrib['id'][3:]) return {'recommended_name': recommended_name,