An open API service indexing awesome lists of open source software.

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

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 🧪

**Try the queries on YASGUI**

### 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
```