コード例 #1
0
ファイル: test_SBML.py プロジェクト: gustavoem/SigNetMS
 def test_add_reaction_with_former_unused_species(self):
     """ Tests if it we can add a new reaction using a species that
         was already defined in the model but was never present in 
         any reaction. """
     model = SBML()
     model.load_file("input/model_unused_species.xml")
     parameters = [{
         "name": "kcat",
         "value": .5
     }, {
         "name": "Km",
         "value": 5
     }]
     new_reaction = Reaction (\
             "unused --Rpp--> S", ["unused"], ["S"], ["Rpp"], \
             parameters, "kcat * Rpp * unused / (Km + unused)")
     nof_species_before = len(model.get_species_list())
     model.add_reaction(new_reaction)
     nof_species_after = len(model.get_species_list())
     self.assertEqual(nof_species_after, nof_species_before)
コード例 #2
0
ファイル: test_SBML.py プロジェクト: gustavoem/SigNetMS
    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)