Commit 7b99ebc8 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Integrate resolver code into CLI

parent 7f798047
......@@ -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
......
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):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment