src.model_balancing.model_balancing_noncvx

A module for performing full model balancing (using SciPy).

Module Contents

class src.model_balancing.model_balancing_noncvx.ModelBalancing(S: numpy.array, fluxes: numpy.array, A_act: numpy.array, A_inh: numpy.array, metabolite_names: List[str], reaction_names: List[str], state_names: List[str], rate_law: str = 'CM', alpha: float = 1.0, beta: float = 0.0, **kwargs)[source]

Bases: object

A class for performing Model Balancing (non-convex version).

This version of model balancing solves the exact non-convex problem. The α parameter can be used to tune between a convex version (α = 0) and the full version (α = 1).

S[source]
fluxes[source]
A_act[source]
A_inh[source]
metabolite_names[source]
reaction_names[source]
state_names[source]
rate_law = 'CM'[source]
alpha = 1.0[source]
beta = 0.0[source]
Ncond[source]
ln_geom_mean[source]
precision_ln[source]
ln_lower_bound[source]
ln_upper_bound[source]
ln_true_value[source]
var_dict_to_vector(var_dict: Dict[str, numpy.array], param_order: List[str] = INDEPENDENT_VARIABLES) numpy.array[source]

Get the variable vector (x).

extend_var_dict_to_dependent_params(var_dict: Dict[str, numpy.ndarray]) None[source]
var_vector_to_dict_all(x: numpy.ndarray) Dict[str, numpy.ndarray][source]

Get a dictionary with all dependent and independent variable values.

var_vector_to_z_scores(x: numpy.ndarray) Dict[str, float][source]
var_dict_to_z_scores(var_dict: Dict[str, float]) Dict[str, float][source]
objective_function(x: numpy.ndarray) float[source]

Calculate the sum of squares of all Z-scores for a given point (x).

The input (x) is a stacked version of all the independent variables, assuming the following order: Km, Ka, Ki, Keq, kcatf, conc_met By default, if x is None, the objective value for (the exponent of) self.x is returned.

penalty_term_beta(var_dict: Dict[str, float]) float[source]

Calculate the penalty term for c/Km.

property driving_forces: numpy.ndarray[source]

Calculates the driving forces of all reactions.

property ln_kcatr: numpy.ndarray[source]

Calculate the kcat-reverse based on Haldane relationship constraint.

property ln_eta_thermodynamic: numpy.ndarray[source]

Calculate the thermodynamic term of the enzyme.

property ln_eta_kinetic: numpy.ndarray[source]

Calculate the kinetic (saturation) term of the enzyme.

property ln_eta_regulation: numpy.ndarray[source]

Calculate the regulation (allosteric) term of the enzyme.

property ln_conc_enz: numpy.ndarray[source]

Calculate the required enzyme levels based on fluxes and rate laws.

is_gmean_feasible() bool[source]

Check if the gmean is a thermodynamically feasible solution.

This is useful because we sometimes would like to initialize the optimization with the geometric means, but that can only be done if that point is feasible (otherwise, the dependent parameter conc_enz is not defined).

property thermodynamic_constraints: scipy.optimize.LinearConstraint[source]

Construct the thermodynamic constraints for the variable vector.

extend_variable_vector(x: numpy.ndarray) numpy.ndarray[source]

Add the dependent variables to a vector of the independen ones.

property parameter_constraints: scipy.optimize.NonlinearConstraint[source]
initialize_with_gmeans() None[source]

Initialize the independent parameters with their gmeans.

Note that the dependent parameters (kcatr and ln_conc_enz) can both be very far from their gmeans, and that the system might not be thermodynamically feasible.

solve(basinhopping_kwargs: dict | None = None, minimizer_kwargs: dict | None = None) scipy.optimize.OptimizeResult[source]

Find a local minimum of the objective function using SciPy.

get_z_scores() Dict[str, numpy.array][source]
print_z_scores() None[source]

Print the z-score values for all variables.

print_status() None[source]

Print a status report based on the current solution.

property objective_value: float[source]

Get the objective value (i.e. the sum of squares of all z-scores).

to_state_sbtab() sbtab.SBtab.SBtabDocument[source]

Create a state SBtab.

The state SBtab contains the values of the state-dependent variables, i.e. flux, concentrations of metabolites, concentrations of enzymes, and the ΔG’ values.

to_model_sbtab() sbtab.SBtab.SBtabDocument[source]

Create a model SBtab.

The model SBtab contains the values of the state-independent variables, i.e. kcatf, kcatr, Km, Ka, and Ki.