Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ippidb-web
Manage
Activity
Members
Labels
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iPPIDB
ippidb-web
Commits
6f375a5b
Commit
6f375a5b
authored
8 years ago
by
Hervé MENAGER
Browse files
Options
Downloads
Patches
Plain Diff
add namespace prefixes to parse uniprot XML (fixes #4)
parent
740d325d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ippisite/ippidb/ws.py
+7
-6
7 additions, 6 deletions
ippisite/ippidb/ws.py
with
7 additions
and
6 deletions
ippisite/ippidb/ws.py
+
7
−
6
View file @
6f375a5b
...
@@ -37,15 +37,16 @@ def get_epo_info(patent_number):
...
@@ -37,15 +37,16 @@ def get_epo_info(patent_number):
def
get_uniprot_info
(
uniprot_id
):
def
get_uniprot_info
(
uniprot_id
):
uniprot_client
=
UniProt
()
uniprot_client
=
UniProt
()
ns
=
{
'
u
'
:
'
http://uniprot.org/uniprot
'
}
resp
=
uniprot_client
.
retrieve
(
uniprot_id
)
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
recommended_name
=
resp
.
root
.
findall
(
'
u:entry/u:protein/u:recommendedName/u:
fullName
'
,
ns
)[
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
'
]
organism
=
resp
.
root
.
findall
(
'
u:entry/u:organism/u:
dbReference[@type=
"
NCBI Taxonomy
"
]
'
,
ns
)[
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
gene
=
resp
.
root
.
findall
(
'
u:entry/u:gene/u:
name[@type=
"
primary
"
]
'
,
ns
)[
0
].
text
entry_name
=
resp
.
root
.
findall
(
'
{http://uniprot.org/uniprot}entry/{http://uniprot.org/uniprot}
name
'
)[
0
].
text
entry_name
=
resp
.
root
.
findall
(
'
u:entry/u:
name
'
,
ns
)[
0
].
text
go_els
=
resp
.
root
.
findall
(
'
{http://uniprot.org/uniprot}entry/{http://uniprot.org/uniprot}
dbReference[@type=
"
GO
"
]
'
)
go_els
=
resp
.
root
.
findall
(
'
u:entry/u:
dbReference[@type=
"
GO
"
]
'
,
ns
)
molecular_functions
=
[]
molecular_functions
=
[]
for
go_el
in
go_els
:
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:
'
:
if
term_property_value
[
0
:
2
]
==
'
F:
'
:
molecular_functions
.
append
(
'
GO_
'
+
go_el
.
attrib
[
'
id
'
][
3
:])
molecular_functions
.
append
(
'
GO_
'
+
go_el
.
attrib
[
'
id
'
][
3
:])
return
{
'
recommended_name
'
:
recommended_name
,
return
{
'
recommended_name
'
:
recommended_name
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment