Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SOaAS
dbxref
Commits
70046422
Commit
70046422
authored
Feb 03, 2020
by
Jan Keller
Browse files
Begun to implement retriever for InterPro
parent
2c67779c
Changes
1
Hide whitespace changes
Inline
Side-by-side
dbxref/retrieve/interpro.py
100644 → 100755
View file @
70046422
...
...
@@ -9,3 +9,33 @@ import argparse
logger
=
logging
.
getLogger
(
__name__
)
def
main
():
"""main()method for script usage"""
parser
=
argparse
.
ArgumentParser
(
description
=
"Retrieve InterPro documents and convert them into json"
)
parser
.
add_argument
(
"dbxrefs"
,
nargs
=
argparse
.
REMAINDER
)
args
=
parser
.
parse_args
()
dbxrefs
=
dbxref
.
resolver
.
convert_to_dbxrefs
(
args
.
dbxrefs
)
documents
=
retrieve
(
dbxrefs
)
print
(
documents
)
def
retrieve
(
dbxrefs
):
"""Insert description here"""
print
(
dbxrefs
)
resolved
=
dbxref
.
resolver
.
resolve
(
dbxrefs
,
check_existence
=
False
)
print
(
resolved
)
documents
=
[]
for
entry
in
resolved
:
print
(
entry
)
html_url
=
entry
[
'locations'
][
'html'
][
0
]
logger
.
debug
(
'URL: %s'
,
html_url
)
r
=
requests
.
get
(
html_url
)
logger
.
debug
(
'Content: %s'
,
r
.
text
)
lines
=
json
.
loads
(
r
.
text
)
for
line
in
lines
:
print
(
line
)
return
documents
if
__name__
==
"__main__"
:
main
()
Write
Preview
Supports
Markdown
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