amici.petab_import_pysb.PysbPetabProblem

class amici.petab_import_pysb.PysbPetabProblem(pysb_model=None, *args, **kwargs)[source]

Representation of a PySB-model-based PEtab problem

This class extends petab.Problem with a PySB model. The model is augmented with the observation model based on the PEtab observable table. For now, a dummy SBML model is created which allows used the existing SBML-PEtab API.

Variables

pysb_model – PySB model instance from of this PEtab problem.

__init__(pysb_model=None, *args, **kwargs)[source]

Constructor

Parameters
  • pysb_model (typing.Optional[pysb.core.Model]) – PySB model instance for this PEtab problem

  • args – See petab.Problem.__init__()

  • kwargs – See petab.Problem.__init__()

Methods Summary

__init__([pysb_model])

Constructor

create_parameter_df(*args, **kwargs)

Create a new PEtab parameter table

from_combine(filename)

Read PEtab COMBINE archive (http://co.mbine.org/documents/archive).

from_files([condition_file, ...])

Factory method to load model and tables from files.

from_yaml(yaml_config[, flatten])

Factory method to load model and tables as specified by YAML file.

get_lb([free, fixed, scaled])

Generic function to get lower parameter bounds.

get_model_parameters()

See petab.sbml.get_model_parameters()

get_observable_ids()

Returns dictionary of observable ids.

get_optimization_parameter_scales()

Return list of optimization parameter scaling strings.

get_optimization_parameters()

Return list of optimization parameter IDs.

get_optimization_to_simulation_parameter_mapping(...)

See petab.parameter_mapping.get_optimization_to_simulation_parameter_mapping(), to which all keyword arguments are forwarded.

get_simulation_conditions_from_measurement_df()

See petab.get_simulation_conditions

get_ub([free, fixed, scaled])

Generic function to get upper parameter bounds.

get_x_ids([free, fixed])

Generic function to get parameter ids.

get_x_nominal([free, fixed, scaled])

Generic function to get parameter nominal values.

sample_parameter_startpoints([n_starts])

Create starting points for optimization

scale_parameters(x_dict)

Scale parameter values.

to_files([sbml_file, condition_file, ...])

Write PEtab tables to files for this problem

to_files_generic(prefix_path)

Save a PEtab problem to generic file names.

unscale_parameters(x_dict)

Unscale parameter values.

Attributes

lb

Parameter table lower bounds.

lb_scaled

Parameter table lower bounds with applied parameter scaling

ub

Parameter table upper bounds

ub_scaled

Parameter table upper bounds with applied parameter scaling

x_fixed_ids

Parameter table parameter IDs, for fixed parameters.

x_fixed_indices

Parameter table non-estimated parameter indices.

x_free_ids

Parameter table parameter IDs, for free parameters.

x_free_indices

Parameter table estimated parameter indices.

x_ids

Parameter table parameter IDs

x_nominal

Parameter table nominal values

x_nominal_fixed

Parameter table nominal values, for fixed parameters.

x_nominal_fixed_scaled

Parameter table nominal values with applied parameter scaling, for fixed parameters.

x_nominal_free

Parameter table nominal values, for free parameters.

x_nominal_free_scaled

Parameter table nominal values with applied parameter scaling, for free parameters.

x_nominal_scaled

Parameter table nominal values with applied parameter scaling

Methods

__init__(pysb_model=None, *args, **kwargs)[source]

Constructor

Parameters
  • pysb_model (typing.Optional[pysb.core.Model]) – PySB model instance for this PEtab problem

  • args – See petab.Problem.__init__()

  • kwargs – See petab.Problem.__init__()

create_parameter_df(*args, **kwargs)

Create a new PEtab parameter table

See create_parameter_df().

static from_combine(filename)

Read PEtab COMBINE archive (http://co.mbine.org/documents/archive).

See also petab.create_combine_archive().

Parameters

filename (typing.Union[pathlib.Path, str]) – Path to the PEtab-COMBINE archive

Return type

typing.ForwardRef

Returns

A petab.Problem instance.

static from_files(condition_file=None, measurement_file=None, parameter_file=None, visualization_files=None, observable_files=None, pysb_model_file=None, flatten=False)[source]

Factory method to load model and tables from files.

Parameters
Return type

amici.petab_import_pysb.PysbPetabProblem

Returns

Petab Problem

static from_yaml(yaml_config, flatten=False)[source]

Factory method to load model and tables as specified by YAML file.

NOTE: The PySB model is currently expected in the YAML file under sbml_files.

Parameters
Return type

amici.petab_import_pysb.PysbPetabProblem

Returns

Petab Problem

get_lb(free=True, fixed=True, scaled=False)

Generic function to get lower parameter bounds.

Parameters
  • free (bool) – Whether to return free parameters, i.e. parameters to estimate.

  • fixed (bool) – Whether to return fixed parameters, i.e. parameters not to estimate.

  • scaled (bool) – Whether to scale the values according to the parameter scale, or return them on linear scale.

Returns

Return type

The lower parameter bounds.

get_model_parameters()

See petab.sbml.get_model_parameters()

get_observable_ids()

Returns dictionary of observable ids.

get_optimization_parameter_scales()

Return list of optimization parameter scaling strings.

See petab.parameters.get_optimization_parameters().

get_optimization_parameters()

Return list of optimization parameter IDs.

See petab.parameters.get_optimization_parameters().

get_optimization_to_simulation_parameter_mapping(**kwargs)

See petab.parameter_mapping.get_optimization_to_simulation_parameter_mapping(), to which all keyword arguments are forwarded.

get_simulation_conditions_from_measurement_df()

See petab.get_simulation_conditions

get_ub(free=True, fixed=True, scaled=False)

Generic function to get upper parameter bounds.

Parameters
  • free (bool) – Whether to return free parameters, i.e. parameters to estimate.

  • fixed (bool) – Whether to return fixed parameters, i.e. parameters not to estimate.

  • scaled (bool) – Whether to scale the values according to the parameter scale, or return them on linear scale.

Returns

Return type

The upper parameter bounds.

get_x_ids(free=True, fixed=True)

Generic function to get parameter ids.

Parameters
  • free (bool) – Whether to return free parameters, i.e. parameters to estimate.

  • fixed (bool) – Whether to return fixed parameters, i.e. parameters not to estimate.

Returns

Return type

The parameter IDs.

get_x_nominal(free=True, fixed=True, scaled=False)

Generic function to get parameter nominal values.

Parameters
  • free (bool) – Whether to return free parameters, i.e. parameters to estimate.

  • fixed (bool) – Whether to return fixed parameters, i.e. parameters not to estimate.

  • scaled (bool) – Whether to scale the values according to the parameter scale, or return them on linear scale.

Returns

Return type

The parameter nominal values.

sample_parameter_startpoints(n_starts=100)

Create starting points for optimization

See petab.sample_parameter_startpoints().

scale_parameters(x_dict)

Scale parameter values.

Parameters

x_dict (typing.Dict[str, float]) – Keys are parameter IDs in the PEtab problem, values are unscaled parameter values.

Returns

Return type

The scaled parameter values.

to_files(sbml_file=None, condition_file=None, measurement_file=None, parameter_file=None, visualization_file=None, observable_file=None, yaml_file=None, prefix_path=None, relative_paths=True, model_file=None)

Write PEtab tables to files for this problem

Writes PEtab files for those entities for which a destination was passed.

NOTE: If this instance was created from multiple measurement or visualization tables, they will be merged and written to a single file.

Parameters
Raises

ValueError – If a destination was provided for a non-existing entity.

Return type

None

to_files_generic(prefix_path)

Save a PEtab problem to generic file names.

The PEtab problem YAML file is always created. PEtab data files are only created if the PEtab problem contains corresponding data (e.g. a PEtab visualization TSV file is only created if the PEtab problem has one).

Parameters

prefix_path (typing.Union[str, pathlib.Path]) – Specify a prefix to all paths, to avoid specifying the prefix for all paths individually. NB: the prefix is added to paths before relative_paths is handled downstream in petab.yaml.create_problem_yaml.

Return type

str

Returns

The path to the PEtab problem YAML file.

unscale_parameters(x_dict)

Unscale parameter values.

Parameters

x_dict (typing.Dict[str, float]) – Keys are parameter IDs in the PEtab problem, values are scaled parameter values.

Returns

Return type

The unscaled parameter values.