コード例 #1
0
ファイル: factory.py プロジェクト: sankha555/sbmlutils
    def create_sbml(self, model: libsbml.Model):
        obj = model.createFunctionDefinition(
        )  # type: libsbml.FunctionDefinition
        self.set_fields(obj, model)

        self.create_port(model)
        return obj
コード例 #2
0
ファイル: yaml2sbml.py プロジェクト: alex-treebeard/yaml2sbml
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)