manipulation Package

manipulation Package

delete Module

cobra.manipulation.delete.delete_model_genes(cobra_model, gene_list, cumulative_deletions=False, disable_orphans=False)[source]

delete_model_genes will set the upper and lower bounds for reactions catalyzed by the genes in gene_list if deleting the genes means that the reaction cannot proceed according to cobra_model.reactions[:].gene_reaction_rule

cumulative_deletions: False or True. If True then any previous deletions will be maintained in the model.

TODO: Rewrite to use dicts for _trimmed*

TODO: All this will be replaced by Boolean logic associated with #the cobra.Gene.functional in cobra.Reaction.gene_reaction_rule

TODO: Update this to refer to cobra.(Gene|Reaction) in the _trimmed_(genes|reactions) fields and remove _trimmed_indices

cobra.manipulation.delete.prune_unused_metabolites(cobra_model)[source]

Removes metabolites that aren’t involved in any reactions in the model

cobra_model: A Model object.

cobra.manipulation.delete.prune_unused_reactions(cobra_model)[source]

Removes reactions from cobra_model.

cobra_model: A Model object.

reactions_to_prune: None, a string matching a reaction.id, a cobra.Reaction, or as list of the ids / Reactions to remove from cobra_model. If None then the function will delete reactions that have no active metabolites in the model.

cobra.manipulation.delete.undelete_model_genes(cobra_model)[source]

Undoes the effects of a call to delete_model_genes. Modifies cobra_model in place.

cobra_model: A cobra.Model object

modify Module

cobra.manipulation.modify.convert_rule_to_boolean_rule(cobra_model, the_rule, return_gene_indices=False, index_offset=0)[source]

Used to convert a text based gpr to an index based gpr. This will also update the cobra_model.

the_rule: A COBRA 2.0 compliant GPR string

return_gene_indices: Boolean return the indices for the genes

index_offset: Integer. Set to 1 if the rules need to be generated for base 1 software like MATLAB.

TODO: Test now that cobra.Gene is in use DEPRECATED: This should be moved to the mlab module

cobra.manipulation.modify.convert_to_irreversible(cobra_model)[source]

Will break all of the reversible reactions into two separate irreversible reactions with different directions. Useful for some modeling problems.

cobra_model: A Model object which will be modified in place.

TODO: Can we just use a -1*guided_copy or something else?

cobra.manipulation.modify.initialize_growth_medium(cobra_model, the_medium='MgM', external_boundary_compartment='e', external_boundary_reactions=None, reaction_lower_bound=0.0, reaction_upper_bound=1000.0, irreversible=False, reactions_to_disable=None)[source]

Sets all of the input fluxes to the model to zero and then will initialize the input fluxes to the values specified in the_medium if it is a dict or will see if the model has a composition dict and use that to do the initialization.

cobra_model: A cobra.Model object.

the_medium: 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.

external_boundary_compartment: None or a string. If not None then it specifies the compartment in which to disable all of the external systems boundaries.

external_boundary_reactions: None or a list of external_boundaries that are to have their bounds reset. This acts in conjunction with external_boundary_compartment.

reaction_lower_bound: Float. The default value to use for the lower bound for the boundary reactions.

reaction_upper_bound: Float. The default value to use for the upper bound for the boundary.

irreversible: Boolean. If the model is irreversible then the medium composition is taken as the upper bound

reactions_to_disable: List of reactions for which the upper and lower bounds are disabled. This is superceded by the contents of media_composition

cobra.manipulation.modify.revert_to_reversible(cobra_model)[source]

This function will convert a reversible model made by convert_to_irreversible into a reversible model.

cobra_model: A cobra.Model object which will be modified in place.

NOTE: It might just be easiest to include this function in the Reaction class

Table Of Contents

Previous topic

io Package

Next topic

mlab Package

This Page