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
7b99ebc8
Commit
7b99ebc8
authored
Aug 02, 2017
by
Lukas Jelonek
Browse files
Integrate resolver code into CLI
parent
7f798047
Changes
2
Hide whitespace changes
Inline
Side-by-side
dbxref/main.py
View file @
7b99ebc8
...
...
@@ -3,7 +3,7 @@ import argparse
import
os
def
main
():
parser
=
argparse
.
ArgumentParser
(
description
=
'
Make bioinformatic observations on aminoacid sequences
'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'
Lookup locations of database cross references and retrieve them as json
'
)
parser
.
set_defaults
(
func
=
help
)
subparsers
=
parser
.
add_subparsers
()
...
...
@@ -12,8 +12,8 @@ def main():
#TODO implement
resolve_parser
=
subparsers
.
add_parser
(
'resolve'
)
resolve_parser
.
add_argument
(
'dbxrefs'
,
nargs
=
argparse
.
REMAINDER
)
resolve_parser
.
set_defaults
(
func
=
resolve
)
#TODO implement
retrieve_parser
=
subparsers
.
add_parser
(
'retrieve'
)
retrieve_parser
.
set_defaults
(
func
=
retrieve
)
...
...
@@ -32,8 +32,9 @@ def info(args, config):
print
(
'info'
)
def
resolve
(
args
,
config
):
#TODO implement
print
(
'resolve'
)
from
dbxref
import
resolver
import
json
print
(
json
.
dumps
(
resolver
.
resolve
(
args
.
dbxrefs
)))
def
retrieve
(
args
,
config
):
#TODO implement
...
...
dbxref/resolver.py
View file @
7b99ebc8
def
resolve
(
strings
):
from
dbxref.config
import
load_providers
# read providers.json
providers
=
load_providers
()
results
=
[]
for
s
in
strings
:
...
...
@@ -16,7 +15,7 @@ def resolve(strings):
}
)
results
.
append
({
'dbxref'
:
dbxref
[
'db'
]
+
':'
+
dbxref
[
'id'
],
'locations'
:
urls
})
else
:
print
(
"No provider found"
)
results
.
append
({
'dbxref'
:
dbxref
[
'db'
]
+
':'
+
dbxref
[
'id'
],
'locations'
:
[]}
)
return
results
def
convert_string_to_dbxref
(
string
):
...
...
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