flux_analysis Package — cobra 0.2.0 documentation

### Navigation

- index
- modules |
- next |
- previous |
- cobra 0.2.0 documentation »
- cobra Package »

# flux_analysis Package

## `flux_analysis` Package

## `double_deletion` Module

`cobra.flux_analysis.double_deletion.` `double_deletion`(cobra_model, element_list_1=None, element_list_2=None, method='fba', single_deletion_growth_dict=None, the_problem='return', element_type='gene', solver='glpk', error_reporting=None, number_of_processes=1)

  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).

`cobra.flux_analysis.double_deletion.` `double_gene_deletion`(cobra_model, gene_list_1=None, gene_list_2=None, method='fba', single_deletion_growth_dict=None, the_problem='return', solver='glpk', growth_tolerance=1e-08, error_reporting=None)

  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).

## `essentiality` Module

`cobra.flux_analysis.essentiality.` `assess_medium_component_essentiality`(cobra_model, the_components=None, the_medium=None, medium_compartment='e', solver='glpk', the_problem='return', the_condition=None, method='fba')

  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.

  returns:
    essentiality_dict: A dictionary providing the maximum growth rate accessible when the respective component is removed from the medium.

`cobra.flux_analysis.essentiality.` `deletion_analysis`(cobra_model, the_medium=None, deletion_type='single', work_directory=None, growth_cutoff=0.001, the_problem='return', number_of_processes=6, element_type='gene', solver='glpk', error_reporting=None, method='fba', element_list=None)

  Performs single and/or double deletion analysis on all the genes in the model. Provides an interface to parallelize the deletion studies.

## `moma` Module

`cobra.flux_analysis.moma.` `moma`(wt_model, mutant_model, objective_sense='maximize', solver='gurobi', tolerance_optimality=1e-08, tolerance_feasibility=1e-08, minimize_norm=False, the_problem='return', lp_method=0, combined_model=None, norm_type='euclidean', print_time=False)

  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.

## `objective` Module

`cobra.flux_analysis.objective.` `assess_objective`(cobra_model, the_objective=None, objective_cutoff=0.001, growth_medium=None)

  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.

`cobra.flux_analysis.objective.` `update_objective`(cobra_model, the_objectives)

  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.

## `single_deletion` Module

`cobra.flux_analysis.single_deletion.` `single_deletion`(cobra_model, element_list=None, method='fba', the_problem='return', element_type='gene', solver='glpk', error_reporting=None)

  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.

`cobra.flux_analysis.single_deletion.` `single_gene_deletion`(cobra_model, element_list=None, method='fba', the_problem='reuse', solver='glpk', error_reporting=None)

  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.

`cobra.flux_analysis.single_deletion.` `single_reaction_deletion`(cobra_model, element_list=None, method='fba', the_problem='return', solver='glpk', error_reporting=None, discard_problems=True)

  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.

## `variability` Module

`cobra.flux_analysis.variability.` `find_blocked_reactions`(cobra_model, the_reactions=None, allow_loops=True, solver='glpk', the_problem='return', tolerance_optimality=1e-09, open_exchanges=False)

  Finds reactions that cannot carry a flux with the current exchange reaction settings for cobra_model, using flux variability analysis.

`cobra.flux_analysis.variability.` `flux_variability_analysis`(cobra_model, fraction_of_optimum=1.0, objective_sense='maximize', the_reactions=None, allow_loops=True, solver='glpk', the_problem='return', tolerance_optimality=1e-06, tolerance_feasibility=1e-06, tolerance_barrier=1e-08, lp_method=1, lp_parallel=0, new_objective=None, relax_b=None, error_reporting=None, number_of_processes=1, copy_model=True)

  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.

`cobra.flux_analysis.variability.` `flux_variability_analysis_wrapper`(keywords)

  Provides an interface to call flux_variability_analysis from ppmap

`cobra.flux_analysis.variability.` `run_fva`(solver='cplex')

  For debugging purposes only

### Navigation

- index
- modules |
- next |
- previous |
- cobra 0.2.0 documentation »
- cobra Package »