The Gene-Calc is a constantly developed tool dedicated for calculations related to biological sciences, especially focused in field of genetics. Application offers couple of tools such as:
- Hardy–Weinberg equilibrium calculator
- Chi-square tests:
- Independence (Associations) chi-square
- Chi-square goodness of fit test:
- Estimator of genetic distance
- Polymorphic information content and heterozygosity calculator
- Polymorphic information content & Heterozygosity
- Estimation of genetic distance
- Sequences Analysis Tools
- Dot plot
- Tool to obtain consensus sequence
- Additional tools
- Machine Learning Tools
- APMC - Automatic Predictive Model Constructor
- Python 3.7
- Flask
- MySQL 5.7
- Docker & Docker Compose
Make sure you have installed all of the following prerequisites on your development machine:
If you don't want to use Docker you have to install:
Create a virtual environment
$ python3 -m venv venv
Run a virtualenv environment
$ source venv/bin/activate
Install required packages with dev dependencies
$ pip install -r requirements/dev.txt
If you have problems with installation mysqlclient
package with the above command.
Try to install it by hand with pip install mysqlclient
Create config.env
file by copying config.env.tmp
and fill these with required environment variables
Export local environment variables
On Mac OS
$ set -o allexport; source config.env; set +o allexport;
In your local MySQL database
$ mysql -u root
$ CREATE DATABASE gene_calc;
$ exit
Apply application migrations:
$ flask db migrate
Next import data into your local database:
$ mysql -u root gene_calc < fixtures/data.sql
To start application locally type:
$ flask run
Application should be available under URL:
http://127.0.0.1:5000
To login into userpanel
Login: test123
Password: test123test123
If you want to run tests without docker you have to physically install a few tools:
without this tools it is impossible to correctly run the tests
To start local development using docker:
Create config.env
file by copying config.env.tmp
and fill these with required environment variables
Export local environment variables
On Mac OS
$ set -o allexport; source config.env; set +o allexport;
Start local containers:
$ docker-compose -f docker-compose.local.yml up
Load data into docker container
$ docker exec -i database mysql -u$MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE < fixtures/data.sql
Docker hints:
Rebuild containers:
$ docker-compose -f docker-compose.local.yml up --build
Stop containers:
$ docker-compose -f docker-compose.local.yml down
Stop containers with volume delete:
$ docker-compose -f docker-compose.local.yml down -v
Application should be available under URL:
http://127.0.0.1:5000
To login into userpanel
Login: test123
Password: test123test123
All required env variables are in config.env.tmp
file
If you want to start local development by docker you have to remember to correctly set up env variables in config.env
DOCKER=1
In case local development by virtualenv
DOCKER=0
To run tests via docker-compose type (remember that containers should be running):
docker-compose -f docker-compose.local.yml exec backend pytest -v
If you want to run the tests without docker you have to install dependencies which I have mentioned before in section
Local development [virtualenv]
then in root app directory type:
pytest -v
We use a pre-commit hook which checking a quality of code. To install a hook on your local repository, you have to run a command given below, after install required packages:
$ pre-commit install
We use Makefile to automate some common stuff
If you want to update dependencies type:
$ make update-deps
If you want to format code type:
$ make format
If you want to setup the whole docker environment type:
$ make start-docker
If you want to stop all project docker containers type:
$ make stop-docker
Create your feature branch from master.
Branch naming:
- pattern: trello-task-id-short-description
- eg: trello-20-remove-flask-admin
Commit names conventions:
- pattern. [trello-task-id]: commit description
- eg. [trello-20]: Removed flask-admin package
After finishing implementation of your feature - create pull request to master branch.
We are using CircleCI for continuous integration and continuous deployment.
On each time when Github PR is created the tests are run on CircleCI. When all tests passed and there is minimum one approve from a code review, then merge is possible. After merge to master branch CircleCI run deployment. So after this, if everything goes correctly changes should be visible on production.
We are using Sentry for monitoring app errors.
- I have problem with
mysql-client
installation in virtualenv
Comment out mysql-client form requirements/dev.txt
to complete installation all dev dependencies.
Like black, pre-commit etc. And use docker instead of virtualenv.
This project is licensed under the GNU GPL License
If you have any questions or ideas how to develop this app, please let us know via e-mail: contact@gene-calc.pl