A web interface that allows searching through Variant of Unknown Significance (VUS).
Important dependencies:
.
|──────run.py - used to run the flask app, also doubles as .wsgi file
|──────src/
| |────__init__.py - creats the needed managers for Flask, Flask-PyMongo and Flask-Login
| |────config.py - configuration for the whole app
| |────datatable.py - class for querying MongoDB on the backend, returns data for datatables.js
| |────forms.py - contains Flask-WTF forms
| |────models.py - contains user model
| |────static/ (.css .js .png)
| |────templates/ (.html)
| |────views/ (.py)
| | |──main.py - manages handling for urls
| | |──auth.py - manages handling for account-related urls, eg. /login, /logout, etc.
|──────extra/ - importing data scripts and logging
| |────import_data.py - loads new analyses from Alissa to import in MongoDB (VUSualizer)
| |────config.py - configuration for the import data script
| |────logging_config.yml - for logging files of the import data script
Due to the amount of data, data needs to be filtered through the server.
As of right now, two templates contain the client-sided datatables.js code:
- base.html
- all.html
There are some "apis" that datatables.js interacts with. They are accessed through:
- /_get_all_data
- /_get_variant_data
- /_get_gene_data
- /_get_patient_data
These urls are handled in main.py. The program then uses the DataTablesServer class from datatable.py to query the database and return the data back to datatables.js to create a browsable table.
- Make a Python 3.6.8 venv in correct spot on server and install any requirements with pip:
$ python3 -m venv venv
$ source ./venv/bin/activate
$ pip install -r requirements.txt
If you receive a pip install error and it is due to the "mod_wsgi" package, this is not needed locally. use '#' before that package to prevent it from installing. 2. Install MongoDB (Local MacOS example): https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
$ brew tap mongodb/brew
$ brew install [email protected]
$ brew services start [email protected]
- Configure the config.py (in src folder) and fill in a random string for the SECRET_KEY. The app will not work without a SECRET_KEY. A random string can be generated by using for example String Generator or any other string generator. Do not share this code with others, as this could potentially be used to generate fake cookies for logins. Changing it will result in users needing to login again, as the sessions are not valid anymore. (Optional) Configurate MONGO_URI in config.py if you're using different user details and/or database name
- Configure the config.py (in extra folder) for Alissa credentials and the location of the logging_config.yml file and VUSualizer app
- Load data into MongoDB with script in the "extra" folder.
$ (venv) python import_data.py
- Add crontab to automatically check Alissa for new analyses (example shown below. every day on 3AM). This needs to be done with the admin user of the server.
$ 0 3 * * * /path/to/VUSualizer/extra/import_data.py >> /path/to/VUSualizer/extra/cronlogs.log 2>&1
Activate venv and then start the app
source venv/bin/activate
flask run
gunicorn -w 4 src:app
- Configure the config.py (in extra folder) for VUSualizer location (required) and Alissa credentials (not required for running app)
- If development for import_data.py (not required for running app) -->
- Change shebang python to
#!/usr/bin/env python3
or local equivalent - Change filename parameter in logging_config.yml to correct local path
- Activate venv
$ source ./venv/bin/activate
- Run run.py
$ python run.py
- Not connected to the UMCU server (either via VPN, on location (WiFi) or follow-me workspace)
- Service needs to be restarted:
$ sudo /bin/systemctl stop vusualizer-wsgi.service
$ sudo /bin/systemctl start vusualizer-wsgi.service