pyabc.copasi

Copasi

Simulations via COPASI (http://copasi.org).

class pyabc.copasi.BasicoModel(sbml_file: str, changes: Dict[str, float] = None, change_unit: bool = True, method: str = 'stochastic', t0: float = None, duration: float = None, num_steps: int = None, automatic: bool = True, use_numbers: bool = False, output: List[str] = None, model_name: str = None)[source]

Bases: Model

COPASI time series simulations via BasiCO.

This class is a pyabc.Model compliant wrapper around basico.run_time_course, allowing to update model parameters and use various simulation methods. BasiCO (https://basico.rtfd.io) is a simple Python interface to COPASI (http://copasi.org).

The implementation is derived from an implementation by Frank Bergmann at https://github.com/fbergmann/pyabc-copasi.

__call__(pars: Dict[str, float], return_raw: bool = False)[source]

Simulate data for given parameters.

Calls the time course and returns the selected result.

__init__(sbml_file: str, changes: Dict[str, float] = None, change_unit: bool = True, method: str = 'stochastic', t0: float = None, duration: float = None, num_steps: int = None, automatic: bool = True, use_numbers: bool = False, output: List[str] = None, model_name: str = None)[source]
Parameters:
  • sbml_file – SBML file containing the model definition.

  • changes – Parametric changes to apply to the SBML model.

  • change_unit – Whether to change units to 1, useful for discrete simulations (particle numbers).

  • method

    Simulation method, can be any method supported by basico.run_time_course, in particular:

    • deterministic, lsoda: the LSODA implementation

    • stochastic: the Gibson & Bruck Gillespie implementation

    • directMethod: Gillespie Direct Method

    • others: hybridode45, hybridlsoda, adaptivesa, tauleap, radau5, sde

  • t0 – Initial time point, duration, number of steps. Definition and combination as in basico.run_time_course.

  • duration – Initial time point, duration, number of steps. Definition and combination as in basico.run_time_course.

  • num_steps – Initial time point, duration, number of steps. Definition and combination as in basico.run_time_course.

  • automatic – Whether to use automatic steps, or the specified interval / number of steps.

  • use_numbers – Whether to return all elements collected.

  • output – Species to output. Defaults to all.

  • model_name – Model name, for identification e.g. in the database.

apply_parameters(pars: Dict[str, float])[source]

Set the parameters of the model.

Parameters:

pars – Parameters to apply, id-value dictionary. Local parameters are assumed to be named something like (reaction).local_parameter, where reaction is the name of the reaction, and local_parameter the local parameter. Specifically, local parameters are identified by the presence of brackets. Otherwise the parameter is expected to be a global one.

sample(pars: Parameter)[source]

Sample for parameters.

This is the method called by pyABC. It calls __call__ and reduces the output.