Example #1
0
 def test_remove_reaction(self):
     """ Tests if it is possible to remove a reaction from an SBML
     model.
     """
     model = SBML()
     model.load_file("input/model1_bioinformatics.xml")
     model.remove_reaction("reaction_0")
     removed_formula = "compartment * k1 * S"
     all_formula = model.get_all_reaction_formulas()
     assert (removed_formula not in all_formula)
Example #2
0
    def test_add_reaction(self):
        """ Tests if it is possible to add a reaction to an SBML model. 
        """
        model = SBML()
        model.load_file("input/model1_bioinformatics.xml")

        parameters = [{
            "name": "kcat",
            "value": .5
        }, {
            "name": "Km",
            "value": 5
        }]
        new_reaction = Reaction("R --dS--> Rpp", ["R"], ["Rpp"], ["dS"],
                                parameters, "kcat * dS * R / (Km + R)")
        model.add_reaction(new_reaction)
        all_formula = model.get_all_reaction_formulas()
        assert (new_reaction.formula in all_formula)

        # new products/reactants
        model = SBML()
        model.load_file("input/model1_bioinformatics.xml")
        new_reaction = Reaction("Dummy ---> Dummy2", ["Dummy"], ["Dummy2"], [],
                                parameters, "kcat * Dummy / (Km + Dummy)")
        model.add_reaction(new_reaction)
        all_formula = model.get_all_reaction_formulas()
        assert (new_reaction.formula in all_formula)

        # new modifiers
        model = SBML()
        model.load_file("input/model1_bioinformatics.xml")
        new_reaction = Reaction("R --Dummy--> Rpp", ["R"], ["Rpp"], ["Dummy"],
                                parameters, "kcat * Dummy * R / (Km + R)")
        model.add_reaction(new_reaction)
        all_formula = model.get_all_reaction_formulas()
        assert (new_reaction.formula in all_formula)