robustnet.sensitivity¶
Define class for robusness analysis.
Attributes¶
Classes¶
Implement the continuation method to evaluate the effects of parameter |
Module Contents¶
- class robustnet.sensitivity.EnsembleSimulator(model, exclude_metabs=None)[source]¶
Bases:
robustnet.kinetics.SimulatorImplement the continuation method to evaluate the effects of parameter perturbations on a metabolic system.
Enzyme concentrations are treated as perturbation parameters in the robustness analysis.
- _select_parameter_sets(n_models, rng_seed=None)[source]¶
Check whether sufficient parameter sets are available for
n_models.If enough parameter sets are available, randomly select
n_modelssets. Otherwise, use all available parameter sets.
- _check_metabolite_set_inclusion(ini_x_set)[source]¶
Check whether sampled initial concentrations are available for all metabolites included in the analysis, and reorder them according to
self.stoy_mat.index.
- _check_enzyme_set_inclusion(e_conc_set)[source]¶
Check whether sampled concentrations are available for all enzymes included in the analysis, and reorder them according to
self.enz_vars.
- _check_kinetic_parameter_set_inclusion(kparam_set)[source]¶
Check whether sampled values are available for all kinetic parameters required in the analysis, and reorder them according to
self.kparams.
- _check_influx_set_inclusion(vin_set)[source]¶
Check whether sampled influxes are available for all initial substrates, and reorder them according to
self.ini_subs.
- _check_efflux_set_inclusion(vout_set)[source]¶
Check whether sampled effluxes are available for all final products, and reorder them according to
self.fin_pros.
- _get_perturbation_bounds(perturb_enzymes, fold_change)[source]¶
Get relative enzyme concentration levels corresponding to the left and right perturbation bounds.
- _compute_v(ss_x, e, kparams, vins, vouts, v_fun)[source]¶
Compute the fluxes (including influxes and effluxes).
- Parameters:
ss_x (numpy.array) – Steady-state metabolite concentrations ordered according to
self.stoy_mat.index. If two-dimensional, columns correspond to metabolites also in order ofself.stoy_mat.index.e (numpy.array) – Enzyme concentrations ordered according to
self.enz_vars. If two-dimensional, columns correspond to enzymes also in order ofself.enz_vars.kparams (numpy.array) – Kinetic parameters ordered according to
self.kparams.vins (numpy.array) – Influx rates for initial substrates ordered according to
self.ini_subs.vouts (numpy.array) – Efflux rates for final products ordered according to
self.fin_pros.v_fun (callable) – Callable function that computes the fluxes.
- _compute_dvdx(ss_x, e, kparams, vins, vouts, dvdx_fun)[source]¶
Compute the derivative of fluxes (including influxes and effluxes) with respect to metabolite concentrations.
- Parameters:
ss_x (numpy.array) – Steady-state metabolite concentrations ordered according to
self.stoy_mat.index.e (numpy.array) – Enzyme concentrations ordered according to
self.enz_vars.kparams (numpy.array) – Kinetic parameters ordered according to
self.kparams.vins (numpy.array) – Influx rates for initial substrates ordered according to
self.ini_subs.vouts (numpy.array) – Efflux rates for final products ordered according to
self.fin_pros.dvdx_fun (callable) – Callable function that computes derivatives of fluxes with respect to metabolite concentrations.
- _compute_dvde(ss_x, e, kparams, vins, vouts, dvde_fun)[source]¶
Compute the derivative of fluxes (including influxes and effluxes) with respect to enzyme concentrations.
- Parameters:
ss_x (numpy.array) – Steady-state metabolite concentrations ordered according to
self.stoy_mat.index.e (numpy.array) – Enzyme concentrations ordered according to
self.enz_vars.kparams (numpy.array) – Kinetic parameters ordered according to
self.kparams.vins (numpy.array) – Influx rates for initial substrates ordered according to
self.ini_subs.vouts (numpy.array) – Efflux rates for final products ordered according to
self.fin_pros.dvde_fun (callable) – Callable function that computes derivatives of fluxes with respect to enzyme concentrations.
- _euler(x_ini, v_ini, e_ini, steps, Sr, L, compute_dvdx, compute_dvde, compute_v, flux_sensitivity=True, check_jacobian=True, tol=-1e-09, check_metabolite=True)[source]¶
Solve an IVP using the Euler method.
- Parameters:
steps (2-D numpy.array) – Perturbation step sizes for enzymes with shape
(n_steps, n_enzymes).flux_sensitivity (bool, optional) – If
True, derivatives of steady-state fluxes with respect to enzyme concentrations are also computed.check_jacobian (bool, optional) – If
True, the maximum real parts of Jacobian eigenvalues are checked during perturbation, and matrix inversion is used. IfFalse, the pseudoinverse is used when the Jacobian is singular or noninvertible.check_metabolite (bool, optional) – If
True, metabolite concentrations are checked to remain positive during perturbation.
- Returns:
x_sol (2-D numpy.array) – Simulated metabolite concentrations with shape
(n_steps, self.stoy_mat.shape[0]). Rows correspond to perturbation steps and columns correspond to metabolites.x_solstores values for steps1throughn_steps. An empty array indicates an invalid model at the initial state.v_sol (2-D numpy.array) – Simulated fluxes, including influxes and effluxes, with shape
(n_steps, self.aug_stoy_mat.shape[1]). Rows correspond to perturbation steps and columns correspond to reactions.v_solstores values for steps1throughn_steps. An empty array indicates an invalid model at the initial state.max_reals (1-D numpy.array) – Maximum real parts of Jacobian eigenvalues for each perturbation step, with shape
(n_steps,).max_realsstores values for steps0throughn_steps - 1. An empty array indicates an invalid model at the initial state.
- _solve_sensitivity(ss_x_ini, e_ini, kparams, vins, vouts, rel_lbs, rel_rbs, n_steps=100, log_spacing=False, flux_sensitivity=True, check_jacobian=True, check_metabolite=True)[source]¶
Solve sensitivity of steady state metabolite concentrations and fluxes with respect to enzyme concentrations based on the continuation method.
- Parameters:
ss_x_ini (numpy.array) – Initial steady-state metabolite concentrations ordered according to
self.stoy_mat.index.e_ini (numpy.array) – Initial enzyme concentrations ordered according to
self.enz_vars.kparams (numpy.array) – Kinetic parameters ordered according to
self.kparams.vins (numpy.array) – Influx rates for initial substrates ordered according to
self.ini_subs.vouts (numpy.array) – Efflux rates for final products ordered according to
self.fin_pros.rel_lbs (numpy.array) – Relative left and right perturbation bounds for enzyme concentrations ordered according to
self.enz_vars. Iflb == rb, the corresponding enzyme is not perturbed.rel_rbs (numpy.array) – Relative left and right perturbation bounds for enzyme concentrations ordered according to
self.enz_vars. Iflb == rb, the corresponding enzyme is not perturbed.n_steps (int) – Number of integration step.
log_spacing (bool, optional) – If
True, perturbation points are logarithmically spaced. Otherwise, they are evenly spaced.flux_sensitivity (bool, optional) – If
True, derivatives of steady-state fluxes with respect to enzyme concentrations are also computed.check_jacobian (bool, optional) – If
True, verify that all Jacobian eigenvalues have negative real parts.check_metabolite (bool, optional) – If
True, enforce positive metabolite concentrations during perturbation.
- _simulation_worker(ini_x_set, e_conc_set, kparam_set, vin_set, vout_set, rel_lbs, rel_rbs, n_steps=100, log_spacing=False, flux_sensitivity=True, check_jacobian=True, check_metabolite=True)[source]¶
Simulation worker for sensitivity analysis in parallel.
- Parameters:
ini_x_set (pandas.DataFrame) – Sampled sets of initial metabolite concentrations.
e_conc_set (pandas.DataFrame) – Sampled sets of enzyme concentrations.
kparam_set (pandas.DataFrame) – Sampled sets of kinetic parameters.
vin_set (pandas.DataFrame) – Sampled sets of influx for initial substrates.
vout_set (pandas.DataFrame) – Sampled sets of efflux for final products.
rel_lbs (numpy.array) – Left fold-change perturbation bounds for enzyme concentrations.
rel_rbs (numpy.array) – Right fold-change perturbation bounds for enzyme concentrations.
n_steps (int) – Number of integration steps in perturbations toward the left and right directions, respectively.
log_spacing (bool, optional) – If
True, perturbation points are logarithmically spaced. Otherwise, they are evenly spaced.flux_sensitivity (bool, optional) – If
True, derivatives of steady-state fluxes with respect to enzyme concentrations are also computed.check_jacobian (bool, optional) – If
True, verify that all Jacobian eigenvalues have negative real parts.check_metabolite (bool, optional) – If
True, enforce positive metabolite concentrations during perturbation.
- simulate(perturb_enzymes, fold_change, n_steps, log_spacing, n_models, n_jobs, flux_sensitivity=True, check_jacobian=True, check_metabolite=True)[source]¶
Simulate perturbation responses and evaluate the robustness of the metabolic system with respect to enzyme expression perturbations.
- Parameters:
perturb_enzymes (list of str or "all", optional) – Enzymes perturbed during robustness analysis.
fold_change (2-tuple or dict) – Fold-change perturbation bounds for enzyme concentrations.
n_steps (int) – Number of integration steps in perturbations toward the left and right directions, respectively.
log_spacing (bool, optional) – If
True, perturbation points are logarithmically spaced. Otherwise, they are evenly spaced.n_models (int) – Number of sampled models used in the simulation. Increasing this value may improve consensus robustness estimates. Note that the maximum number of models is limited by the number of loaded parameter sets.
n_jobs (int) – Number of parallel jobs.
flux_sensitivity (bool, optional) – If
True, derivatives of steady-state fluxes with respect to enzyme concentrations are also computed.check_jacobian (bool, optional) – If
True, verify that all Jacobian eigenvalues have negative real parts.check_metabolite (bool, optional) – If
True, enforce positive metabolite concentrations during perturbation.