This is an example OpenTox webservice for the lazar
prediction system and public data from the DSSTOX project.
Description | Method | URI | Parameters |
List all models | GET | /models | |
Show a single model | GET | /models/{id} | |
Predict smiles | GET | /models/{id} | smiles |
Create a model | POST | /models | structure_file, activity_file, username, password |
Delete a model | PUT | /models/{id} | username, password |
Success: XML file with requested information
Failure: Text with error description
To create a model you have to POST files with training data. Both input files should have 2 columns, delimited by a tab or whitespaces. No headers are allowed.
structure_file:
First column: (Unique) compound ID
Second column: Smiles string (structure_file)
activity_file:
First column: Compound ID
Second column: Toxic activity (1 (active) or 0 (inactive) for classification)
Note: numerical values for regression problems will be supported in a future version
You can provide more than one activity per compound ID (for replicated experiments). Activites without structures and structures without activities will be ignored.
curl -X GET http://localhost:3000/models
curl -X GET http://localhost:3000/models/1
Note: Detailed model annotations (data sources, endpoint definitions, validation results, …) will be provided by a separate component.
curl -X GET http://localhost:3000/models/1?smiles=c1cccc1N
Important: Smiles strings have to be URL encoded!
curl -X POST -F structure_file=
hamster_carcinogenicity.smi -F activity_file=hamster_carcinogenicity.class -F username=secret -F password=secret http://localhost:3000/models
curl -X DELETE -d username=secret -d password=secret http://localhost:3000/models/1
200 OK
404 Not Found
500 Internal Server Error
503 Service Unavailable
- Get the source code for the webservice
git clone git://github.com/helma/lazar-webservice.git
- Install lazar-core and prepare the lazar webservice
cd lazar-webservice
rake lazar:setup
If lazar-core does not compile
* Make sure, that you have the development libraries Swig, GSL, Boost, OpenBabel, R installed
* Configure R with ./configure --without-blas --enable-BLAS-shlib --enable-R-shlib
* Install the R kernlab package:
wget http://cran.r-project.org/src/contrib/kernlab_0.9-8.tar.gz
R CMD INSTALL kernlab_0.9-8.tar.gz
* Check the paths in the Makefile of lib/lazar-core and adjust them to your system settings
- Start the service
script/server
Now you should be able to contact localhost:3000 and use the REST API.