- Introduction
- Architectural design
- Development
- Testing and code formatting
- Continuous integration/CI
A web service for calculating the Levenshtein distance between two sequences.
In order to compare and study proteins, scientists have devised many computational techniques and algorithms. One such algorithm is the “Levenshtein distance”, which computes the distance between two string-like sequences. It is used as a simple measure of similarity between two proteins.
The aim of this project is to develop a web application where a user can compute the Levenshtein distance between two proteins.
Here is a graphical overview about the signup, login, job submission, job status check and job result retrieval flow:
Component | Framework/Tool |
---|---|
Calculate Levenshtein distance | Levenshtein module |
Protein sequence retrieval | UniProt REST API |
Web framework | Django |
Django backend database | Any relation database would do the trick, e.g. PostgresSQL or MySQL |
User management system | Django auth app |
Task Queue | Celery |
Task Queue Broker | RabbitMQ |
Task Queue Result Store | Re-use Django backend database - Django ORM |
Before you start make sure you have your private SSH Key added, which gives you access to certain GitHub organisation or private repos. You only have to do this once!
ssh-add /your/ssh/key/file/for/github
Every time you open a new console/terminal make sure your ssh-agent is running and all SSH keys are added.
eval `ssh-agent -s` && ssh-add
This could be achieved in different ways.
export DOCKER_BUILDKIT=1
export COMPOSE_DOCKER_CLI_BUILD=1
make build-service
docker-compose build
make migrate
make createsuperuser
And then the service can be started as following:
docker-compose up web
Now that the web server is running, visit http://127.0.0.1:8080/ with your web browser.
The login page can be accessed here
The registration page can be accessed here
and the job submission page here
For this project we are using pip-tools to manage all project dependencies. Apply changes to requirements.in and run pip-compile, which generates an updated version of requirements.txt.
For rsa keys run...
make pip-compile-rsa
For ed-25519 keys run...
make pip-compile-ed-25519
docker-compose up
OR use the following Makefile command:
make up
Certain services are marked with specific profiles. To start these services you have to use the --profile option in your docker-compose command.
docker-compose [--profile prometheus] up
Execute the postgres docker container to enter the terminal. You can do that for instance via Docker Desktop.
docker exec -it <container_name> /bin/sh
Connect to the Postgres database terminal:
psql -d <db-name> -U <username> -W
DB and user name as well as the password can be found and changed in the docker-compose file (see env var POSTGRES_DB etc.)
psql -d distance_service -U maxim -W
make pytest
OR you can run specific test like this...
docker-compose run --rm --entrypoint=sh <service-name> -c "pytest app/tests/unit/test_*.py"
make format
make lint
...
For this project code coverage is set up.