Skip to content

fit.petab_v2.observables

Observables of a PEtab problem which are formulas.

An observable of PEtab is a math expression over the entities of a model, e.g. the fraction

(100 * pApB + 200 * pApA * specC17) / (pApB + STAT5A * specC17 + ...)

of a phosphorylated protein, while sbmlsim observes what roadrunner selects, i.e. an entity of the model. The formulas of a problem therefore become entities: a copy of the model gets a parameter per formula observable and an assignment rule which is the formula, and the fit selects the parameter.

The math of PEtab is the math of the model, i.e. the identifier of a species is its amount or its concentration exactly as the model means it, so the formula is the rule without translating it.

observable_id

observable_id(petab_id)

Get the identifier of the model entity of an observable.

Parameters:

Name Type Description Default
petab_id str

id of the observable in the PEtab problem.

required

Returns:

Type Description
str

The identifier of the parameter which the assignment rule sets.

add_observables

add_observables(sbml_path, formulas, output_path)

Write a copy of a model which has the observables of a problem.

Parameters:

Name Type Description Default
sbml_path Path

path of the model of the PEtab problem.

required
formulas dict[str, str]

math expression per observable, i.e. observableFormula.

required
output_path Path

path the model with the observables is written to.

required

Returns:

Type Description
Path

The path of the model which was written.

Raises:

Type Description
ValueError

if the model cannot be read, if a formula is not valid math or if the model with the observables is not valid SBML.

is_entity

is_entity(formula, sbml_model)

Check whether a formula is an entity of the model rather than math.

Parameters:

Name Type Description Default
formula str

the observableFormula of an observable.

required
sbml_model Any

libsbml.Model of the problem.

required

Returns:

Type Description
bool

Whether the formula is the identifier of an entity, i.e. whether the

bool

fit can select it without adding it to the model.