petab.v1.models

Handling of different model types supported by PEtab.

Module Attributes

MODEL_TYPE_SBML

SBML model type as used in a PEtab v2 yaml file as language.

MODEL_TYPE_PYSB

PySB model type as used in a PEtab v2 yaml file as language.

petab.v1.models.MODEL_TYPE_PYSB = 'pysb'

PySB model type as used in a PEtab v2 yaml file as language.

petab.v1.models.MODEL_TYPE_SBML = 'sbml'

SBML model type as used in a PEtab v2 yaml file as language.

class petab.v1.models.Model[source]

Bases: ABC

Base class for wrappers for any PEtab-supported model type

abstract static from_file(filepath_or_buffer: Any, model_id: str) Model[source]

Load the model from the given path/URL

Parameters:
  • filepath_or_buffer – URL or path of the model

  • model_id – Model ID

Returns:

A Model instance holding the given model

abstract get_free_parameter_ids_with_values() Iterable[tuple[str, float]][source]

Get free model parameters along with their values

Returns:

Iterator over tuples of (parameter_id, parameter_value)

abstract get_parameter_ids() Iterable[str][source]

Get all parameter IDs from this model

Returns:

Iterator over model parameter IDs

abstract get_parameter_value(id_: str) float[source]

Get a parameter value

Parameters:

id – ID of the parameter whose value is to be returned

Raises:

ValueError – If no parameter with the given ID exists

Returns:

The value of the given parameter as specified in the model

abstract get_valid_ids_for_condition_table() Iterable[str][source]

Get IDs of all model entities that are allowed to occur as columns in the PEtab conditions table.

Returns:

Iterator over model entity IDs

abstract get_valid_parameters_for_parameter_table() Iterable[str][source]

Get IDs of all parameters that are allowed to occur in the PEtab parameters table

Returns:

Iterator over parameter IDs

abstract has_entity_with_id(entity_id) bool[source]

Check if there is a model entity with the given ID

Parameters:

entity_id – ID to check for

Returns:

True, if there is an entity with the given ID, False otherwise

abstract is_state_variable(id_: str) bool[source]

Check whether the given ID corresponds to a model state variable

abstract is_valid() bool[source]

Validate this model

Returns:

True if the model is valid, False if there are errors in this model

abstract symbol_allowed_in_observable_formula(id_: str) bool[source]

Check if the given ID is allowed to be used in observable and noise formulas

Returns:

True, if allowed, False otherwise

abstract to_file(filename: [str, Path])[source]

Save the model to the given file

Parameters:

filename – Destination filename

Modules

model

PEtab model abstraction

pysb_model

Functions for handling PySB models

sbml_model

Functions for handling SBML models