CATH-SM Server

Build Status codecov

This repository contains scripts and libraries for running the backend Django server required for the CATH-SM (CATH/SWISS-MODEL) protein sequence modelling pipeline.

Overview

This code provides a Django server that manages a protein structural modelling pipeline via asynchronous web jobs to CATH and SWISS-MODEL APIs.

Local computation is carried out by a Celery worker (with Redis used as the cache/message broker).

A public deployment can be found here:

https://api01.cathdb.info

Local Install

Overview:

  • Install dependencies
  • Setup Python environment
  • Start up Celery worker
  • Start up Django server

Install Dependencies

Redis is used as a cache/message broker:

# Ubuntu
sudo apt-get install redis

# CentOS / RedHat
sudo yum install redis

Run the service in the background.

sudo systemctl enable redis
sudo systemctl start redis

Note: PostgreSQL is used as the deployment database (which will also need to be installed and configured), however the development database uses the built-in SQLite.

Setup Python environment

Install virtual environment

python3 -m venv venv
. venv/bin/activate
pip install -e .

Run tests

python3 -m pytest

Update the local database

cd cathsm-server && source venv/bin/activate
python3 manage.py makemigrations
python3 manage.py migrate

Start Celery worker (to process jobs)

cd cathsm-server && source venv/bin/activate
CATHAPI_DEBUG=1 celery -A cathapi worker

Start server

cd cathsm-server && source venv/bin/activate
CATHAPI_DEBUG=1 python3 manage.py runserver

An instance of cathsm-server should now be available at:

http://127.0.0.1:8000/