Esempio n. 1
0
    def test_reaction_cofactor_swap_target(self, model):
        cofactor_id_swaps = [("nad_c", "nadh_c"), ("nadp_c", "nadph_c")]

        swap_pairs = ([
            model.metabolites.get_by_id(m) for m in cofactor_id_swaps[0]
        ], [model.metabolites.get_by_id(m) for m in cofactor_id_swaps[1]])

        swap_target = ReactionCofactorSwapTarget("GAPD", swap_pairs)
        with model:
            swap_target.apply(model)
            assert model.metabolites.nad_c not in model.reactions.GAPD.metabolites
            assert model.metabolites.nadh_c not in model.reactions.GAPD.metabolites
            assert model.metabolites.nadp_c in model.reactions.GAPD.metabolites
            assert model.metabolites.nadph_c in model.reactions.GAPD.metabolites

        assert model.metabolites.nadp_c not in model.reactions.GAPD.metabolites
        assert model.metabolites.nadph_c not in model.reactions.GAPD.metabolites
        assert model.metabolites.nad_c in model.reactions.GAPD.metabolites
        assert model.metabolites.nadh_c in model.reactions.GAPD.metabolites

        swap_target = ReactionCofactorSwapTarget("GND", swap_pairs)
        with model:
            swap_target.apply(model)
            assert model.metabolites.nad_c in model.reactions.GND.metabolites
            assert model.metabolites.nadh_c in model.reactions.GND.metabolites
            assert model.metabolites.nadp_c not in model.reactions.GND.metabolites
            assert model.metabolites.nadph_c not in model.reactions.GND.metabolites

        assert model.metabolites.nadp_c in model.reactions.GND.metabolites
        assert model.metabolites.nadph_c in model.reactions.GND.metabolites
        assert model.metabolites.nad_c not in model.reactions.GND.metabolites
        assert model.metabolites.nadh_c not in model.reactions.GND.metabolites
Esempio n. 2
0
    def test_invalid_reaction_cofactor_swap_target(self, model):
        cofactor_id_swaps = [("nad_c", "nadh_c"), ("nadp_c", "nadph_c")]

        swap_pairs = ([model.metabolites.get_by_id(m) for m in cofactor_id_swaps[0]],
                      [model.metabolites.get_by_id(m) for m in cofactor_id_swaps[1]])

        swap_target = ReactionCofactorSwapTarget("GAPD_124", swap_pairs)

        with pytest.raises(KeyError):
            swap_target.apply(model)

        swap_target = ReactionCofactorSwapTarget("ACKr", swap_pairs)

        with pytest.raises(ValueError):
            swap_target.apply(model)