From 1826224503b81ef0497f24e2c3259ce24340e930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20=20MENAGER?= <herve.menager@pasteur.fr> Date: Sun, 26 Mar 2017 23:48:55 +0200 Subject: [PATCH] retrieve go identifiers for molecular functions from Uniprot --- ippisite/ippidb/ws.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ippisite/ippidb/ws.py b/ippisite/ippidb/ws.py index 8b9b3f3a..b8386de6 100644 --- a/ippisite/ippidb/ws.py +++ b/ippisite/ippidb/ws.py @@ -42,10 +42,17 @@ def get_uniprot_info(uniprot_id): 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"]') + molecular_functions = [] + for go_el in go_els: + term_property_value = go_el.findall('{http://uniprot.org/uniprot}property[@type="term"]')[0].attrib['value'] + if term_property_value[0:2]=='F:': + molecular_functions.append('GO_'+go_el.attrib['id'][3:]) return {'recommended_name': recommended_name, 'organism': int(organism), 'gene': gene, - 'entry_name': entry_name + 'entry_name': entry_name, + 'molecular_functions': molecular_functions } def get_taxonomy_info(taxonomy_id): -- GitLab