17.1.1.4. cobra.manipulation

17.1.1.4.1. Submodules

17.1.1.4.2. Package Contents

17.1.1.4.2.1. Functions

add_SBO(model)

adds SBO terms for demands and exchanges

delete_model_genes(cobra_model, gene_list, cumulative_deletions=True, disable_orphans=False)

delete_model_genes will set the upper and lower bounds for reactions

find_gene_knockout_reactions(cobra_model, gene_list, compiled_gene_reaction_rules=None)

identify reactions which will be disabled when the genes are knocked out

remove_genes(cobra_model, gene_list, remove_reactions=True)

remove genes entirely from the model

undelete_model_genes(cobra_model)

Undoes the effects of a call to delete_model_genes in place.

escape_ID(cobra_model)

makes all ids SBML compliant

get_compiled_gene_reaction_rules(cobra_model)

Generates a dict of compiled gene_reaction_rules

check_mass_balance(model)

check_metabolite_compartment_formula(model)

cobra.manipulation.add_SBO(model)[source]

adds SBO terms for demands and exchanges

This works for models which follow the standard convention for constructing and naming these reactions.

The reaction should only contain the single metabolite being exchanged, and the id should be EX_metid or DM_metid

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

delete_model_genes will set the upper and lower bounds for reactions catalysed 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.

cobra.manipulation.find_gene_knockout_reactions(cobra_model, gene_list, compiled_gene_reaction_rules=None)[source]

identify reactions which will be disabled when the genes are knocked out

cobra_model: Model

gene_list: iterable of Gene

compiled_gene_reaction_rules: dict of {reaction_id: compiled_string}

If provided, this gives pre-compiled gene_reaction_rule strings. The compiled rule strings can be evaluated much faster. If a rule is not provided, the regular expression evaluation will be used. Because not all gene_reaction_rule strings can be evaluated, this dict must exclude any rules which can not be used with eval.

cobra.manipulation.remove_genes(cobra_model, gene_list, remove_reactions=True)[source]

remove genes entirely from the model

This will also simplify all gene_reaction_rules with this gene inactivated.

cobra.manipulation.undelete_model_genes(cobra_model)[source]

Undoes the effects of a call to delete_model_genes in place.

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

cobra.manipulation.escape_ID(cobra_model)[source]

makes all ids SBML compliant

cobra.manipulation.get_compiled_gene_reaction_rules(cobra_model)

Generates a dict of compiled gene_reaction_rules

Any gene_reaction_rule expressions which cannot be compiled or do not evaluate after compiling will be excluded. The result can be used in the find_gene_knockout_reactions function to speed up evaluation of these rules.

cobra.manipulation.check_mass_balance(model)[source]
cobra.manipulation.check_metabolite_compartment_formula(model)[source]