Skip to content

MaastrichtU-IDS/openpredict-sparql-service

Repository files navigation

SPARQL endpoint for OpenPredict

A SPARQL endpoint to serve predictions generated using the OpenPredict classifier, using custom SPARQL functions. Built with 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

PREFIX openpredict: <https://w3id.org/um/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

PREFIX openpredict: <https://w3id.org/um/openpredict/>
SELECT * WHERE
{
  SERVICE <https://service.openpredict.137.120.31.102.nip.io/sparql> {
	SELECT ?drugOrDisease ?predictedForTreatment WHERE {
    	BIND("OMIM:246300" AS ?drugOrDisease)
    	BIND(openpredict:prediction(?drugOrDisease) AS ?predictedForTreatment)
	}
  }
}

Install and run ✨️

  1. Install dependencies
pip install -r requirements.txt
  1. Run the server on http://localhost:8000
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:

docker-compose up -d --build