7.1.2.10. pta.pmo
Construction and solution of Probabilistic Metabolic Optimization (PMO) problems.
7.1.2.10.1. Module Contents
- class pta.pmo.PmoProblemPool(num_processes: Optional[int], *argv)[source]
Creation of a process pool for solving multiple PMO problems on the same model.
- map(self, fn: Callable[[PmoProblem, Any], Any], inputs: Iterable[Any]) List[Any][source]
Execute a function on each input element.
This is the same as the regular
mapfunction, except that it executes in parallel on the available workers.- Parameters
fn (Callable[[PmoProblem, Any], Any]) – Function to be applied to each element.
inputs (Iterable[Any]) – An iterable containing the input elements.
- Returns
A list containing the result of applying the function to each input element.
- Return type
List[Any]
- class pta.pmo.PmoProblem(network: Union[cobra.Model, pta.flux_space.FluxSpace], thermodynamic_space: pta.thermodynamic_space.ThermodynamicSpace, thermodynamic_space_basis: pta.thermodynamic_space.ThermodynamicSpaceBasis = None, objective: Callable[[PmoProblem], cvxpy.problems.objective.Objective] = None, confidence_level: float = default_confidence_level, min_drg: float = default_min_drg, max_drg: float = default_max_drg, solver: Optional[str] = None, solver_options: dict = None)[source]
Construction and solution of a PMO problem.
- Parameters
network (Union[cobra.Model, FluxSpace]) – Cobra model or FluxSpace object describing the flux space of the metabolic network.
thermodynamic_space (ThermodynamicSpace) – Description of the thermodynamic space of the metabolic network.
thermodynamic_space_basis (ThermodynamicSpaceBasis, optional) – A basis for the thermodynamic space. If specified, m will be defined in this basis.
objective (Callable[ [PmoProblem], cp.problems.objective.Objective], optional) – A function used to set the optimization objective. By default the probability of in thermodynamic space is maximized.
confidence_level (float, optional) – Confidence level (in the range \([0.0, 1.0[\)) on the joint of the thermodynamic variables, by default 0.95.
min_drg (float, optional) – Minimum magnitude for the reaction energy of each reaction, by default 1e-1.
max_drg (float, optional) – Maximum magnitude for the reaction energy of each reaction, by default 1000.
solver (Optional[str], optional) – Name of the solver to use, this can be any of the solvers supported by CVXPY, by default None.
solver_options (dict, optional) – Dictionary specifying additional options for the solver.
- property flux_scale(self) numpy.ndarray[source]
Gets the vector of scaling factors for the scaled fluxes.
- property objective(self) Optional[Callable[[PmoProblem], cvxpy.problems.objective.Objective]][source]
Gets the function that constructs the PMO objective.
- property vs(self) cvxpy.Variable[source]
Gets the CVXPY variable representing scaled reaction fluxes.
- property m(self) cvxpy.Variable[source]
Gets the CVXPY variable representing the thermodynamic space in the minimal basis.
- property log_c(self) numpy.ndarray[source]
Gets the predicted log-concentrations. Can be none if concentrations are not represented explicitely.
- property drg0(self) numpy.ndarray[source]
Gets the predicted standard reaction energies. Can be none if standard reaction energies are not represented explicitely.
- property drg(self) numpy.ndarray[source]
Gets the predicted reaction energies. Can be none if reaction energies are not represented explicitely.
- property F(self) pta.flux_space.FluxSpace[source]
Gets the flux space associated with the PMO problem.
- property T(self) pta.thermodynamic_space.ThermodynamicSpace[source]
Gets the thermodynamic space associated with the PMO problem.
- property B(self) pta.thermodynamic_space.ThermodynamicSpaceBasis[source]
Gets the thermodynamic space basis associated with the PMO problem.
- property flux_lb_constraint(self) cvxpy.constraints.constraint.Constraint[source]
Gets the lower bound constraint for fluxes.
- property flux_ub_constraint(self) cvxpy.constraints.constraint.Constraint[source]
Gets the upper bound constraint for fluxes.
- property steady_state_constraint(self) cvxpy.constraints.constraint.Constraint[source]
Gets the steady state constraint.
- property confidence_constraint(self) cvxpy.constraints.constraint.Constraint[source]
Gets the constraint for the selected confidence level.
- property sign_constraints(self) cvxpy.constraints.constraint.Constraint[source]
Gets the reaction direction constraints. The constraints at indices 0 and 1 are constraints on the reaction energies, while 2 and 3 are constraints on the fluxes.
- solve(self, verbose=False) str[source]
Solves the PMO problem. The result of the optimization is stored inside the class.
- rebuild_for_directions(self, directions: numpy.ndarray) PmoProblem[source]
Construct a copy of this PMO problem constrained to the given reaction directions.
- Parameters
directions (np.ndarray) – Vector containing the directions (0: backward, 1: forward) of the reactions in T.
- Returns
A copy of this problem, constrained to the given directions.
- Return type