def find_protein_complexes(model): """ Find tuples of gene identifiers that comprise functional enzyme complexes. Parameters ---------- model : cobra.Model The metabolic model under investigation. Returns ------- set A set of tuples of genes that are connected via "AND" in gene-protein-reaction rules (GPR) and thus constitute protein complexes. """ protein_complexes = set() for rxn in model.reactions: if rxn.gene_reaction_rule: for candidate in helpers.find_functional_units( rxn.gene_reaction_rule): if len(candidate) >= 2: protein_complexes.add(tuple(candidate)) return protein_complexes
def find_protein_complexes(model): """ Find tuples of gene identifiers that constitute functional enzyme complexes. Parameters ---------- model : cobra.Model The metabolic model under investigation. """ protein_complexes = set() for rxn in model.reactions: if rxn.gene_reaction_rule: for candidate in helpers.find_functional_units( rxn.gene_reaction_rule): if len(candidate) >= 2: protein_complexes.add(tuple(candidate)) return protein_complexes
def test_find_functional_units(gpr_str, expected): """Expect type of enzyme complexes to be identified correctly.""" assert list(helpers.find_functional_units(gpr_str)) == expected