def __add_enzyme(self, reaction, cmpt_id):
     '''Adds enzyme to reaction in given compartment.'''
     sbo_term = sbml_utils.SBO_TERMS[sbml_utils.PROTEIN]
     modifier = sbml_utils.get_species(self.__model, cmpt_id,
                                       sbml_utils.get_unique_id(),
                                       sbo_term)
     ref = reaction.createModifier()
     ref.setSpecies(modifier.getId())
     ref.setSBOTerm(sbml_utils.SBO_TERMS[sbml_utils.ENZYME])
     return modifier
    def __get_func_def(self, formula, parameters, num_reacts, num_prods):
        '''Gets existing or creates new functionDefinition from given
        parameters.'''
        if formula in self.__formula_to_id:
            formula_id = self.__formula_to_id[formula]
            function_definition = \
                self.__model.getFunctionDefinition(formula_id)
        else:
            function_definition = self.__model.createFunctionDefinition()
            function_definition.setId(sbml_utils.get_unique_id())
            function_definition.setName(_get_func_name(num_reacts, num_prods))
            function_definition.setMath(_get_math(formula, parameters))
            self.__formula_to_id[formula] = function_definition.getId()

        return function_definition