Skip to content

i-VRESSE/haddock3-webapp

Repository files navigation

Web application for haddock3

Research Software Directory Badge DOI fair-software.eu Node.js CI

Haddock3 (High Ambiguity Driven protein-protein DOCKing) is a an information-driven flexible docking approach for the modeling of biomolecular complexes. This software wraps the the haddock3 command line tool in a web application. The web application makes it easy to make a configuration file, run it and show the results.

Uses

sequenceDiagram
    Web app->>+Web app: Login
    Web app->>+Builder: Construct workflow config
    Web app->>+Haddock3 restraints web service: Calculate restraints
    Builder->>+Bartender: Submit job
    Bartender->>+haddock3 CLI: Run
    Web app->>+Bartender: State of job
    Web app->>+Bartender: Result of job

Setup

The web app is written in Node.js to install dependencies run:

npm install

Configuration of the web application is done via .env file or environment variables. For configuration of authentication & authorization see docs/auth.md. For configuration of job submission see docs/bartender.md#configuration. For configuration of how to rewrite the submitted workflow file see docs/reewite.md. Use .env.example as a template:

cp .env.example .env
# Edit .env file

Create rsa key pair for signing & verifying JWT tokens for bartender web service with:

openssl genpkey -algorithm RSA -out private_key.pem \
    -pkeyopt rsa_keygen_bits:2048
openssl rsa -pubout -in private_key.pem -out public_key.pem

Bartender web service

The bartender web service should be running if you want to submit jobs. See docs/bartender.md how to set it up.

Haddock3 restraints web service

The scenario forms uses the haddock3 restraints web service. to calulate restraints based on given active residues and structures.

For the web application to use this service, it needs to be running with

# Activated Python environment with haddock3, fastapi and uvicorn installed
uvicorn --port 5000 haddock.clis.restraints.webservice:app

If not running on http://localhost:5000 then set the HADDOCK3_RESTRAINTS_URL environment variable.

See docs/scenarios.md for more information on how the web application uses the restraints web service.

Development

Develop inside devcontainer

You can develop inside a devcontainer inside Visual Studio Code. The devcontainer includes all services required by the webapp. You just have to supply the cns executable as ./deploy/cns file, see deployment, before building/starting the containers.

Development outside devcontainer

To develop the webapp ouside a devcontainer you have the following services running:

  1. PostgreSQL database for user management
  2. Bartender web service for job executation and input/output storage.
  3. Haddock3 restraints web service for calculating restraints on scenario pages.

The PostgreSQL database can be started in a container with

npm run docker:dev

(Stores data in a Docker volume) (You can get a psql shell with npm run psql:dev) (On CTRL-C the database is stopped. To remove container and volume use npm run docker:devrm)

The database must be initialized with

npm run setup
# This will create tables

Start development server

Start remix development server from your terminal with:

npm run dev

This will refresh & rebuild assets on file changes.

Other development commands

The database setup should be run only once for a fresh database. Whenever you change the app/drizzle/schema.server.ts file you need to run npm run generate:migration to generate a migration, edit generated app/drizzle/*.sql file if needed and then run npm run setup to apply migration to database.

To format according to prettier run

npm run format

It's recommended to install an editor plugin (like the VSCode Prettier plugin) to get auto-formatting on save.

To lint according eslint run

npm run lint

To check the Typescript types run

npm run typecheck

For testing see docs/testing.md.

Deployment

First, build your app for production:

npm run build

Then run the app in production mode:

export $(cat .env |grep -v '#' |xargs)
npm start

Other deployments with containers are explained in deploy/README.md.

Stack

The tech stack is explained in docs/stack.md.