duncanpeacock / fragalysis-backend

Django backend loader and Restful API for fragalysis server
Apache License 2.0
0 stars 0 forks source link

Build Status stable Version License Language grade: Python

Fragalysis backend

Django server for Fragalysis with DRF API and loaders for data. Has components to serve React web-app.

Documentation: https://fragalysis-backend.readthedocs.io/en/latest/index.html

Dev environment setup

Background

The stack consists of three services, running as containers: -

The stack is formed from code resident in a number of repositories. Begin by forking repositories you anticipate editing (although you really want to consider forking all the repositories as this is a relatively low-cost operation).

The repositories are:

Prerequisites

Setup

1.Create project directory, e.g.

mkdir fragalysis

2.Clone repositories inside your project's directory

You can clone original xchem repositories or your forked e.g. m2ms and checkout any branch if necessary

git clone https://github.com/xchem/fragalysis-backend.git
git clone https://github.com/xchem/fragalysis-frontend.git
git clone https://github.com/xchem/fragalysis-loader.git
git clone https://github.com/InformaticsMatters/dls-fragalysis-stack-openshift.git

Note: To successful build, it should exist following directories from repository cloning. Frontend is also important, because DJANGO server will serve this directory!

fragalysis/fragalysis-loader/
fragalysis/fragalysis-frontend/
fragalysis/fragalysis-backend/
fragalysis/dls-fragalysis-stack-openshift/

3.Create some key data directories

In fragalysis/ directory run script to create data directory structure

mkdir -p data/input/django_data/EXAMPLE
mkdir -p data/neo4j/data
mkdir -p data/neo4j/logs
mkdir -p data/stack/media
mkdir -p data/stack/logs
mkdir -p data/media/compound_sets
mkdir -p data/postgre/data

4.Populating database

Copy to fragalysis/data/input/django_data/EXAMPLE your PDB data, before you can launch the application.

If not exists file fragalysis/data/input/django_data/EXAMPLE/TARGET_LIST create it and content with list of your data, for example:

Mpro, NUDT7A,...

Start

Start Fragalysis stack (All infrastructure - databases + populating data)

docker-compose -f docker-compose.dev.yml up -d

Please wait, it takes a minute until all containers are fully started.

Test if we are running at http://localhost:8080

If needed stop containers

docker-compose -f docker-compose.dev.yml down

Note: The first run will be probably not successful. To fix after first run:

Develop mode in DJANGO

change value of DEBUG variable to True in this file fragalysis-backend/fragalysis/settings.py Note: please don't push this change into git

Populate database with CompoundSet

The first you need to have upload key.

Generate upload key

connect to web_dock service and run following script

python manage.py shell
from viewer.models import CSetKeys
new_key = CSetKeys()
new_key.name = 'test'
new_key.save()
print(new_key.uuid)

It is important to have key in following format (with -) f8c4ea0f-6b81-46d0-b85a-3601135756bc

Upload page

Visit localhost:8080/viewer/upload_cset

The target name is for example Mpro, select sdf file and you don't need a pdb file. Before upload generate upload key.