Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SOaAS
dbxref
Commits
595d956d
Commit
595d956d
authored
May 12, 2021
by
Lukas Jelonek
Browse files
Merge branch 'master' of git.computational.bio.uni-giessen.de:SOaAS/dbxref
parents
90fd206a
75af198a
Changes
1
Hide whitespace changes
Inline
Side-by-side
dbxref/retrieve/uniprot.py
View file @
595d956d
...
...
@@ -35,13 +35,27 @@ def main():
documents
=
retrieve
(
dbxrefs
,
basic
=
args
.
basic
,
sequence
=
args
.
sequence
,
organism
=
args
.
organism
,
annotation
=
args
.
annotation
,
features
=
args
.
features
)
print
(
json
.
dumps
(
documents
))
def
lookup
(
xml_url
,
retries
):
requests
.
get
(
xml_url
)
def
retrieve
(
dbxrefs
,
basic
=
True
,
sequence
=
True
,
organism
=
True
,
annotation
=
True
,
features
=
True
):
resolved
=
dbxref
.
resolver
.
resolve
(
dbxrefs
,
check_existence
=
False
)
documents
=
[]
for
entry
in
resolved
:
xml_url
=
entry
[
'locations'
][
'xml'
][
0
]
logger
.
debug
(
'URL: %s'
,
xml_url
)
r
=
requests
.
get
(
xml_url
)
retries
=
10
r
=
None
while
retries
>
0
and
r
==
None
:
try
:
r
=
requests
.
get
(
xml_url
)
break
except
requests
.
exceptions
.
SSLError
:
retries
=
retries
-
1
if
retries
>
0
:
logger
.
warning
(
"Request failed, retrying"
)
else
:
raise
logger
.
debug
(
'Content: %s'
,
r
.
text
)
output
=
{
'id'
:
entry
[
'dbxref'
]}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment