def test_reactions_in_group_become_blocked_if_one_is_removed( self, core_model): essential_reactions = core_model.essential_reactions() coupled_reactions = structural.find_coupled_reactions_nullspace( core_model) for group in coupled_reactions: representative = pick_one(group) if representative not in essential_reactions: with TimeMachine() as tm: assert core_model == representative.model tm(do=partial(core_model.remove_reactions, [representative], delete=False), undo=partial(core_model.add_reactions, [representative])) # # FIXME: Hack because of optlang queue issues with GLPK # core_model.solver.update() assert representative not in core_model.reactions assert representative.forward_variable not in core_model.solver.variables assert representative.reverse_variable not in core_model.solver.variables assert representative not in core_model.reactions assert representative.model is None blocked_reactions = find_blocked_reactions(core_model) assert all(r in blocked_reactions for r in group if r != representative) assert representative in core_model.reactions coupled_reactions = structural.find_coupled_reactions(core_model) for group in coupled_reactions: representative = pick_one(group) if representative not in essential_reactions: with TimeMachine() as tm: fwd_var_name = representative.forward_variable.name rev_var_name = representative.reverse_variable.name assert core_model == representative.model tm(do=partial(core_model.remove_reactions, [representative], delete=False), undo=partial(core_model.add_reactions, [representative])) # # FIXME: Hack because of optlang queue issues with GLPK # core_model.solver.update() assert representative not in core_model.reactions assert fwd_var_name not in core_model.solver.variables assert rev_var_name not in core_model.solver.variables assert representative not in core_model.reactions assert representative.model is None blocked_reactions = find_blocked_reactions(core_model) assert representative not in core_model.reactions assert all(r in blocked_reactions for r in group if r != representative) assert representative in core_model.reactions
def test_find_blocked_reactions(self): self.model.reactions.PGK.knock_out( ) # there are no blocked reactions in EcoliCore blocked_reactions = find_blocked_reactions(self.model) self.assertEqual( blocked_reactions, [self.model.reactions.GAPD, self.model.reactions.PGK])
def test_reactions_in_group_become_blocked_if_one_is_removed(self, core_model): essential_reactions = find_essential_reactions(core_model) coupled_reactions = structural.find_coupled_reactions_nullspace(core_model) for group in coupled_reactions: representative = pick_one(group) if representative not in essential_reactions: with core_model: assert core_model == representative.model core_model.remove_reactions([representative]) # # FIXME: Hack because of optlang queue issues with GLPK # core_model.solver.update() assert representative not in core_model.reactions assert representative.forward_variable not in core_model.solver.variables assert representative.reverse_variable not in core_model.solver.variables assert representative not in core_model.reactions assert representative.model is None blocked_reactions = find_blocked_reactions(core_model) assert all(r in blocked_reactions for r in group if r != representative) assert representative in core_model.reactions coupled_reactions = structural.find_coupled_reactions(core_model) for group in coupled_reactions: representative = pick_one(group) if representative not in essential_reactions: with core_model: fwd_var_name = representative.forward_variable.name rev_var_name = representative.reverse_variable.name assert core_model == representative.model core_model.remove_reactions([representative]) # # FIXME: Hack because of optlang queue issues with GLPK # core_model.solver.update() assert representative not in core_model.reactions assert fwd_var_name not in core_model.solver.variables assert rev_var_name not in core_model.solver.variables assert representative not in core_model.reactions assert representative.model is None blocked_reactions = find_blocked_reactions(core_model) assert representative not in core_model.reactions assert all(r in blocked_reactions for r in group if r != representative) assert representative in core_model.reactions
def test_find_blocked_reactions(core_model): core_model.reactions.PGK.knock_out() blocked_reactions = find_blocked_reactions(core_model) assert blocked_reactions == {core_model.reactions.GAPD, core_model.reactions.PGK}
def test_find_blocked_reactions(self): self.model.reactions.PGK.knock_out() # there are no blocked reactions in EcoliCore blocked_reactions = find_blocked_reactions(self.model) self.assertEqual(blocked_reactions, [self.model.reactions.GAPD, self.model.reactions.PGK])
def test_find_blocked_reactions(core_model): core_model.reactions.PGK.knock_out() blocked_reactions = find_blocked_reactions(core_model) assert blocked_reactions == {core_model.reactions.GAPD, core_model.reactions.PGK}