Wrapper for double_gene_deletion and the currently unimplemented double_reaction_deletion functions
cobra_model: a cobra.Model object
element_list_1: Is None or a list of elements (genes or reactions)
element_list_2: Is None or a list of elements (genes or reactions)
method: ‘fba’ or ‘moma’ to run flux balance analysis or minimization of metabolic adjustments.
single_deletion_growth_dict: A dictionary that provides the growth rate information for single gene knock outs. This can speed up simulations because nonviable single deletion strains imply that all double deletion strains will also be nonviable.
the_problem: Is None or ‘reuse’
element_type: ‘gene’ or ‘reaction’
solver: ‘glpk’, ‘gurobi’, or ‘cplex’.
error_reporting: None or True
Returns a dictionary of the elements in the x dimension (x), the y dimension (y), and the growth simulation data (data).
This will disable reactions for all gene pairs from gene_list_1 and gene_list_2 and then run simulations to optimize for the objective function. The contribution of each reaction to the objective function is indicated in cobra_model.reactions[:].objective_coefficient vector.
NOTE: We’ve assumed that there is no such thing as a synthetic rescue with this modeling framework.
cobra_model: a cobra.Model object
gene_list_1: Is None or a list of genes. If None then both gene_list_1 and gene_list_2 are assumed to correspond to cobra_model.genes.
gene_list_2: Is None or a list of genes. If None then gene_list_2 is assumed to correspond to gene_list_1.
method: ‘fba’ or ‘moma’ to run flux balance analysis or minimization of metabolic adjustments.
single_deletion_growth_dict: A dictionary that provides the growth rate information for single gene knock outs. This can speed up simulations because nonviable single deletion strains imply that all double deletion strains will also be nonviable.
the_problem: Is None, ‘return’, or an LP model object for the solver.
solver: ‘glpk’, ‘gurobi’, or ‘cplex’.
error_reporting: None or True
growth_tolerance: float. The effective lower bound on the growth rate for a single deletion that is still considered capable of growth.
Returns a dictionary of the gene ids in the x dimension (x) and the y dimension (y), and the growth simulation data (data).
Determines which components in an in silico medium are essential for growth in the context of the remaining components.
cobra_model: A Model object.
the_components: None or a list of external boundary reactions that will be sequentially disabled.
the_medium: Is None, a string, or a dictionary. If a string then the initialize_growth_medium function expects that the_model has an attribute dictionary called media_compositions, which is a dictionary of dictionaries for various medium compositions. Where a medium composition is a dictionary of external boundary reaction ids for the medium components and the external boundary fluxes for each medium component.
medium_compartment: the compartment in which the boundary reactions supplying the medium components exist
NOTE: that these fluxes must be negative because the convention is backwards means something is feed into the system.
solver: ‘glpk’, ‘gurobi’, or ‘cplex’
the_problem: Is None, ‘return’, or an LP model object for the solver.
Performs single and/or double deletion analysis on all the genes in the model. Provides an interface to parallelize the deletion studies.
Runs the minimization of metabolic adjustment method described in Segre et al 2002 PNAS 99(23): 15112-7.
wt_model: A cobra.Model object
mutant_model: A cobra.Model object with different reaction bounds vs wt_model. To simulate deletions
objective_sense: ‘maximize’ or ‘minimize’
solver: ‘gurobi’, ‘cplex’, or ‘glpk’. Note: glpk cannot be used with norm_type ‘euclidean’
tolerance_optimality: Solver tolerance for optimality.
tolerance_feasibility: Solver tolerance for feasibility.
the_problem: None or a problem object for the specific solver that can be used to hot start the next solution.
lp_method: The method to use for solving the problem. Depends on the solver. See the cobra.flux_analysis.solvers.py file for more info.
- For norm_type == ‘euclidean’:
- the primal simplex works best for the test model (gurobi: lp_method=0, cplex: lp_method=1)
combined_model: an output from moma that represents the combined optimization to be solved. when this is not none. only assume that bounds have changed for the mutant or wild-type. This saves 0.2 seconds in stacking matrices.
Assesses the ability of the model to produce all reactants in the_objective on an individual basis. Returns True if the_objective can be realized to exceed objective_cutoff. Otherwise, determines which components of the_objective are lagging and returns a dict of the components and their required and realized values.
Revised to take advantage of the new Reaction classes.
cobra_model: A cobra.Model
the_objectives: A list or a dictionary. If a list then a list of reactions for which the coefficient in the linear objective is set as 1. If a dictionary then the key is the reaction and the value is the linear coefficient for the respective reaction.
Wrapper for single_gene_deletion and the single_reaction_deletion functions
cobra_model: a cobra.Model object
element_list: Is None or a list of elements (genes or reactions) to delete.
method: ‘fba’ or ‘moma’
the_problem: Is None, ‘return’, or an LP model object for the solver.
element_type: ‘gene’ or ‘reaction’
solver: ‘glpk’, ‘gurobi’, or ‘cplex’.
discard_problems: Boolean. If True do not save problems. This will help with memory issues related to gurobi.
Returns a list of dictionaries: growth_rate_dict, solution_status_dict, problem_dict where the key corresponds to each element in element_list.
Performs optimization simulations to realize the objective defined from cobra_model.reactions[:].objective_coefficients after deleting each gene in gene_list from the model.
cobra_model: a cobra.Model object
element_list: Is None or a list of genes to delete. If None then disable each reaction associated with each gene in cobra_model.genes.
method: ‘fba’ or ‘moma’
the_problem: Is None or ‘reuse’.
solver: ‘glpk’, ‘gurobi’, or ‘cplex’.
Returns a list of dictionaries: growth_rate_dict, solution_status_dict, problem_dict where the key corresponds to each reaction in reaction_list.
TODO: Add in a section that allows copying and collection of problem for debugging purposes.
Performs optimization simulations to realize the objective defined from cobra_model.reactions[:].objective_coefficients after deleting each reaction from the model.
cobra_model: a cobra.Model object
element_list: Is None or a list of cobra.Reactions in cobra_model to disable. If None then disable each reaction in cobra_model.reactions and optimize for the objective function defined from cobra_model.reactions[:].objective_coefficients.
method: ‘fba’ is the only option at the moment.
the_problem: Is None, ‘reuse’, or an LP model object for the solver.
solver: ‘glpk’, ‘gurobi’, or ‘cplex’.
discard_problems: Boolean. If True do not save problems. This will help with memory issues related to gurobi.
Returns a list of dictionaries: growth_rate_dict, solution_status_dict, problem_dict where the key corresponds to each reaction in reaction_list.
Finds reactions that cannot carry a flux with the current exchange reaction settings for cobra_model, using flux variability analysis.
Runs flux variability analysis on a cobra.Model object
cobra_model: a Model object
fraction_of_optimum: fraction of the optimal solution that must be realized
the_reactions: list of reactions to run FVA on. if None then run on all reactions in the Model
allow_loops: Not Implemented. If false then run the simulations with the loop law method to remove loops.
the_problem: If ‘return’ or an LP model object for the specified solver then the optimizations will be sped up by attempting to use a previous solution as a starting point to optimize the current problem. Can reduce simulation time by over an order of magnitude.
solver: ‘glpk’, ‘gurobi’, or ‘cplex’.
the_problem: a problem object for the corresponding solver, ‘return’, or a float representing the wt_solution
number_of_processes: If greater than 1 then this function will attempt to parallelize the problem. NOTE: Currently not functional
returns a dictionary: {reaction.id: {‘maximum’: float, ‘minimum’: float}}
TODO: update how Metabolite._bound is handled so we can set a range instead of just a single value. This will be done in cobra.flux_analysis.solvers.