15.1.1.4.1.2. cobra.manipulation.delete

15.1.1.4.1.2.1. Module Contents

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

Remove metabolites that are not involved in any reactions

Parameters:cobra_model (cobra.Model) – the model to remove unused metabolites from
Returns:list of metabolites that were removed
Return type:list
cobra.manipulation.delete.prune_unused_reactions(cobra_model)[source]

Remove reactions that have no assigned metabolites

Parameters:cobra_model (cobra.Model) – the model to remove unused reactions from
Returns:list of reactions that were removed
Return type:list
cobra.manipulation.delete.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.delete.get_compiled_gene_reaction_rules(cobra_model)[source]

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

class cobra.manipulation.delete._GeneRemover(target_genes)[source]
__init__(target_genes)[source]
visit_Name(node)[source]
visit_BoolOp(node)[source]
cobra.manipulation.delete.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.