Exemple #1
0
    def test_reaction_down_regulation_target(self, model):
        reaction_id = "PGI"
        ref_val = 4.86
        value = 3.4

        # (B - A) / A
        fold_change = -0.30041

        down_reg_target = ReactionModulationTarget(reaction_id, value, ref_val)
        assert round(abs(down_reg_target.fold_change - fold_change), 5) == 0
        with model:
            down_reg_target.apply(model)
            assert model.reactions.PGI.upper_bound == 3.4
            assert model.reactions.PGI.lower_bound == -1000
            assert abs(model.slim_optimize() - 0.8706) < 0.0001

        assert model.reactions.PGI.upper_bound == 1000
        assert model.reactions.PGI.lower_bound == -1000

        reaction_id = "RPI"
        ref_val = -2.28150
        value = -1.5

        fold_change = -0.342537

        down_reg_target = ReactionModulationTarget(reaction_id, value, ref_val)
        assert round(abs(down_reg_target.fold_change - fold_change), 5) == 0
        with model:
            down_reg_target.apply(model)
            assert model.reactions.RPI.lower_bound == -1.5
            assert model.reactions.RPI.upper_bound == 1000
            assert abs(model.slim_optimize() - 0.8691) < 0.0001

        assert model.reactions.RPI.lower_bound == -1000
        assert model.reactions.RPI.upper_bound == 1000
Exemple #2
0
    def test_invalid_reaction_modulation_target(self, model):
        reaction_id = "PGI_XY"
        ref_val = 4.86
        value = 4

        down_reg_target = ReactionModulationTarget(reaction_id, value, ref_val)

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

        reaction_id = "RPI_Z"
        ref_val = -2.28150
        value = -2.0

        down_reg_target = ReactionModulationTarget(reaction_id, value, ref_val)

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