01. Model creation: mechanism files and the SBML model
Download the notebook (executed for this page) · source
What this tutorial shows. Where a PhosKinTime model comes from. The reactions of every model are declared in a
mechanism file (TOML, format phoskintime-mechanism/1); PhosKinTime's four models are the files in
models/. From a mechanism file and a network,
PhosKinTime writes an SBML model (with sbmlutils), and every simulation, fit, profile and posterior runs on that
model in libroadrunner. We read a built-in file, build and simulate the SBML model of the example network, write a
mechanism of our own for another modification type, and run the same network with it.
Place in the series. This is where the series starts: the model. Tutorials 02 and 03 cover the input files and the network weights the model is built on, 04 and 05 the parameters and the objective, 06 to 08 the fit and its uncertainty, 09 and 10 a whole run from the command line and from the library.
Data. The synthetic example project (phoskintime.networkmodel.example), written to a temporary folder. Its curves and weights
are invented; nothing here describes a biological system.
# Setup. Find the repository root (the folder with configs/config.toml and phoskintime/), put it on sys.path and work from
# there. A Jupyter kernel started outside pixi does not get pixi's PYTHONPATH, hence the sys.path line.
import logging
import os
import sys
import tempfile
from pathlib import Path
REPO_ROOT = Path.cwd().resolve()
while not ((REPO_ROOT / "configs" / "config.toml").is_file() and (REPO_ROOT / "phoskintime").is_dir()):
if REPO_ROOT.parent == REPO_ROOT:
raise RuntimeError("Start this notebook inside the PhosKinTime repository.")
REPO_ROOT = REPO_ROOT.parent
if str(REPO_ROOT) not in sys.path:
sys.path.insert(0, str(REPO_ROOT))
os.chdir(REPO_ROOT)
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
pd.set_option("display.width", 140)
pd.set_option("display.max_colwidth", 80)
logging.disable(logging.INFO) # hide PhosKinTime's INFO log lines; warnings are still shown
from phoskintime.networkmodel import api
# Everything this tutorial writes goes into a new temporary folder, never into the repository.
WORK = Path(tempfile.mkdtemp(prefix="phoskintime-tutorial-01-"))
CONF = api.write_example(WORK / "project", n_starts=2, cores=1) # synthetic inputs + config.toml
print("example project:", CONF.parent)
example project: /tmp/phoskintime-tutorial-01-srmnuj1s/project
1. The model files
A PhosKinTime model has two parts.
- The network part, the same for every model and built by PhosKinTime from the inputs: the kinase drive
\(K_k(t)\) (a PCHIP curve through the kinase's measured protein fold changes) scaled by a fitted \(c_k\), the inflow of
each modification site \(S = W\,(c \odot K)\) with the KinOpt weights \(W\), the TF input of each gene with the TFOpt
weights, and the transcription rate
synthbuilt from it. - The mechanism: per protein, which species exist and which reactions connect them, with their rate laws. This part is a file.
PhosKinTime ships one file per model family. The family fixes the state layout (which species a protein has); the reactions and rate laws inside it are the file's.
from phoskintime.networkmodel import mechanism as mech
rows = []
for path in sorted(mech.MODELS_DIR.glob("*.toml")):
m = mech.load(path)
rows.append({"file": f"models/{path.name}", "family": m.family, "model code": m.model_code, "PTM": m.ptm["name"],
"reactions": len(m.reactions), "description": m.doc})
pd.DataFrame(rows)
| file | family | model code | PTM | reactions | description | |
|---|---|---|---|---|---|---|
| 0 | models/combinatorial.toml | combinatorial | 2 | phosphorylation | 6 | mRNA -> protein -> one form per modification pattern (combinatorial) |
| 1 | models/distributive.toml | distributive | 0 | phosphorylation | 7 | mRNA -> protein -> one form per modified site (distributive) |
| 2 | models/saturation.toml | saturation | 4 | phosphorylation | 7 | as distributive, with saturating translation C·R/(1+R) and modification S·P/... |
| 3 | models/sequential.toml | sequential | 1 | phosphorylation | 7 | mRNA -> protein -> modification chain in residue order (sequential) |
The family names the layout:
| family | species per protein | site states |
|---|---|---|
| distributive (0) | mRNA R, unmodified protein P, one form X per site |
each site independently |
| sequential (1) | R, P, one form per number of modified sites |
sites modified in residue order |
| combinatorial (2) | R, one form M per modification pattern (\(2^n\) for \(n\) sites) |
every pattern |
| saturation (4) | as distributive | modification saturates in P |
The run's family is [networkmodel.models] default_model in config.toml. Here is the distributive file in full:
print((mech.MODELS_DIR / "distributive.toml").read_text(encoding="utf-8"))
# PhosKinTime mechanism file (format phoskintime-mechanism/1): model 0, distributive.
#
# Per protein: mRNA R, unmodified protein P and one form X per site (each X carries one modified site; P feeds every
# site form). The network part (kinase drives, the site inflow S = W·(c_k·K), the TF input and the synthesis rate
# `synth`) is shared by every mechanism and built by PhosKinTime (networkmodel.exchange.sbml.make_plan); this file
# declares the reactions and their rate laws. Full reference: docs/Documentation/mechanisms.md.
format = "phoskintime-mechanism/1"
[mechanism]
name = "distributive"
family = "distributive" # state layout: distributive | sequential | combinatorial | saturation
doc = "mRNA -> protein -> one form per modified site (distributive)"
[ptm]
name = "phosphorylation"
modification = "phosphorylation" # reaction kind of the modification step
demodification = "dephosphorylation" # reaction kind of the reverse step
[[reactions]]
kind = "transcription"
per = "protein"
products = ["R"]
modifiers = "regulators"
rate = "{synth}"
sbo = "SBO:0000183"
go = "GO:0006351"
[[reactions]]
kind = "mrna_decay"
per = "protein"
reactants = ["R"]
rate = "{B} * {R}"
sbo = "SBO:0000179"
go = "GO:0006402"
[[reactions]]
kind = "translation"
per = "protein"
products = ["P"]
modifiers = ["R"]
rate = "{C} * {R}"
sbo = "SBO:0000184"
go = "GO:0006412"
[[reactions]]
kind = "protein_decay"
per = "protein"
reactants = ["P"]
rate = "{D} * {P}"
sbo = "SBO:0000179"
go = "GO:0030163"
[[reactions]]
kind = "phosphorylation"
per = "site"
reactants = ["P"]
products = ["X"]
modifiers = "site_kinases"
rate = "{S} * {P}"
reversible_if_signed_drive = true
sbo = "SBO:0000216"
go = "GO:0006468"
[[reactions]]
kind = "dephosphorylation"
per = "site"
reactants = ["X"]
products = ["P"]
rate = "{E} * {X}"
sbo = "SBO:0000330"
go = "GO:0006470"
[[reactions]]
kind = "phospho_decay"
per = "site"
reactants = ["X"]
rate = "({D} + {Dp}) * {X}"
sbo = "SBO:0000179"
go = "GO:0030163"
How to read a reaction entry:
peris the scope:proteinwrites the reaction once per protein,siteonce per modification site (combinatorial files usestateandstate_site);reactants,productsandmodifiersname species symbols of the scope (R,P,X, ...).modifierscan also be"regulators"(the gene's TFs) or"site_kinases"(the kinases of the site in \(W\)), so the SBML model records who drives the reaction;rateis an SBML infix formula with{symbol}placeholders. Parameters ({B},{C},{D},{E},{Dp}), the site inflow{S}andsynthare filled in per protein and site;sboandgoannotate the reaction with its SBO term and its GO biological process.
The symbols each scope offers are listed in the module docstring of phoskintime.networkmodel.mechanism:
pd.DataFrame({"scope": list(mech.SYMBOLS),
"symbols": [", ".join(sorted(s)) for s in mech.SYMBOLS.values()],
"species among them": [", ".join(sorted(s & mech.SPECIES)) for s in mech.SYMBOLS.values()]})
| scope | symbols | species among them | |
|---|---|---|---|
| 0 | protein | A, B, C, D, E, M0, P, R, gene, synth | M0, P, R |
| 1 | site | A, B, C, D, Dp, E, P, R, S, X, gene, prev, site, synth | P, R, X, prev |
| 2 | state | A, B, C, D, D_state, E, M, M0, R, gene, m, synth | M, M0, R |
| 3 | state_site | A, B, C, D, D_state, Dp, E, M, M0, M_to, R, S, gene, m, site, synth | M, M0, M_to, R |
The distributive model's equations follow from these reactions. For protein \(i\) with sites \(j\):
with \(S_{ij}(t) = \sum_k W_{ij,k}\, c_k K_k(t)\). The full model description, including the TF input and the synthesis rate, is on the Global Network Model page.
2. The SBML model of the example network
api.problem builds what a run would fit, without fitting: the network, the System with its mechanism, the parameter
layout and the objective (the next tutorials go through each of them). Its System carries the SBML model that every
simulation uses (phoskintime.networkmodel.simulate_sbml.model_of).
from phoskintime.networkmodel.simulate_sbml import model_of
prob = api.problem(CONF, work_dir=WORK / "problem")
sbml_model = model_of(prob.sys)
print("mechanism:", prob.sys.mechanism.name, "| file:", Path(prob.sys.mechanism.path).relative_to(REPO_ROOT))
print("proteins:", prob.idx.proteins, "| kinases:", prob.idx.kinases)
print("sites:", dict(zip(prob.idx.proteins, prob.idx.sites)))
model_xml = WORK / "example_model.xml"
model_xml.write_text(sbml_model.sbml, encoding="utf-8")
print(f"SBML: {model_xml.stat().st_size / 1024:.0f} kB")
[TF] orphan TF T2 has no mrna data to drive it: fallback its own state (data_drive_fallback)
[TF] orphan TF T3 has no mrna data to drive it: fallback its own state (data_drive_fallback)
[TF] observations of data-driven TFs ['T1'] are inputs: 9 rows removed from the loss
SBML written to /tmp/phoskintime_sbml_xgwz0qfm/model.xml model 'phoskintime_distributive', 0.05 s
mechanism: distributive | file: models/distributive.toml
proteins: ['A', 'B', 'K1', 'T1', 'T2', 'T3'] | kinases: ['K1', 'K2']
sites: {'A': ['S_1', 'S_2'], 'B': ['Y_4'], 'K1': ['T_3'], 'T1': [], 'T2': [], 'T3': []}
SBML: 179 kB
The model is valid SBML Level 3 Version 2 with units on every quantity; validate_sbml runs libsbml's consistency
checks with every category on, units included:
from phoskintime.networkmodel.exchange.sbml_model import validate_sbml
check = validate_sbml(model_xml)
print("errors:", check["errors"], "| warnings:", check["warnings"])
errors: 0 | warnings: 0
The reactions of the SBML file, read back with libsbml. Every reaction id is rx_<kind>_<label>, with the kind from
the mechanism file; the modifiers show which kinases drive each phosphorylation:
import libsbml
doc = libsbml.readSBMLFromFile(str(model_xml))
model = doc.getModel()
def cv_terms(sbase):
"""The BQBIOL 'is' resources of an SBML element (the GO term of a reaction)."""
out = []
for k in range(sbase.getNumCVTerms()):
cv = sbase.getCVTerm(k)
out += [cv.getResourceURI(j).rsplit("/", 1)[-1] for j in range(cv.getNumResources())]
return ", ".join(out)
reactions = pd.DataFrame([{
"id": r.getId(),
"reactants": " + ".join(s.getSpecies() for s in r.getListOfReactants()),
"products": " + ".join(s.getSpecies() for s in r.getListOfProducts()),
"modifiers": ", ".join(s.getSpecies() for s in r.getListOfModifiers()),
"rate law": libsbml.formulaToL3String(r.getKineticLaw().getMath()),
"SBO": r.getSBOTermID(),
"annotation": cv_terms(r),
} for r in model.getListOfReactions()])
print(model.getNumSpecies(), "species,", model.getNumReactions(), "reactions,", model.getNumParameters(),
"parameters,", model.getNumRules(), "assignment rules")
reactions[reactions["id"].str.endswith("_A") | reactions["id"].str.contains("_A_")]
19 species, 36 reactions, 67 parameters, 33 assignment rules
| id | reactants | products | modifiers | rate law | SBO | annotation | |
|---|---|---|---|---|---|---|---|
| 0 | rx_transcription_A | R_A | TFD_T1, P_T2 | synth_A | SBO:0000183 | GO:0006351 | |
| 1 | rx_mrna_decay_A | R_A | B_A * R_A | SBO:0000179 | GO:0006402 | ||
| 2 | rx_translation_A | P_A | R_A | C_A * R_A | SBO:0000184 | GO:0006412 | |
| 3 | rx_protein_decay_A | P_A | D_A * P_A | SBO:0000179 | GO:0030163 | ||
| 4 | rx_phosphorylation_A_S_1 | P_A | X_A_S_1 | K_K1 | S_A_S_1 * P_A | SBO:0000216 | GO:0006468 |
| 5 | rx_dephosphorylation_A_S_1 | X_A_S_1 | P_A | E_A * X_A_S_1 | SBO:0000330 | GO:0006470 | |
| 6 | rx_phospho_decay_A_S_1 | X_A_S_1 | (D_A + Dp_A_S_1) * X_A_S_1 | SBO:0000179 | GO:0030163 | ||
| 7 | rx_phosphorylation_A_S_2 | P_A | X_A_S_2 | K_K1, K_K2 | S_A_S_2 * P_A | SBO:0000216 | GO:0006468 |
| 8 | rx_dephosphorylation_A_S_2 | X_A_S_2 | P_A | E_A * X_A_S_2 | SBO:0000330 | GO:0006470 | |
| 9 | rx_phospho_decay_A_S_2 | X_A_S_2 | (D_A + Dp_A_S_2) * X_A_S_2 | SBO:0000179 | GO:0030163 |
The reactions of protein A, as the file declares them: transcription, mRNA decay, translation and protein decay once
for the protein, and phosphorylation, dephosphorylation and decay of the modified form once per site (S_1, S_2). The
network part are assignment rules: the kinase activity, the site inflows S and the TF input. Those of protein A:
rules = pd.DataFrame([{"variable": r.getVariable(), "formula": libsbml.formulaToL3String(r.getMath())}
for r in model.getListOfRules()])
rules[rules["variable"].str.contains("_A")]
| variable | formula | |
|---|---|---|
| 5 | S_A_S_1 | 1 dimensionless * Kt_K1 |
| 6 | S_A_S_2 | 1 dimensionless * Kt_K1 + 0 dimensionless * Kt_K2 |
| 9 | TFinput_A | (0.36 dimensionless * TFD_T1 + 0.4 dimensionless * Ptotal_T2) / 0.76 dimensi... |
| 10 | q_A | TFinput_A / (1 dimensionless + abs(TFinput_A)) |
| 11 | Ptotal_A | P_A + X_A_S_1 + X_A_S_2 |
| 12 | synth_A | piecewise(A_A * (1 dimensionless + tf_scale * q_A / (1 dimensionless + q_A +... |
3. Simulate the model
The objective simulates this model in libroadrunner (CVODE) at the run's tolerances. trajectory sets the parameters
of a raw parameter vector θ (here the fit's first start) on the System and integrates from the initial state; with the
parameters set, simulate gives the trajectory at any times.
from phoskintime.networkmodel.simulate_sbml import simulate
objective = prob.numpy_objective()
t_grid, Y_grid = objective.trajectory(prob.theta_start) # sets θ on the System; the solver grid of the fit
t_dense = np.unique(np.concatenate([np.linspace(0.0, float(t_grid[-1]), 400), t_grid]))
Y = simulate(prob.sys, t_dense, y0=prob.sys.data_y0(), **objective.tol)
states = list(sbml_model.state_map) # species ids in PhosKinTime's state order
print(f"{Y.shape[0]} times x {Y.shape[1]} states; solver tolerances {objective.tol}")
pd.DataFrame({"y(0)": Y[0], f"y({t_dense[-1]:g} min)": Y[-1]}, index=states).round(4)
413 times x 16 states; solver tolerances {'rtol': 1e-08, 'atol': 1e-08, 'max_steps': 200000}
| y(0) | y(960 min) | |
|---|---|---|
| R_A | 1.00 | 29.9529 |
| P_A | 0.70 | 284.6761 |
| X_A_S_1 | 0.15 | 2.4754 |
| X_A_S_2 | 0.15 | 2.4754 |
| R_B | 1.00 | 10.0320 |
| P_B | 0.70 | 55.7066 |
| X_B_Y_4 | 0.30 | 14.8712 |
| R_K1 | 1.00 | 29.9751 |
| P_K1 | 0.70 | 83.0634 |
| X_K1_T_3 | 0.30 | 72.2291 |
| R_T1 | 1.00 | 20.0000 |
| P_T1 | 1.00 | 200.0000 |
| R_T2 | 1.00 | 20.0000 |
| P_T2 | 1.00 | 200.0000 |
| R_T3 | 1.00 | 20.0000 |
| P_T3 | 1.00 | 200.0000 |
fig, axes = plt.subplots(1, len(prob.idx.proteins), figsize=(4 * len(prob.idx.proteins), 3.2), sharex=True)
for ax, (i, gene) in zip(np.atleast_1d(axes), enumerate(prob.idx.proteins)):
off, n = int(prob.idx.offset_y[i]), len(prob.idx.sites[i])
for k in range(off, off + 2 + n):
ax.plot(t_dense, Y[:, k], label=states[k])
ax.set_title(gene)
ax.set_xscale("symlog", linthresh=1.0)
ax.set_xlabel("time (min)")
ax.legend(fontsize=7)
np.atleast_1d(axes)[0].set_ylabel("amount (fold change units)")
fig.suptitle("The example network's SBML model at the first start (not a fit; invented data)", fontsize=10)
fig.tight_layout()
plt.show()

4. A mechanism of your own
A new mechanism is a new file. models/examples/acetylation_mm.toml is an example for another modification type: lysine
acetylation on the distributive layout, with a saturating deacetylation \(E X / (1 + X)\) instead of the linear
dephosphorylation \(E X\). The site inflow \(S = W (c \odot K)\) is then the activity of the modifying enzymes, which are
the "kinases" of the network input. Below, the lines that differ from distributive.toml:
import difflib
example_file = mech.MODELS_DIR / "examples" / "acetylation_mm.toml"
a = (mech.MODELS_DIR / "distributive.toml").read_text(encoding="utf-8").splitlines()
b = example_file.read_text(encoding="utf-8").splitlines()
print("\n".join(line for line in difflib.unified_diff(a, b, "distributive.toml", "acetylation_mm.toml", lineterm="", n=0)
if not line.startswith("#") and not line.startswith(("-#", "+#"))))
--- distributive.toml
+++ acetylation_mm.toml
@@ -1 +1 @@
@@ -3,4 +3,5 @@
@@ -10,3 +11,3 @@
-name = "distributive"
-family = "distributive" # state layout: distributive | sequential | combinatorial | saturation
-doc = "mRNA -> protein -> one form per modified site (distributive)"
+name = "acetylation_mm"
+family = "distributive"
+doc = "mRNA -> protein -> one acetylated form per site; saturating deacetylation"
@@ -15,3 +16,3 @@
-name = "phosphorylation"
-modification = "phosphorylation" # reaction kind of the modification step
-demodification = "dephosphorylation" # reaction kind of the reverse step
+name = "acetylation"
+modification = "acetylation"
+demodification = "deacetylation"
@@ -54 +55 @@
-kind = "phosphorylation"
+kind = "acetylation"
@@ -61,2 +62,2 @@
-sbo = "SBO:0000216"
-go = "GO:0006468"
+sbo = "SBO:0000215"
+go = "GO:0006473"
@@ -65 +66 @@
-kind = "dephosphorylation"
+kind = "deacetylation"
@@ -69,3 +70,2 @@
-rate = "{E} * {X}"
-sbo = "SBO:0000330"
-go = "GO:0006470"
+rate = "{E} * {X} / (1 + {X})"
+go = "GO:0006476"
@@ -74 +74 @@
-kind = "phospho_decay"
+kind = "acetyl_decay"
We write a variant of our own into the temporary folder: phosphorylation as in the distributive model, but with a dephosphorylation that saturates in the modified form, with a half-saturation of 0.5 (in the units of X, fold change). Only the rate of one reaction changes.
my_text = (mech.MODELS_DIR / "distributive.toml").read_text(encoding="utf-8")
my_text = my_text.replace('name = "distributive"\n', 'name = "distributive_mm_dephosphorylation"\n', 1)
my_text = my_text.replace('rate = "{E} * {X}"', 'rate = "{E} * {X} / (0.5 + {X})"')
my_file = WORK / "distributive_mm.toml"
my_file.write_text(my_text, encoding="utf-8")
mine = mech.load(my_file)
print(mine.name, "| family:", mine.family, "| sha256:", mine.sha256[:16], "...")
pd.DataFrame([{"kind": r.kind, "per": r.per, "rate": r.rate} for r in mine.reactions])
distributive_mm_dephosphorylation | family: distributive | sha256: f9baab65c2b216b6 ...
| kind | per | rate | |
|---|---|---|---|
| 0 | transcription | protein | {synth} |
| 1 | mrna_decay | protein | {B} * {R} |
| 2 | translation | protein | {C} * {R} |
| 3 | protein_decay | protein | {D} * {P} |
| 4 | phosphorylation | site | {S} * {P} |
| 5 | dephosphorylation | site | {E} * {X} / (0.5 + {X}) |
| 6 | phospho_decay | site | ({D} + {Dp}) * {X} |
The loader checks a file before anything is built: unknown keys, scopes or symbols, a species in a rate law that the reaction does not list, a missing modification step. Two mistakes and their messages:
mistakes = {
"a species the reaction does not list": my_text.replace('rate = "{B} * {R}"', 'rate = "{B} * {R} * {P}"'),
"a symbol the scope does not have": my_text.replace('rate = "{C} * {R}"', 'rate = "{C} * {Q}"'),
}
for what, text in mistakes.items():
bad = WORK / "bad_mechanism.toml"
bad.write_text(text, encoding="utf-8")
try:
mech.load(bad)
except mech.MechanismError as exc:
print(f"{what}:\n {exc}\n")
a species the reaction does not list:
/tmp/phoskintime-tutorial-01-srmnuj1s/bad_mechanism.toml: [[reactions]] #2 (mrna_decay): the rate uses species ['P'] that the reaction does not list as reactant, product or modifier
a symbol the scope does not have:
/tmp/phoskintime-tutorial-01-srmnuj1s/bad_mechanism.toml: [[reactions]] #3 (translation): unknown symbol(s) ['Q'] in rate; allowed ['A', 'B', 'C', 'D', 'E', 'M0', 'P', 'R', 'gene', 'synth']
5. Use the file in a run
A run names its file in config.toml, [networkmodel] mechanism = "path/to/file.toml" (relative paths are taken from
the config file's folder, then the repository root), or on the command line, --mechanism path/to/file.toml. The
file's family must be the run's default_model. The run records the file and its sha256 in its model specification
(<run>/model_spec/spec.json), so a rebuild uses the same reactions.
api.problem takes the same options as a run. The example network with our file:
prob_mm = api.problem(CONF, ["--mechanism", my_file], work_dir=WORK / "problem-mm")
model_mm = libsbml.readSBMLFromString(model_of(prob_mm.sys).sbml).getModel()
print("mechanism:", prob_mm.sys.mechanism.name)
for name, m in (("distributive", model), ("our file", model_mm)):
r = next(r for r in m.getListOfReactions() if r.getId().startswith("rx_dephosphorylation_A_S_1"))
print(f"{name:>13}: {r.getId()} = {libsbml.formulaToL3String(r.getKineticLaw().getMath())}")
obj_mm = prob_mm.numpy_objective()
obj_mm.trajectory(prob_mm.theta_start) # set the same start θ on the second System
Y_mm = simulate(prob_mm.sys, t_dense, y0=prob_mm.sys.data_y0(), **obj_mm.tol)
i = prob.idx.proteins.index("A")
off = int(prob.idx.offset_y[i])
fig, axes = plt.subplots(1, 2, figsize=(9, 3.2), sharex=True)
for ax, (j, site) in zip(axes, enumerate(prob.idx.sites[i])):
ax.plot(t_dense, Y[:, off + 2 + j], label="distributive (models/distributive.toml)")
ax.plot(t_dense, Y_mm[:, off + 2 + j], "--", label="saturating dephosphorylation (our file)")
ax.set_title(f"A {site}: modified form X")
ax.set_xscale("symlog", linthresh=1.0)
ax.set_xlabel("time (min)")
axes[0].legend(fontsize=8)
fig.tight_layout()
plt.show()
[TF] orphan TF T2 has no mrna data to drive it: fallback its own state (data_drive_fallback)
[TF] orphan TF T3 has no mrna data to drive it: fallback its own state (data_drive_fallback)
[TF] observations of data-driven TFs ['T1'] are inputs: 9 rows removed from the loss
SBML written to /tmp/phoskintime_sbml_czeebwd1/model.xml model 'phoskintime_distributive', 0.03 s
mechanism: distributive_mm_dephosphorylation
distributive: rx_dephosphorylation_A_S_1 = E_A * X_A_S_1
our file: rx_dephosphorylation_A_S_1 = E_A * X_A_S_1 / (0.5 dimensionless + X_A_S_1)

At the same parameters, the saturating law removes less of the modified form once \(X\) is above the half-saturation, so the modified forms rise higher. The fit would find other rates for it: the mechanism is part of the model, and two mechanisms are compared by fitting both (tutorial 06) and comparing their objectives and residuals (tutorial 07).
The objective at the start differs accordingly:
pd.DataFrame({"distributive": prob.terms(prob.theta_start),
"saturating dephosphorylation": prob_mm.terms(prob_mm.theta_start)}).drop(index="breakdown")
| distributive | saturating dephosphorylation | |
|---|---|---|
| objective | 19042.840921 | 21912.372025 |
| data_term | 19042.835932 | 21912.367035 |
| prior_term | 0.00499 | 0.00499 |
Summary
- A model is a network part that PhosKinTime builds from the inputs and a mechanism file that declares the reactions per protein, site or state, with rate laws, SBO and GO terms.
- PhosKinTime's four models are
models/distributive.toml,sequential.toml,combinatorial.tomlandsaturation.toml;models/examples/acetylation_mm.tomlshows another PTM type. - The SBML model written from them (valid L3V2 with units) is the one model every simulation, fit, profile and posterior uses, in libroadrunner.
- A run uses its own file with
[networkmodel] mechanismor--mechanism; the file's family must be the run's model. - The finished run's SBML model at its fitted parameters is exported with
phoskintime export sbml --run <run>, and its PEtab problem withphoskintime export petab --run <run>(tutorial 09).
Next
02. Toy dataset format: the six files a run reads, their columns and which part PhosKinTime uses.