Skip to main content

03. Modeling

How to create a disease model.

What is a Jinko Model?

A Jinko model is a computational representation of a disease or biological process used to simulate different scenarios and predict outcomes. Models can be used to simulate drug treatments, disease progression, and other conditions in a virtual population. Jinko supports several formats for models, such as SBML (XML), JSON (internal representation), and XLSX (SimBiology-compliant spreadsheets).

For more information on Jinko models, check out the guide.


Creating a Computational Model

To create a computational disease model in Jinko, you can post your model in one of three supported formats:

  • SBML (XML)
  • JSON (Jinko's internal model representation)
  • XLSX (following SimBiology standards)

The route for posting a model is described in the Jinko API documentation.

Example Request to Post a Model

You can post a model in the following formats. Below are examples of how to upload each type of model to the Jinko API.

1. Posting an SBML Model (XML Format)

import jinko_helpers as jinko

with open("sbml_model.xml", "rb") as f:
model = f.read()

jinko.make_request(
path="/core/v2/model_manager/jinko_model",
method="POST",
data=model,
options={
"name": "SBML Disease Model",
"input_format": "application/sbml+xml",
}
)

For more details on SBML support in Jinko, refer to the guide.

2. Posting a JSON Model (Internal Jinko Model Representation)

import jinko_helpers as jinko

# Load the model
with open("model.json", "r") as f:
model = json.load(f)

jinko.make_request(
path="/core/v2/model_manager/jinko_model",
method="POST",
json={"model": model},
options={
"name": "JSON Disease Model",
}
)

3. Posting an XLSX Model (SimBiology Standard)

import jinko_helpers as jinko

with open("simbiology_model.xlsx", "rb") as f:
model = f.read()

jinko.make_request(
path="/core/v2/model_manager/jinko_model",
method="POST",
data=model,
options={
"name": "XLSX Disease Model",
"input_format": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
}
)

Getting the Computational Model content

The computational model can be retrieved by its core item ID and snapshot ID in json format.

import jinko_helpers as jinko

model_content = jinko.make_request(
path=f"/core/v2/model_manager/jinko_model/{model_core_item_id}/snapshots/{model_snapshot_id}",
method="GET",
).json()

These examples show how to create and load a model by posting it to the Jinko API in different formats. The model is uploaded to a specified folder in your project workspace.

For more details on model creation and editing, refer to the guide on Computational Models.