Skip to content

duncanpeacock/fragalysis-backend

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Dev environment setup

Background

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

  • a Postgres database (note: this used to be MySQL)
  • a neo4j graph database
  • the fraglaysis stack
  • a transient data loader container

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

  • Docker
  • Docker-compose
  • Git

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:

  • Delete the 'mysql_data' folder located in the data folder (Step 3)
  • Delete the migrations by running the commands below in the project directory (Step 1)
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
find . -path "*/migrations/*.pyc"  -delete
  • In the 'fragalysis-frontend' folder rerun the docker compose command another two times
docker-compose -f docker-compose.dev.yml up

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.

About

Django backend loader and Restful API for fragalysis server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 79.5%
  • HTML 19.2%
  • Shell 1.2%
  • Dockerfile 0.1%