Skip to content
×

Get statements

Get prediction

Returns a prediction.

Request:

GET /api/public/v1/prediction/:predictionId

The predictionId identifies the prediction which must belong to a project to which the user has read access.

Response:

{
    payload: {
        predictionId: string,
        projectId: string,
        parameters: object,
        state: string
    },
    status: "success"
}

The predictionId is the same as in the request. The projectId identifies the project to which the prediction belongs. The parameters object has the same fields as specified when the prediction was created, including the analysis and dataset identifiers. The state field will have one of the values pending, running, finished, or failed, reflecting the overall execution progress of the prediction task.

Example

$ http --body https://jadapi.jadbio.com/api/public/v1/prediction/314 \
       "Authorization: Bearer $(cat ~/.jadtoken)"
{
    "payload": {
        "parameters": {
            "analysisId": "79",
            "datasetId": "57",
            "modelKey": "best",
            "signatureIndex": 0
        },
        "predictionId": "314",
        "projectId": "16",
        "state": "finished"
    },
    "status": "success"
}

Get predictions

Returns a sublist of the predictions created using an analysis result.

Request:

GET /api/public/v1/analysis/:analysisId/predictions/:offset/:count

The analysisId identifies the analysis which must belong to a project to which the user has read permissions. Predictions form an ordered list from which the request extracts the sublist starting at offset and containing at most count elements. The list uses zero-based indexing, meaning the first element is at offset 0.

Constraints: Both offset and count must be non-negative integers and count can be at most 100.

Response:

{
    payload: {
        analysisId: string,
        offset: number,
        totalCount: number,
        data: {
            predictionId: string,
            projectId: string,
            parameters: object,
            state: string,
        }[]
    },
    status: "success"
}

The analysisId and offset are the parameters given in the request. The totalCount is the total number of predictions available for the analysis. The data array contains the predictions requested. The length of data will be the smaller of count and totalCountoffset. If the latter value is negative, the length will be zero. The predictionId identifies each prediction returned. The projectId identifies the project to which the prediction belongs. The parameters object has the same fields as specified when the prediction was created, including the analysis and dataset identifiers. The state field will have one of the values pending, running, finished, or failed, reflecting the overall execution progress of the prediction task.

Example

$ http --body https://jadapi.jadbio.com/api/public/v1/predictions/79/0/10 \
       "Authorization: Bearer $(cat ~/.jadtoken)"
{
    "payload": {
        "analysisId: "79",
        "data": [{
            "parameters": {
                "analysisId": "79",
                "datasetId": "57",
                "modelKey": "best",
                "signatureIndex": 0
            },
            "predictionId": "314",
            "projectId": "16",
            "state": "running"
        }, {
            "parameters": {
                "analysisId": "79",
                "datasetId": "58",
                "modelKey": "interpretable",
                "signatureIndex": 2
            },
            "predictionId": "315",
            "projectId": "16",
            "state": "pending"
        }],
        "offset": 0,
        "totalCount": 2
    },
    "status": "success"
}

Get prediction status

Returns the execution status of a prediction.

Request:

GET /api/public/v1/prediction/:predictionId/status

The predictionId must identify a prediction in a project to which the user has read permissions.

Response:

{
    payload: {
        predictionId: string,
        state: string,
        progress?: number
    },
    status: "success"
}

The predictionId field is the same as in the request URL. The state field will have one of the values pending, running, finished, or failed, reflecting the overall execution progress of the prediction task. The progress field will be present iff the prediction task is running and then indicates the prediction task completion ratio as a number between 0.0 and 1.0.

Example

$ http --body https://jadapi.jadbio.com/api/public/v1/prediction/314/status \
       "Authorization: Bearer $(cat ~/.jadtoken)"
{
    "payload": {
        "predictionId": "314",
        "progress": 0.43,
        "state": "running"
    },
    "status": "success"
}

Get prediction result

Downloads the result of a finished prediction task.

Request:

GET /api/public/v1/prediction/:predictionId/result?format=csv

The predictionId must identify a prediction in a project to which the user has read permissions.

Response:

The response body will be a comma-separated CSV file with a column header line and where each ensuing row has the name of an unlabeled sample as row header. All non-header entries are floating-point numbers.

Regression analysis

Column headers are Sample and Prediction. The prediction column contains the value of the outcome as predicted by the analysis model for the sample in question.

Classification analysis

Column headers are Sample followed by headers of the form Class '<class name>', one for each class in the outcome column of the dataset used to train the analysis model. The associated value in the row for a particular sample is the probability that the sample belongs to that class, according to the analysis model.

Survival analysis

Column headers are Sample and Prediction. The prediction column contains the estimated mortality as predicted by the analysis model for the sample in question. (See Ishwaran et al. Random survival forests. Ann. Appl. Stat. 2 (2008), no. 3, 841–860. doi:10.1214/08-AOAS169 for the definition of mortality.)

Example: Classification

$ http --body https://jadapi.jadbio.com/api/public/v1/prediction/314/result \
       format=csv \
       "Authorization: Bearer $(cat ~/.jadtoken)"
Sample,Class '0',Class '1'
sample1,0.92,0.08
sample2,0.9992653,7.347E-4
sample3,0.324,0.676
:

Delete prediction

Allows clients to delete a specified prediction.

Request:

POST /api/public/v1/prediction/:predictionId/delete

The predictionId identifies the prediction. It must belong to a project to which the user has write permissions.

Response:

{
    payload: {
        predictionId: string,
        projectId: string,
        parameters: object,
        state: string
    },
    status: "success"
}

The predictionId is the same as in the request. The projectId identifies the project to which the prediction belongs. The parameters object has the same fields as specified when the prediction was created, including the analysis and dataset identifiers. The state field will have one of the values pending, running, finished, or failed, reflecting the overall execution progress of the prediction task just before it was deleted.

Example

$ http --body POST https://jadapi.jadbio.com/api/public/v1/prediction/314/delete \
       "Authorization: Bearer $(cat ~/.jadtoken)"
{
    "payload": {
        "parameters": {
            "analysisId": "79",
            "datasetId": "57",
            "modelKey": "best",
            "signatureIndex": 0
        },
        "predictionId": "314",
        "projectId": "16",
        "state": "running",
    },
    "status": "success"
}



Note of appreciation to JADBio users

We constantly make changes in the software and do our best to update these materials, but you may notice some differences. We welcome your feedback on how to make this more useful for you and requests for future tutorials.