Skip to main content

A database server application that provides both a RESTful API and GUI for access to BED files and related basic statistics

Project description

bedhost

Code style: black

This is a REST API for the bedstat pipeline produced statistics. It needs a path to the bedbase configuration file, which can be provided either via -c/--config argument or read from $BEDBASE environment variable.

Configuration

Required

The only required section in the config file are the paths to the bedstat pipeline outputs, where all the BED file related statistics and figures live, and the bedbuncher pipeline outputs, where the TAR ball containing the BED files that match the query criteria, iGD database created from the bedset, Bedset statistics, PEP of the bedset created using the pipeline, and the trackHub directory for the BED (for visualization on the UCSC Genome Browser) live. For example:

path:
  pipeline_output_path: $BEDBASE_DATA_PATH/outputs
  bedstat_dir: bedstat_output
  bedbuncher_dir: bedbuncher_output

Optional

The software also needs a working database, we use PostgreSQL. The config file can point to this database's host. By default localhost is used. For example:

database:
  host : 125.132.33.111

In order to configure the server itself, a section of config exists, where server host address and port can be defined. By default host 0.0.0.0 and port 80 are used. For example:

server:
  host: 125.132.33.111
  port: 8000

To run Postgres in docker, follow the instructions in the bedstat pipeline software README.md, steps 2.

After the Postgres database has been run and the bedstat pipeline was used to populate it, see how to do it here, one can just start the bedhost server like so:

bedhost serve -c /path/to/cfg.yaml

This will start the server, which will listen on http://0.0.0.0:8000


Running the server in Docker

Building container

In the same directory as Dockerfile:

docker build -t bedstat-rest-api-server .

Or, maybe this is better:

docker build -t databio/bedhost -f dev.Dockerfile .

Running container for development

The container will need to have access to two different directories:

  1. Output of bedstat looper pipeline
  2. Original location of raw .BED files used to produce bedstat pipeline output

For example, if LOLA Core DB was used as input to the bedstat pipeline and results were stored in <some path>/bedstat/output/results_pipeline:

docker run --rm -p 8000:8000 -e HOST=0.0.0.0 -e PORT=8000 --name bedstat-rest-server -v /ext/qumulo/LOLAweb/databases/LOLACore:/ext/qumulo/LOLAweb/databases/LOLACore -v /development/bedstat/output/results_pipeline:/development/bedstat/output/results_pipeline bedstat-rest-api-server

Add a -d to the above command to run the docker container in the background (production).

Here's how I run the container:

docker run --rm --init -p 8000:8000 --name bedstat-rest-server \
  --network="host" \
  -v /home/nsheff/code/bedstat/output/results_pipeline:/home/nsheff/code/bedstat/output/results_pipeline \
  bedstat-rest-api-server uvicorn main:app --reload

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bedhost-0.1.1.tar.gz (98.9 kB view hashes)

Uploaded Source

Built Distribution

bedhost-0.1.1-py3-none-any.whl (99.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page