PEtab is the exchange format for ODE parameter estimation problems:
an SBML model plus tables of measurements, observables, conditions and
parameters, joined by a YAML file. petab.R writes the guide
model at the best fit as a PEtab problem and reads it back, as for
problems of the PEtab
benchmark collection.
PEtab export
exportPEtab() writes reactions as SBML, observables,
errors, data, and the transformation p with fixed values
and values per condition. PEtab 2, the default, has no parameter scales:
values of parameters entering as exp() are written on
linear scale, with a warning. The gauge of Symmetries becomes fixed values.
-
State at rest.
steadyState = pSSgives a pre-equilibration before time 0, shared by both conditions. One species per conserved total starts at the total (NfkIkb,Ikk), all others at 0. -
Event.
events = eventswrites the event at time 0 as theTNFvalue of the condition. - Errors. Imaging readouts get the error model, blots the data standard deviations as noise parameters per measurement.
# the estimated parameters at the best fit, the gauge as fixed values on the linear scale of the
# model
best <- as.parvec(readRDS("results/fits.rds"))
yaml <- exportPEtab(data, reactions, observables = g, p = p, pouter = best, errors = e,
fixed = exp(gauge), steadyState = pSS, events = events,
modelID = "oppelt", dir = "results/petab", overwrite = TRUE)
list.files("results/petab")
#> [1] "conditions_oppelt.tsv" "experiments_oppelt.tsv"
#> [3] "measurements_oppelt.tsv" "observables_oppelt.tsv"
#> [5] "oppelt.xml" "oppelt.yaml"
#> [7] "parameters_oppelt.tsv"The export uses the best fit of fit.R, loaded from
results/fits.rds. Each experiment starts with the
pre-equilibration at \(t = -\infty\),
then the experiment condition at 0:
read.delim("results/petab/experiments_oppelt.tsv")
#> experimentId time conditionId
#> 1 preequilibration__TNF -Inf
#> 2 preequilibration__TNF 0 TNF
#> 3 preequilibration__control -Inf
#> 4 preequilibration__control 0 control
read.delim("results/petab/conditions_oppelt.tsv")
#> conditionId targetId targetValue
#> 1 TNF TNF 1
#> 2 control TNF 0PEtab import
importPEtab() builds prdfn, the
obsfns of observables and errors, the parfn,
data and objfn; a pre-equilibration becomes a
Pimpl(). With compile = FALSE,
compile() builds the sources.
petab <- importPEtab(yaml, backend = "cppDE", options = list(atol = 1e-10, rtol = 1e-8),
modelname = "oppelt_petab", compile = FALSE)
compile(petab$prd, petab$e, output = "oppelt_petab", cores = 6)
# the data term of model.R and the objective of the problem read back
c(model.R = attr(obj(c(best, gauge), deriv = FALSE), "data"),
PEtab = petab$obj(petab$bestfit, deriv = FALSE)$value)
#> model.R PEtab
#> -511.1689 -511.1690The imported problem reproduces the data term of model.R
at the best fit. petab$bestfit holds the nominal values on
the problem scales, petab$parlower and
petab$parupper the bounds.
SBML models
exportSbml() writes species with compartments,
reactions, parameters and initial assignments; concentration rates are
multiplied by the compartment volume, importSbml() divides
again. importSbml() returns the equation list in
reactions, parameter and initial values, observables,
assignment rules and events:
sbml <- importSbml("results/petab/oppelt.xml")
names(sbml)
#> [1] "reactions" "pars" "inits" "observables"
#> [5] "assignmentRules" "events" "eventsSource" "renamed"
c(states = length(sbml$reactions$states), reactions = length(sbml$reactions$rates))
#> states reactions
#> 23 38
identical(sort(sbml$reactions$states), sort(reactions$states))
#> [1] TRUEexportSbml(reactions, parameters, inits, filepath)
writes an equation list without PEtab tables.
Formats and limits
- SBML and PEtab run through reticulate with
python-libsbml;DMOD_LIBSBML_PYTHONselects the interpreter. - PEtab 1 and 2 are read.
exportPEtab(formatVersion = "1")keeps scales but writes condition expressions that only dMod2 reads. -
exportPEtab()writes events at time 0 that replace a state and refuses others.
Reference: exportPEtab(), importPEtab(),
exportSbml(), importSbml()
← 9. Alignment of relative data measurements | 11. Remote computing →