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_folder(folder[, model_name])

Factory method to use the standard folder structure and file names, i.e.

from_yaml(yaml_config)

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_noise_distributions()

See get_noise_distributions.

get_observable_ids()

Returns dictionary of observable ids.

get_observables([remove])

Returns dictionary of observables definitions.

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 get_simulation_to_optimization_parameter_mapping.

get_sigmas([remove])

Return dictionary of observableId => sigma as defined in the SBML model.

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

to_files([sbml_file, condition_file, …])

Write PEtab tables to files for this problem

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 create_combine_archive.

Parameters

filename (str) – Path to the PEtab-COMBINE archive

Return type

petab.problem.Problem

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)[source]

Factory method to load model and tables from files.

Parameters
Return type

amici.petab_import_pysb.PysbPetabProblem

static from_folder(folder, model_name=None)

Factory method to use the standard folder structure and file names, i.e.

${model_name}/
  +-- experimentalCondition_${model_name}.tsv
  +-- measurementData_${model_name}.tsv
  +-- model_${model_name}.xml
  +-- parameters_${model_name}.tsv
Parameters
  • folder (str) – Path to the directory in which the files are located.

  • model_name (typing.Optional[str]) – If specified, overrides the model component in the file names. Defaults to the last component of folder.

Return type

petab.problem.Problem

static from_yaml(yaml_config)[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

yaml_config (typing.Union[typing.Dict, str]) – PEtab configuration as dictionary or YAML file name

Return type

amici.petab_import_pysb.PysbPetabProblem

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

The lower parameter bounds.

Return type

v

get_model_parameters()

See petab.sbml.get_model_parameters

get_noise_distributions()

See get_noise_distributions.

get_observable_ids()

Returns dictionary of observable ids.

get_observables(remove=False)

Returns dictionary of observables definitions. See assignment_rules_to_dict for details.

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(warn_unmapped=True, scaled_parameters=False)

See get_simulation_to_optimization_parameter_mapping.

get_sigmas(remove=False)

Return dictionary of observableId => sigma as defined in the SBML model. This does not include parameter mappings defined in the measurement table.

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

The upper parameter bounds.

Return type

v

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

The parameter ids.

Return type

v

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

The parameter nominal values.

Return type

v

sample_parameter_startpoints(n_starts=100)

Create starting points for optimization

See sample_parameter_startpoints

to_files(sbml_file=None, condition_file=None, measurement_file=None, parameter_file=None, visualization_file=None, observable_file=None, yaml_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