src.model_balancing.model_balancing_noncvx ========================================== .. py:module:: src.model_balancing.model_balancing_noncvx .. autoapi-nested-parse:: A module for performing full model balancing (using SciPy). Module Contents --------------- .. py:class:: 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) Bases: :py:obj:`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). .. py:attribute:: S .. py:attribute:: fluxes .. py:attribute:: A_act .. py:attribute:: A_inh .. py:attribute:: metabolite_names .. py:attribute:: reaction_names .. py:attribute:: state_names .. py:attribute:: rate_law :value: 'CM' .. py:attribute:: alpha :value: 1.0 .. py:attribute:: beta :value: 0.0 .. py:attribute:: Ncond .. py:attribute:: ln_geom_mean .. py:attribute:: precision_ln .. py:attribute:: ln_lower_bound .. py:attribute:: ln_upper_bound .. py:attribute:: ln_true_value .. py:method:: var_dict_to_vector(var_dict: Dict[str, numpy.array], param_order: List[str] = INDEPENDENT_VARIABLES) -> numpy.array Get the variable vector (x). .. py:method:: extend_var_dict_to_dependent_params(var_dict: Dict[str, numpy.ndarray]) -> None .. py:method:: var_vector_to_dict_all(x: numpy.ndarray) -> Dict[str, numpy.ndarray] Get a dictionary with all dependent and independent variable values. .. py:method:: var_vector_to_z_scores(x: numpy.ndarray) -> Dict[str, float] .. py:method:: var_dict_to_z_scores(var_dict: Dict[str, float]) -> Dict[str, float] .. py:method:: objective_function(x: numpy.ndarray) -> float 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. .. py:method:: penalty_term_beta(var_dict: Dict[str, float]) -> float Calculate the penalty term for c/Km. .. py:property:: driving_forces :type: numpy.ndarray Calculates the driving forces of all reactions. .. py:property:: ln_kcatr :type: numpy.ndarray Calculate the kcat-reverse based on Haldane relationship constraint. .. py:property:: ln_eta_thermodynamic :type: numpy.ndarray Calculate the thermodynamic term of the enzyme. .. py:property:: ln_eta_kinetic :type: numpy.ndarray Calculate the kinetic (saturation) term of the enzyme. .. py:property:: ln_eta_regulation :type: numpy.ndarray Calculate the regulation (allosteric) term of the enzyme. .. py:property:: ln_conc_enz :type: numpy.ndarray Calculate the required enzyme levels based on fluxes and rate laws. .. py:method:: is_gmean_feasible() -> bool 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). .. py:property:: thermodynamic_constraints :type: scipy.optimize.LinearConstraint Construct the thermodynamic constraints for the variable vector. .. py:method:: extend_variable_vector(x: numpy.ndarray) -> numpy.ndarray Add the dependent variables to a vector of the independen ones. .. py:property:: parameter_constraints :type: scipy.optimize.NonlinearConstraint .. py:method:: initialize_with_gmeans() -> None 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. .. py:method:: solve(basinhopping_kwargs: Optional[dict] = None, minimizer_kwargs: Optional[dict] = None) -> scipy.optimize.OptimizeResult Find a local minimum of the objective function using SciPy. .. py:method:: get_z_scores() -> Dict[str, numpy.array] .. py:method:: print_z_scores() -> None Print the z-score values for all variables. .. py:method:: print_status() -> None Print a status report based on the current solution. .. py:property:: objective_value :type: float Get the objective value (i.e. the sum of squares of all z-scores). .. py:method:: to_state_sbtab() -> sbtab.SBtab.SBtabDocument 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. .. py:method:: to_model_sbtab() -> sbtab.SBtab.SBtabDocument Create a model SBtab. The model SBtab contains the values of the state-independent variables, i.e. kcatf, kcatr, Km, Ka, and Ki.