BioMASS core functions (biomass.core
)
BioMASS core functions
- class biomass.core.Model(pkg_name)
Class for BioMASS model construction.
- pkg_name
Path (dot-sepalated) to a biomass model directory. Use
__package__
.- Type:
str
- create(show_info=False)
Build a biomass model.
- Parameters:
show_info (bool (default:
False
)) – Set toTrue
to print the information related to model size.- Returns:
model – The BioMASS model object.
- Return type:
Examples
>>> from biomass import Model >>> import your_model >>> model = Model(your_model.__package__).create()
- biomass.core.create_model(pkg_name, show_info=False)
Create a BioMASS model.
- Parameters:
pkg_name (str) – Path (dot-sepalated) to a biomass model directory.
show_info (bool (default:
False
)) – Set toTrue
to print the information related to model size.
- Returns:
model – The BioMASS model object.
- Return type:
Examples
>>> from biomass import create_model >>> import your_model >>> model = create_model(your_model.__package__)
- biomass.core.optimize(model, x_id, *, disp_here=False, overwrite=False, optimizer_options=None)
Estimate model parameters from experimental data.
- Parameters:
model (ModelObject) – Model for parameter estimation.
x_id (int) – Index of parameter set to estimate.
disp_here (bool (default:
False
)) – Whether to show the evaluated objective at every iteration.overwrite (bool (default:
False
)) – IfTrue
, the directory (x_id/
) will be overwritten.optimizer_options (dict, optional) – Keyword arguments to pass to
scipy.optimize.differential_evolution
. For details, please refer to https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.differential_evolution.html.
- Return type:
None
Examples
>>> from biomass import create_model, optimize >>> from biomass.models import copy_to_current >>> copy_to_current("Nakakuki_Cell_2010") >>> model = create_model("Nakakuki_Cell_2010") >>> optimize(model, x_id=1)
Notes
Set simulation conditions and the corresponding experimental data in
observable.py
Define an objective function to be minimized (
objective()
) inproblem.py
Set lower/upper bounds of parameters to be estimated in
search_param.py
- biomass.core.run_analysis(model, *, target, metric='integral', create_metrics=None, style='barplot', show_progress=True, clustermap_kws=None, cbar_ax_tick_params=None, options=None)
Employ sensitivity analysis to identify critical parameters, species or reactions in the complex biological network.
The sensitivity S(y,x) was calculated according to the following equation: S(y,x) = d ln(yi) / d ln (xj), where yi is the signaling metric and xj is each nonzero species, parameter value or reaction rate.
- Parameters:
model (ModelObject) – Model for sensitivity analysis.
target (Literal["reaction", "parameter", "initial_condition"]) – Where to add a small perturbation to calculate sensitivity coefficients.
metric (str (default: 'integral')) – A word to specify the signaling metric.
create_metrics (Dict[str, Callable[[np.ndarray], Union[int, float]]], optional) – Create user-defined signaling metrics.
style (Literal["barplot", "heatmap"] (default: 'barplot')) –
‘barplot’
’heatmap’
show_progress (bool (default:
True
)) – Set toTrue
to show the progress indicator while calculating sensitivity coefficients.clustermap_kws (dict, optional) – Keyword arguments to pass to
seaborn.clustermap()
when style is ‘heatmap’.cbar_ax_tick_params (dict, optional) – Keyword arguments to pass to
ax.tick_params()
of the color bar object when style is ‘heatmap’.options (dict, optional) –
- show_indicesbool (default:
True
) (
target
== ‘reaction’) Set toTrue
to put reaction index on each bar.
- show_indicesbool (default:
- excluded_paramslist of strings
(
target
== ‘parameter’) List of parameters which are not used for analysis.
- excluded_initialslist of strings
(
target
== ‘initial_condition’) List of species which are not used for analysis.
- overwritebool (default:
True
) If
True
, the sensitivity_coefficients/{target}/{metric}.npy file will be overwritten.
- overwritebool (default:
- Return type:
None
Examples
>>> from biomass import create_model, run_analysis >>> from biomass.models import copy_to_current >>> copy_to_current("Nakakuki_Cell_2010") >>> model = create_model("Nakakuki_Cell_2010")
Parameters
>>> run_analysis( ... model, ... target='parameter', ... options = { ... 'excluded_params': [ ... 'a', 'Vn', 'Vc', 'Ligand', 'EGF', 'HRG', 'no_ligand' ... ] ... } ... )
Initial condition
>>> run_analysis(model, target='initial_condition')
Reaction
>>> run_analysis(model, target='reaction')
- biomass.core.run_simulation(model, *, viz_type='original', show_all=False, stdev=False)
Simulate ODE model with estimated parameter values.
- Parameters:
model (ModelObject) – Model for simulation.
viz_type (str) –
- ‘average’:
The average of simulation results with parameter sets in
out/
.
- ’best’:
The best simulation result in
out/
, simulation with best_fit_param.
- ’original’:
Simulation with the default parameters and initial values defined in
set_model.py
.
- ’n(=1,2,…)’:
Use the parameter set in
out/n/
.
- ’experiment’
Draw the experimental data written in
observable.py
without simulation results.
show_all (bool (default:
False
)) – Whether to show all simulation results.stdev (bool (default:
False
)) – IfTrue
, the standard deviation of simulated values will be shown (only available for ‘average’ visualization type).
- Return type:
None
Examples
>>> from biomass import create_model, run_simulation >>> from biomass.models import copy_to_current >>> copy_to_current("Nakakuki_Cell_2010") >>> model = create_model("Nakakuki_Cell_2010") >>> run_simulation( ... model, ... viz_type='average', ... show_all=False, ... stdev=True, ... )