Commit a12602d6 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Merge branch 'develop' into 'master'


See merge request SOaAS/dbxref!3
parents 941bb534 2733b102
# DB XREF resolver and retriever tool
DB XREF resolver and retriever tool
A tool that resolves database cross references (dbxrefs). It can return a list of
locations where the cross reference points to in different formats, like HTML,
......@@ -9,40 +10,47 @@ The intended audience for this tool are bioinformatician that need to collect
data for dbxrefs and postprocess it. By returning everything in json format the
need for normalization and special parsing of the data is reduced.
# Getting started for development (Setup)
Getting started for development (Setup)
* git
* python3
Supported bioinformatic databases:
Supported databases:
* Ontologies
* Gene Ontology
* Enzyme
* Gene Identifier
* Uniprot
* Taxonomy
* SequenceOntology
* Pubmed
* Protein Families
* InterPro
* GeneID
* Gene Ontology
Checkout the repository:
git clone
Checkout the repository::
Setup a virtualenv for development and install it in editable mode:
git clone
# install in development environment
virtualenv --python=python3 venv; source venv/bin/activate;
pip install -e .
Setup a virtualenv for development and install it in editable mode::
# run tests
python3 test
# install in development environment
virtualenv --python=python3 venv; source venv/bin/activate;
pip install -e .
# compile documentation
python3 build_sphinx
# run tests
python3 test
Use the application:
# compile documentation
python3 build_sphinx
dbxref resolve GO:0097281
Use the application::
dbxref resolve GO:0097281
......@@ -10,7 +10,10 @@ def _load_providers(path):
data = []
with open(path) as data_file:
data = yaml.load(data_file)
return normalize_index(index_providers(data))
return data
def load_indexed_providers():
return normalize_index(index_providers(load_providers()))
def index_providers(providers):
index = {}
......@@ -24,10 +27,10 @@ def normalize_index(index):
return {k.lower():v for (k,v) in index.items()}
def has_provider(provider):
return _has_provider(load_providers(), provider)
return _has_provider(load_indexed_providers(), provider)
def _has_provider(providers, provider):
return provider.lower() in providers
def get_provider(provider):
return load_providers()[provider.lower()]
return load_indexed_providers()[provider.lower()]
#!/usr/bin/env python3
import argparse
from argparse import RawTextHelpFormatter
import os
import logging
from dbxref import resolver
from dbxref import resolver, config
from pbr.version import VersionInfo
import json
__version__ = VersionInfo('dbxref').semantic_version().release_string()
def main():
parser = argparse.ArgumentParser(description='Lookup locations of database cross references and retrieve them as json')
parser = argparse.ArgumentParser(description='Version ' + __version__ + '\nLookup locations of database cross references and retrieve them as json', formatter_class=RawTextHelpFormatter)
subparsers = parser.add_subparsers()
info_parser = subparsers.add_parser('info')
#TODO implement
resolve_parser = subparsers.add_parser('resolve')
resolve_parser.add_argument('dbxrefs', nargs=argparse.REMAINDER)
......@@ -26,7 +29,7 @@ def main():
retrieve_parser.add_argument('--verbose', '-v', action='store_true', default=False, help="Show debug output")
args = parser.parse_args()
config = {} # TODO implement
config = {} # implement when needed
if ('verbose' in vars(args) and args.verbose):
args.parser = parser
......@@ -35,9 +38,15 @@ def main():
def help(args, config):
def info(args, config):
#TODO implement
print ('info')
def info(args, cfg):
print ('dbxref Version ' + __version__)
print ('')
print ('Supported dbxref databases:')
providers = config.load_providers()
for provider in providers:
print (' ' + provider['name'])
print (' Prefixes: ' + str.join(', ', [x for x in provider['prefixes']]))
print (' Formats : ' + str.join(', ', [x for x in provider['resources']]))
def resolve(args, config):
print(json.dumps(resolver.resolve(resolver.convert_to_dbxrefs(args.dbxrefs), check_existence=args.no_check)))
name = dbxref
author = Lukas Jelonek
author-email =
description = A library for resolving database cross references
description-file = README.rst
project_urls =
Source Code =
keywords = dbxref
license = MIT
packages = dbxref
console_scripts =
dbxref = dbxref.main:main
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, ''), encoding='utf-8') as f:
long_description =
from setuptools import setup
description='A library for resolving database cross references',
author='Lukas Jelonek',
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
'console_scripts': [
Markdown is supported
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