Model
Provides access to OpenTox prediction models
Model
Component description
Provides different representations for QSAR/toxicology models. Models are the output/result of learning algorithms. To make use of a model for prediction, it is necessary to have a dataset with compatible descriptors/features. If the dataset_service parameter is stated, a new dataset will be created if on the other hand the result_dataset parameter is stated, the stated dataset will be updated with the predicted feature values. In other words, a new "column" for the predictions is added to the input dataset. If none of the two parameters is given, a default dataset service is used and a new dataset is created.
REST operations
Description |
Method |
URI |
Parameters |
Result |
Status codes |
Get a list of all available models | GET | /model | (optional) ?query=URI-of-the-owl:sameAs-entry |
List of model URIs or RDF representation If query specified, returns all models, for which owl:sameAs is given by the query |
200,404,503 |
Get the representation of a model | GET | /model/{id} | - | Representation of the model in a supported MIME type |
200,404,503 |
Delete a model | DELETE | /model/{id} | - | - | 200,404,503 |
Apply a model to predict a dataset |
POST | /model/{id} | dataset_uri=dataseturi result_dataset=result_dataseturi dataset_service=datasetserviceuri |
URI of created prediction dataset (predictions are features), task URI for time consuming computations | 200,202,400,404,500,503 |
Apply a model to predict a compound |
POST | /model/{id} | compound_uri=compounduri | Prediction in a supported MIME type, task URI for time consuming computations | 200,202,400,404,500,503 |
Notes:
- dataset_uri=datasetURI is mandatory parameter
- result_dataset=result_datasetURI,
pointing to a resulting dataset. This dataset will be updated with the
predicted feature values.
- dataset_service=datasetserviceURI, pointing to a dataset service. A new dataset with predicted feature values will be created.
- either result_dataset or dataset_service
parameter might be present.
- If neither of result_dataset or dataset_service parameter is specified, the model service uses a pre-configured dataset service.
Model variables
REST operations
Description | Method | URI | Parameters | Result | Status codes | |
List of independent variables | GET | /model/{id}/independent | - | URI-list/RDF of features used as independent variables | 200,404,503 | |
List of dependent variables | GET | /model/{id}/dependent | - | URI-list/RDF of features used as dependent variables | 200,404,503 | |
List of predicted features | GET |
|
- | URI-list/RDF of features, where predictions are stored | 200,404,503 |
This facilitates extracting specified feature values per compound , e.g. /compound/{cid}?feature=/model/{id}/independent&?feature=/model/{id}/predicted will return representation of the compound with values for independent variables as well as predicted feature values
Example curl calls
Get a list of all available model URIs at TUM (-X GET is default and could be ignored here):
curl -X GET -H 'Accept:text/uri-list' http://opentox.informatik.tu-muenchen.de:8080/OpenTox-dev/model
Get an RDF XML representation of all available models at NTUA (RDF XML is the default representation; you could also paste the URI to the adress bar of your browser):
curl http://opentox.ntua.gr:3000/model
Get the RDF XML representation of model TUMOpenToxModel_kNN_9 (RDF XML is the default representation):
curl -X GET http://opentox.informatik.tu-muenchen.de:8080/OpenTox-dev/model/TUMOpenToxModel_kNN_9
Make a prediction for ambit dataset 1038 with model TUMOpenToxModel_kNN_95:
curl -X POST -d 'dataset_uri=http://apps.ideaconsult.net:8080/ambit2/dataset/1038' \ -d 'dataset_service=http://apps.ideaconsult.net:8080/ambit2/dataset/' \ http://opentox.informatik.tu-muenchen.de:8080/OpenTox-dev/model/TUMOpenToxModel_kNN_95
Model representation
RDF representation defined in opentox.owl examples
The RDF representation contains metadata (e.g. algorithm, training dataset, parameters, dependent/independent variables) about the model. You should use PMML (if supported) to retrieve a portable version of the model.
Metadata
- training algorithm
- training dataset
- training
parameters
- independent variables
- dependent
variables
Supported MIME types
Mandatory:
- application/rdf+xml (default)
Optional:
- application/xml (PMML)
- text/xml (PMML)
- text/x-yaml
- text/x-json
- application/json
- ...
HTTP status codes
Interpretation | Nr | Name |
Success | 200 | OK |
Asynchronous task accepted |
202 | Accepted |
Dataset_id is wrong | 400 | Bad Request |
Model for specific id not found | 404 | Not Found |
Prediction error | 500 | Internal server error |
Service not available | 503 | Service unavailable |
URI returned on Model POST