Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 33 Next »

General considerations

You can run predictions on OCHEM using simple REST-like web services.

 

Icon

Some OCHEM models (e.g. models aggregated using Bagging method), require significant amount of calculations.
Thus, prediction of even a single molecule can take a minute. However, predictions are cached and will be very fast for repetitive calls.

Way 1: "Request until done"

To post a prediction task for a molecule, run the following request:
https://ochem.eu/modelservice/getPrediction.do?modelId=YOUR_MODEL_ID&mol=YOUR_MOLECULE

where odel id the public model identifier or "model identity" (GUID) provided by OCHEM administration. If you plan to use predictions systematically, it is recommended to request a model identity (GUID).

For example, you can run
https://ochem.eu/modelservice/getPrediction.do?modelId=1&mol=c1ccccc1
the following request
to predict mutagenicity using AMES model https://ochem.eu/model/1

The molecule can be in SMILES or SD format. For both the formats, multiple molecules can be posted using $$$$ separator.
It is much more efficient to predict molecules in batches rather than posting separate tasks for each molecule.

The resulting JSON will look like:

The above response means that this molecule is new and it is being calculated at the moment.

Please, repeat the request at the periodic intervals (every 5-10 seconds) until the prediction result is returned in the following format:

 

Way 2: Using task IDs

Since a prediction is not instantaneous and can take several seconds to minutes, the prediction is performed asynchronously, that is in two steps:

  1. Start a prediction task and get a task ID
  2. Fetch your prediction task using the task ID from step (1). Keep fetching until the task is ready

The API for these two simple steps is described below.

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:

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:

When the task is ready, the JSON will look like:

Way 3: Using single SMILES

Another and a simpler way to get prediction is to use

https://ochem.eu/modelservice/getPrediction.do?modelId=YOUR_MODEL_ID&mol=YOUR_MOLECULE

request, e.g.,

https://ochem.eu/modelservice/getPrediction.do?modelId=1&mol=c1ccccc1

to predict mutagenicity using AMES model https://ochem.eu/model/1

You will get a similar JSON results as above, but without a need to use explicitly taskId. If results are not ready, try the same request in 20-30 seconds. Such calculations, however, can be  performed with only a single molecule.

 

  • No labels