API Usage

The Bioregistry web application is built on Flask as a thin wrapper around the bioregistry Python package. It exposes several endpoints for accessing the registry, metaregistry, collections, and search functionality for which Swagger API documentation is automatically generated by Flasgger.

See the remaining Bioregistry API documentation or follow some of these examples using Python:

Registry

Get the whole registry:

import requests
res = requests.get('https://bioregistry.io/api/registry').json()

Just get metadata for ChEBI:

import requests
res = requests.get('https://bioregistry.io/api/registry/chebi').json()

Get metadata about ChEBI entry 138488 (alsterpaullone):

res = requests.get('https://bioregistry.io/api/reference/chebi:138488').json()

Search prefixes containing che:

res = requests.get(
    'https://bioregistry.io/api/search',
    params={'q': 'che'},
).json()

Python Package Usage

The Python source code can be found at biopragmatics/bioregistry. It can be installed with pip install bioregistry or in development mode by following these instructions.

The Bioregistry can be used to normalize prefixes across MIRIAM and all the (very plentiful) variants that pop up in ontologies in OBO Foundry and the OLS with the normalize_prefix() function.

import bioregistry

# This works for synonym prefixes, like:
assert 'ncbitaxon' == bioregistry.normalize_prefix('taxonomy')

# This works for common mistaken prefixes, like:
assert 'pubchem.compound' == bioregistry.normalize_prefix('pubchem')

# This works for prefixes that are often written many ways, like:
assert 'eccode' == bioregistry.normalize_prefix('ec-code')
assert 'eccode' == bioregistry.normalize_prefix('EC_CODE')

# If a prefix is not registered, it gives back `None`
assert bioregistry.normalize_prefix('not a real key') is None

Entries in the Bioregistry can be looked up with the get() function.

entry = bioregistry.get('taxonomy')
# there are lots of mysteries to discover in this dictionary!

The full Bioregistry can be read in a Python project using:

registry = bioregistry.read_registry()

Local Deployment of the Bioregistry Web Application

As the Bioregistry is open source, it's possible to host your own instance of the Bioregistry web application. Further, it's possible create a local derivative of the registry, metaregistry, or collections that can be deployed in your own instance. Here are examples how to do that:

Python CLI

You can also install and run the Bioregistry app from the shell:

$ pip install bioregistry[web]
$ bioregistry web

You can also download the source code, install in development mode, and run the Bioregistry app from the shell:

$ git clone https://github.com/biopragmatics/bioregistry.git
$ cd bioregistry
$ pip install --editable .[web]
$ bioregistry web

Docker

You can deploy your own instance of the Bioregistry with:

$ docker run -id -p 8766:8766 biopragmatics/bioregistry:latest

If you want to mix using a custom version of the Bioregistry with a Docker-based deployment, please see the dockerfile in biopragmatics/bioregistry-docker for inspiration.