src.model_balancing.model_balancing_cvx
A module for performing convex model balancing (using CVXPY).
Module Contents
- class src.model_balancing.model_balancing_cvx.ModelBalancingConvex(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', solver: str = 'MOSEK', beta: float = 0.0, **kwargs)[source]
Bases:
objectA class for performing Convex Model Balancing (using CVXPY).
All input parameters are provided through the constructor. Then running .solve() will find the (global) optimum and the result will be stored in the cvxpy.Variable objects that represent the independent variables: .ln_Km .ln_Ka .ln_Ki .ln_Keq .ln_kcatf .ln_conc_met and also in the two dependent cvxpy.Expression objects: .ln_kcatr .ln_conc_enz
Use the .value to get the solution for any of these Variables/Expressions. Alternatively, .to_model_sbtab and .to_state_sbtab return SBtab objects containing the state (met_conc, enz_conc) and the model (Km, Ki, Ka, Keq, kcatf, kcatr) values respectively.
- property ln_kcatr: cvxpy.Expression[source]
Calculate the kcat-reverse based on Haldane relationship constraint.
- property ln_eta_thermodynamic: cvxpy.Expression[source]
Calculate the thermodynamic term of the enzyme \(\eta^{thr}\).
- property ln_eta_kinetic: cvxpy.Expression[source]
Calculate the kinetic (saturation) term of the enzyme \(\eta^{kin}\).
- property ln_eta_regulation: cvxpy.Expression[source]
Calculate the regulation (allosteric) term of the enzyme \(\eta^{reg}\).
- property ln_conc_enz: cvxpy.Expression[source]
Calculate the required enzyme levels based on fluxes and rate laws.
- penalty_term_beta(ln_Km: numpy.array | cvxpy.Expression, ln_conc_met: numpy.array | cvxpy.Expression) cvxpy.Expression[source]
Calculate the penalty term for c/Km.
- 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).
- 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(verbose: bool = False) str[source]
Use CVXPY to find the global optimum that minimizes all z-scores.
- find_inner_point(verbose: bool = False) Any[source]
Find a point insize the feasible thermodynamic space.
If the geometric mean is not a feasible solution, we will need this function in order to initialize the solver with a point inside the thermodynamically feasible space.
- property objective_value: float[source]
Get the objective value (i.e. the sum of squares of all z-scores).