Skip to content

fit.petab_v2.symbols

Translate the selections of roadrunner into the math of PEtab v2.

sbmlsim names an observable and the target of a change with a selection of roadrunner, where S1 is the amount of a species and [S1] its concentration. PEtab has no selections: an observable is a math expression over the entities of the model and the target of a condition is the identifier of an entity, and what the identifier of a species means is decided by the model:

  • hasOnlySubstanceUnits=true, i.e. an amount based species, is an amount,
  • hasOnlySubstanceUnits=false, i.e. a concentration based species, is a concentration,

for the math of the observables (PEtab v2, observable table) and for the value a condition assigns (PEtab v2, reinitialization semantics). Dropping the brackets of a selection is therefore only right when the two agree, and this module converts between them instead: the concentration of an amount based species is S1 / compartment and the amount of a concentration based species is S1 * compartment.

split_selection

split_selection(selection)

Split a selection into the entity and whether it is a concentration.

Parameters:

Name Type Description Default
selection str

selection of roadrunner, e.g. [S1] or S1.

required

Returns:

Type Description
str

The identifier of the entity and whether the selection is the

bool

concentration of a species.

observable_formula

observable_formula(selection, sbml_model=None)

Get the PEtab math expression of a selection.

Parameters:

Name Type Description Default
selection str

selection of roadrunner, e.g. [S1] or Aurine.

required
sbml_model Any

libsbml.Model of the problem. Without it the brackets are dropped, which is right when the selection and the model agree on amount and concentration.

None

Returns:

Type Description
str

The expression which has the value of the selection, i.e. the

str

identifier of the entity or the identifier scaled by its compartment.

condition_target

condition_target(selection, sbml_model=None)

Get the target of a condition of a change of sbmlsim.

The target of a condition is an identifier and not an expression, so a change whose selection means something else than the identifier does in the model cannot be written.

Parameters:

Name Type Description Default
selection str

selection of roadrunner which the change applies to.

required
sbml_model Any

libsbml.Model of the problem.

None

Returns:

Type Description
str

The identifier of the entity the condition changes.

Raises:

Type Description
ValueError

if the change is the concentration of an amount based species or the amount of a concentration based species, which PEtab cannot assign.

selection_of_formula

selection_of_formula(formula, sbml_model=None)

Get the selection of roadrunner of a PEtab math expression.

This is the way back for a problem which does not carry the sbmlsim extension, i.e. a problem of another tool. Only an expression which is the identifier of an entity is a selection.

Parameters:

Name Type Description Default
formula str

the observableFormula of an observable.

required
sbml_model Any

libsbml.Model of the problem.

None

Returns:

Type Description
str

The selection of roadrunner which has the value of the expression.

Raises:

Type Description
ValueError

if the expression is not the identifier of an entity, i.e. an observable which is a formula over several entities.