Exemplo n.º 1
0
    def create_sbml(self, model: libsbml.Model):
        obj = model.createFunctionDefinition(
        )  # type: libsbml.FunctionDefinition
        self.set_fields(obj, model)

        self.create_port(model)
        return obj
Exemplo n.º 2
0
def _create_function(model: sbml.Model,
                     function_id: str,
                     arguments: str,
                     formula: str):
    """
    Creates a functionDefinition and adds it to the given SBML model.

    Arguments:
        model: SBML model to which the function will be added.
        function_id: the function id/name
        arguments: the arguments of the function (species AND parameters)
        formula: the formula of the function

    Returns:

    Raises:

    """
    f = model.createFunctionDefinition()
    f.setId(function_id)
    math = sbml.parseL3Formula('lambda(' + arguments + ', ' + formula + ')')
    f.setMath(math)