This is the backend API for TIN-X.
TIN-X (Target Importance and Novelty eXplorer) is an interactive visualization tool for illuminating associations between diseases and potential drug targets and is publicly available via https://datascience.unm.edu/tin-x/. TIN-X uses natural language processing to identify disease and protein mentions within PubMed content using previously published tools for named entity recognition (NER) of gene/protein and disease names.
See also the repo TIN-X UI.
- "TIN-X version 3: update with expanded dataset and modernized architecture for enhanced illumination of understudied targets", Vincent T. Metzger, Daniel C. Cannon, Jeremy J. Yang, Stephen L. Mathias, Cristian G. Bologa, Anna Waller, Stephan C. Schürer, Dušica Vidović, Keith J. Kelleher, Timothy K. Sheils, Lars Juhl Jensen, Christophe G. Lambert, Tudor I. Oprea, Jeremy S. Edwards, PeerJ 12:e17470, https://doi.org/10.7717/peerj.17470 (2024).
- "TIN-X: target importance and novelty explorer", Daniel C Cannon, Jeremy J Yang, Stephen L Mathias, Oleg Ursu, Subramani Mani, Anna Waller, Stephan C Schürer, Lars Juhl Jensen, Larry A Sklar, Cristian G Bologa, Tudor I. Oprea, Bioinformatics, Volume 33, Issue 16, 2601–2603, (2017) https://doi.org/10.1093/bioinformatics/btx200
In-progress with 2026 maintenance updates, docs/old has some (outdated) documentation.
Prerequisites:
- Clone the tinx-ui repo alongside this one (i.e.
../tinx-ui/). - Copy
.env.exampleto.envand fill in credentials:cp .env.example .env # edit .env — at minimum change MYSQL_ROOT_PASSWORD and DB_PASSWORD - Generate the MySQL tuning config:
This reads
./tune.sh
DB_CPUSandDB_MEMORYfrom.envand writesmysql-tuning.cnf.
Start all services:
docker compose -f docker-compose-dev.yml up --buildThis brings up four services:
| Service | Description | Default port |
|---|---|---|
ui |
Dev server for the TIN-X UI (hot-reload) | 8080 |
api |
Django REST API | 8000 |
db |
MySQL 8.0 via unmtransinfo/tinx_db — downloads and restores the TIN-X database on first boot |
internal only |
solr |
Solr 6.6.6 search index | internal only |
First-time startup will take a while as the db service downloads and restores the database dump (likely several hours).
After the database is ready, rebuild the Solr search index:
docker compose -f docker-compose-dev.yml exec api python manage.py rebuild_indexIf running the development version of TIN-X on another server (e.g., shishito.health.unm.edu), one can use SSH port-forwarding to access the api:
# Replace 8000 with your TINX_API_PORT
ssh -L 8000:localhost:8000 shishito.health.unm.eduThen one can go to http://localhost:8000/ to view the API in-browser.
The same goes for the UI, just use TINX_UI_HTTP_PORT instead of 8000 above.
Note: The production
docker-compose.ymlis being updated and is not yet ready for use. Usedocker-compose-dev.ymlfor now.
You will first need to launch the development environment using the instructions above. Then, one can run tests with:
docker compose -f docker-compose-dev.yml exec api python manage.py test api.tests --verbosity=2If one finds they need to update dependencies (requirements.txt), the following steps can be followed:
- If a new package is required, add it to requirements.in
- Setup and activate a Python (v3.12) virtual environment. For example, with conda use:
conda create -n tinx-api python=3.12 && conda activate tinx-api - Install pip-tools:
pip install pip-tools - Compile new requirements:
pip-compile --upgrade- If there are issues with
mysqlclientyou may need to install some system-deps, refer to: https://pypi.org/project/mysqlclient/
- If there are issues with
- (Optional) Test the update locally in your environment:
pip-sync
Note: If you need to update the Python version, make sure to adjust the steps above accordingly and to update the Python image in the Dockerfile.
This project uses pre-commit hooks to automatically format Python code with isort and Black, and formats Docker Compose files with DCLint before each commit.
Setup (one-time):
pre-commit installRunning hooks manually:
You can run all pre-commit hooks manually without committing:
pre-commit run --all-files- Create GitHub actions workflow to publish built API image to DockerHub
- Update docker-compose.yml, remove unnecessary prod dependencies (certbot, nginx)