https://github.com/maastrichtu-ids/openpredict-sparql-service
SPARQL service for OpenPredict, based on rdflib-endpoint
https://github.com/maastrichtu-ids/openpredict-sparql-service
disease drug federated-query sparql translator
Last synced: 6 months ago
JSON representation
SPARQL service for OpenPredict, based on rdflib-endpoint
- Host: GitHub
- URL: https://github.com/maastrichtu-ids/openpredict-sparql-service
- Owner: MaastrichtU-IDS
- License: mit
- Created: 2021-05-27T15:20:09.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-05-31T12:53:07.000Z (over 4 years ago)
- Last Synced: 2025-02-14T01:26:14.299Z (8 months ago)
- Topics: disease, drug, federated-query, sparql, translator
- Language: Python
- Homepage: https://service.openpredict.137.120.31.102.nip.io
- Size: 13.7 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SPARQL endpoint for OpenPredict
A SPARQL endpoint to serve predictions generated using the OpenPredict classifier, using custom SPARQL functions. Built with [rdflib-endpoint](https://github.com/vemonet/rdflib-endpoint)
Access the SPARQL service endpoint at https://service.openpredict.137.120.31.102.nip.io/sparql
OpenAPI docs at https://service.openpredict.137.120.31.102.nip.io
## Available functions 🧪
### Get predictions
Query OpenPredict classifier to get drug/disease predictions
```SPARQL
PREFIX openpredict:
SELECT ?drugOrDisease ?predictedForTreatment ?predictedForTreatmentScore WHERE {
BIND("OMIM:246300" AS ?drugOrDisease)
BIND(openpredict:prediction(?drugOrDisease) AS ?predictedForTreatment)
```### Try a federated query
Use this federated query to retrieve predicted treatments for a drug or disease (OMIM or DRUGBANK) from any other SPARQL endpoint supporting federated queries.
**From another SPARQL endpoint**
```SPARQL
PREFIX openpredict:
SELECT * WHERE
{
SERVICE {
SELECT ?drugOrDisease ?predictedForTreatment WHERE {
BIND("OMIM:246300" AS ?drugOrDisease)
BIND(openpredict:prediction(?drugOrDisease) AS ?predictedForTreatment)
}
}
}
```## Install and run ✨️
1. Install dependencies
```bash
pip install -r requirements.txt
```2. Run the server on http://localhost:8000
```bash
uvicorn main:app --reload --app-dir app
```## Or run with docker 🐳
Checkout the `Dockerfile` to see how the image is built, and run it with the `docker-compose.yml`:
```bash
docker-compose up -d --build
```