You can run predictions on OCHEM using simple REST-like web services.
Since a prediction is not an instantaneous task and can take several seconds to minutes, the prediction is performed asynchroniously, that is in two steps:
To post a task, run the following request:
https://ochem.eu/modelservice/postModel.do?modelId=YOUR_MODEL_ID&mol=YOUR_MOLECULE
The resulting JSON will look like:
{ "modelResponse": { "taskId": "1000042989", "metaserverTaskId": "-1", "status": "success" } } |
Given that the result.modelResponse.status is "success", the task ID used for retrieving the predictions is result.modelResponse.taskId
To fetch the model, use the following request:
http://ochem.eu/modelservice/fetchModel.do?taskId=YOUR_TASK_ID
If the task is still running, the resulting JSON will look like:
{ "web-root": "http://localhost:8080/", "modelResponse": { "taskId": "0", "metaserverTaskId": "0", "status": "pending" } } |
When the task is ready, the JSON will look like:
{ "modelResponse": { "taskId": "0", "predictions": { "moleculeID": "1002136505", "predictions": { "unit": "-log(mmol/L)", "predictedValueString": "2.7139999866485596", "value": "2.7139999866485596", "dm": "0.8611000180244446", "property": "log(IGC50-1)", "accuracy": "0.7065203028344436", "realValue": "0.0" }, "depictionID": "1000651576" }, "metaserverTaskId": "0", "status": "success", "modelDescriptionUrl": "http://ochem.eu/model/3" } } |
{ "modelResponse": { "taskId": "0", "predictions": { "moleculeID": "4492", "predictions": { "unit": "-log(mmol/L)", "predictedValueString": "0.7695", "value": "0.7695", "dm": "0.2294", "property": "log(IGC50-1)", "accuracy": "0.4313671566856475", "realValue": "0.0" }, "depictionID": "1000618460" }, "metaserverTaskId": "0", "status": "success" } } |