statgen / locuszoom-hosted

A web service to upload and share GWAS results with LocusZoom.js
https://my.locuszoom.org
MIT License
1 stars 0 forks source link
gwas gwas-pipeline gwas-summary-statistics gwas-tools locuszoom locuszoom-plot

LocusZoom: Hosted Upload Service

Upload, analyze, and share GWAS results with LocusZoom.js. Try it at my.locuszoom.org.

Settings

For a basic guide to most settings, see the cookiecutter-django docs.

Basic Commands

Quickstart

The following commands will start a development environment. Some IDEs (such as Pycharm) are able to run the app via run configurations, which may be more convenient than starting things through the terminal.

For production deployment instructions, see docs/deploy/index.md.

$ npm run prod

or with live rebuilding, if you intend to be changing JS code as you work:

$ npm run dev

$ docker system prune && docker-compose -f local.yml build --pull
$ docker-compose -f local.yml up

(docker system prune is optional, but it can save your hard drive from filling up as you experiment with different build options)

On the first installation, you will also need to download some large asset files required for annotations. For local development, a "test" version is available that will only annotate a limited subset of biologically interesting genes; this subset is much smaller than the full database, and easier to use on a laptop.

(see deployment docs for the correct command to use with production assets)

$ docker-compose -f local.yml run --rm django zorp-assets download --type snp_to_rsid_test --tag genome_build GRCh37 --no-update
$ docker-compose -f local.yml run --rm django zorp-assets download --type snp_to_rsid_test --tag genome_build GRCh38 --no-update

Setting Up Your Users

For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or similar), so that you can see how the site behaves for both kinds of users.

Then follow the authentication setup instructions.

The OAuth credentials may be obtained through the Google API console. For local development, you must use named origins (not an IP address) for the values you enter in the console:

$ docker-compose -f local.yml run --rm django python manage.py makemigrations

Then verify the migration file is correct, and restart Docker to apply the migrations automatically. (in production, you must apply the migrations manually; see deployment guide for details)

Development and testing helpers

Generating sample data for testing

This script generates fake studies for search results, but it notably does not run the ingest pipeline. It may be improved in the future to generate more realistic and complete fake data.

Opening a terminal for debugging

Because all development happens inside a Docker container, it is sometimes useful to open a terminal for debugging purposes. This can be done as follows.

On a running container::

$ docker-compose -f local.yml exec django bash

Create a container just to run a command::

$ docker-compose -f local.yml run --rm django bash

Similarly, the django app can be probed interactively (eg, to experiment with the ORM) via an enhanced python shell::

$ docker-compose -f local.yml run --rm django ./manage.py shell_plus

Static analysis checks

We run static analysis with flake8, and type checks with mypy:::

$ flake8 . $ mypy .

Test coverage

To run the tests, check your test coverage, and generate an HTML coverage report::

$ coverage run -m pytest $ coverage html $ open htmlcov/index.html

Running tests with py.test

A suite of unit tests is available::

$ docker-compose -f local.yml run --rm django pytest

Sentry

Sentry is an error logging aggregator service. If a key (DSN) is provided in your .env file, errors will be tracked automatically.

Deployment

Docker

This app uses Docker to manage dependencies and create a working environment. See deployment documentation for instructions on how to create a working, production server environment. A local, debug-friendly Docker configuration is also provided in this repo, and many of the instructions in this document assume this is what you will use.

The original Docker configuration has been modified from cookiecutter-django; see their docs for more information about default options and design choices.