amici.pysb_import¶
PySB Import¶
This module provides all necessary functionality to import a model specified
in the pysb.core.Model
format.
Functions Summary
|
Constructs a list of monomer names contained in complex patterns. |
|
Wrapper to interface |
|
Creates an |
|
Generate AMICI C++ files for the provided model. |
|
Load a pysb model module and return the |
Functions
-
amici.pysb_import.
extract_monomers
(complex_patterns)[source]¶ Constructs a list of monomer names contained in complex patterns. Multiplicity of names corresponds to the stoichiometry in the complex.
- Parameters
complex_patterns (
typing.Union
[pysb.core.ComplexPattern
,typing.List
[pysb.core.ComplexPattern
]]) – (list of) complex pattern(s)- Return type
- Returns
list of monomer names
-
amici.pysb_import.
has_fixed_parameter_ic
(specie, pysb_model, ode_model)[source]¶ Wrapper to interface
ode_export.ODEModel.state_has_fixed_parameter_initial_condition()
from a pysb specie/model arguments- Parameters
specie (
pysb.core.ComplexPattern
) – pysb speciespysb_model (
pysb.core.Model
) – pysb modelode_model (
amici.ode_export.ODEModel
) – ODE model
- Return type
- Returns
False
if the species does not have an initial condition at all. Otherwise the return value ofode_export.ODEModel.state_has_fixed_parameter_initial_condition()
-
amici.pysb_import.
ode_model_from_pysb_importer
(model, constant_parameters=None, observables=None, sigmas=None, noise_distributions=None, compute_conservation_laws=True, simplify=<function powsimp>, verbose=False)[source]¶ Creates an
amici.ODEModel
instance from apysb.Model
instance.- Parameters
model (
pysb.core.Model
) – seeamici.pysb_import.pysb2amici()
constant_parameters (
typing.Optional
[typing.List
[str
]]) – seeamici.pysb_import.pysb2amici()
observables (
typing.Optional
[typing.List
[str
]]) – seeamici.pysb_import.pysb2amici()
sigmas (
typing.Optional
[typing.Dict
[str
,str
]]) – dict with names of observable Expressions as keys and names of sigma Expressions as value sigmanoise_distributions (
typing.Optional
[typing.Dict
[str
,typing.Union
[str
,typing.Callable
]]]) – seeamici.pysb_import.pysb2amici()
compute_conservation_laws (
bool
) – seeamici.pysb_import.pysb2amici()
simplify (
typing.Callable
) – seeamici.ODEModel._simplify
verbose (
typing.Union
[int
,bool
]) – verbosity level for logging, True/False default tologging.DEBUG
/logging.ERROR
- Return type
- Returns
New ODEModel instance according to pysbModel
-
amici.pysb_import.
pysb2amici
(model, output_dir=None, observables=None, constant_parameters=None, sigmas=None, noise_distributions=None, verbose=False, assume_pow_positivity=False, compiler=None, compute_conservation_laws=True, compile=True, simplify=<function <lambda>>, generate_sensitivity_code=True)[source]¶ Generate AMICI C++ files for the provided model.
Warning
PySB models with Compartments
When importing a PySB model with
pysb.Compartment
s, BioNetGen scales reaction fluxes with the compartment size. Instead of using the respective symbols, the compartment size Parameter or Expression is evaluated when generating equations. This may lead to unexpected results if the compartment size parameter is changed for AMICI simulations.- Parameters
model (
pysb.core.Model
) – pysb model,pysb.Model.name
will determine the name of the generated moduleoutput_dir (
typing.Optional
[str
]) – seeamici.ode_export.ODEExporter.set_paths()
observables (
typing.Optional
[typing.List
[str
]]) – list ofpysb.core.Expression
orpysb.core.Observable
names in the provided model that should be mapped to observablessigmas (
typing.Optional
[typing.Dict
[str
,str
]]) – dict ofpysb.core.Expression
names that should be mapped to sigmasnoise_distributions (
typing.Optional
[typing.Dict
[str
,typing.Union
[str
,typing.Callable
]]]) – dict with names of observable Expressions as keys and a noise type identifier, or a callable generating a custom noise formula string (seeamici.import_utils.noise_distribution_to_cost_function()
). If nothing is passed for some observable id, a normal model is assumed as default.constant_parameters (
typing.Optional
[typing.List
[str
]]) – list ofpysb.core.Parameter
names that should be mapped as fixed parametersverbose (
typing.Union
[int
,bool
]) – verbosity level for logging, True/False default tologging.DEBUG
/logging.ERROR
assume_pow_positivity (
bool
) – if set toTrue
, a special pow function is used to avoid problems with state variables that may become negative due to numerical errorscompiler (
typing.Optional
[str
]) – distutils/setuptools compiler selection to build the python extensioncompute_conservation_laws (
bool
) – if set toTrue
, conservation laws are automatically computed and applied such that the state-jacobian of the ODE right-hand-side has full rank. This option should be set toTrue
when using the Newton algorithm to compute steadystatescompile (
bool
) – IfTrue
, build the python module for the generated model. If false, just generate the source code.simplify (
typing.Callable
) – seeamici.ODEModel._simplify
generate_sensitivity_code (
bool
) – if set toFalse
, code for sensitivity computation will not be generated