Skip to content

factory

Factory for creating SBML objects.

This module provides definitions of helper functions for the creation of SBML objects. These are the low level helpers to create models from scratch and are used in the higher level SBML factories.

The general workflow to create new SBML models isto create a lists/iterables of SBMLObjects by using the respective classes in this module, e.g. Compartment, Parameter, Species.

The actual SBase objects are than created in the SBMLDocument/Model by calling create_objects(model, objects) These functions DO NOT take care of the order of the creation, but the order must be correct in the model definition files. To create complete models one should use the modelcreator functionality, which takes care of the order of object creation.

ReactionEquation

ReactionEquation(
    reactants=None,
    products=None,
    modifiers=None,
    reversible=True,
)

Representation of stoichiometric equations with modifiers.

Initialize equation.

EquationException

Bases: Exception

Exception in Equation.

from_str staticmethod

from_str(equation_str)

Parse components of equation string.

to_string

to_string(modifiers=False)

Get string representation of equation.

info

info()

Print overview of parsed equation.

help staticmethod

help()

Get help information string.

ValidationOptions dataclass

ValidationOptions(
    log_errors=True,
    internal_consistency=True,
    general_consistency=True,
    identifier_consistency=True,
    mathml_consistency=True,
    units_consistency=True,
    sbo_consistency=True,
    overdetermined_model=True,
    modeling_practice=True,
)

Options for SBML validator.

Controls the consistency checks that are performed when SBMLDocument.checkConsistency() is called.

  • general_consistency: Correctness and consistency of specific SBML language constructs. Performing this set of checks is highly recommended. With respect to the SBML specification, these concern failures in applying the validation rules numbered 2xxxx in the Level 2 Versions 2-4 and Level 3 Versions 1-2 specifications.

  • ìdentifier_consistency: Correctness and consistency of identifiers used for model entities. An example of inconsistency would be using a species identifier in a reaction rate formula without first having declared the species. With respect to the SBML specification, these concern failures in applying the validation rules numbered 103xx in the Level 2 Versions 2-4 and Level 3 Versions 1-2 specifications.

  • units_consistency: Consistency of measurement units associated with quantities in a model. With respect to the SBML specification, these concern failures in applying the validation rules numbered 105xx in the Level 2 Versions 2-4 and Level 3 Versions 1-2 specifications.

  • mathml_consistency: Syntax of MathML constructs. With respect to the SBML specification, these concern failures in applying the validation rules numbered 102xx in the Level 2 Versions 2-4 and Level 3 Versions 1-2 specifications.

  • sbo_consistency: Consistency and validity of SBO identifiers (if any) used in the model. With respect to the SBML specification, these concern failures in applying the validation rules numbered 107xx in the Level 2 Versions 2-4 and Level 3 Versions 1-2 specifications.

  • overdetermined_model: Static analysis of whether the system of equations implied by a model is mathematically overdetermined. With respect to the SBML specification, this is validation rule #10601 in the Level 2 Versions 2-4 and Level 3 Versions 1-2 specifications.

  • modeling_practise: Additional checks for recommended good modeling practice. (These are tests performed by libSBML and do not have equivalent SBML validation rules.) By default, all validation checks are applied to the model in an SBMLDocument object unless SBMLDocument.setConsistencyChecks() is called to indicate that only a subset should be applied. Further, this default (i.e., performing all checks) applies separately to each new SBMLDocument object created. In other words, each time a model is read using SBMLReader.readSBML(), SBMLReader.readSBMLFromString(), or the global functions readSBML() and readSBMLFromString(), a new SBMLDocument is created and for that document, a call to SBMLDocument.checkConsistency() will default to applying all possible checks. Calling programs must invoke SBMLDocument.setConsistencyChecks() for each such new model if they wish to change the consistency checks applied.

  • internal_consistency: Additional checks that model is consistent XML.

  • log_errors Boolean flag to log errors.

ModelUnits

ModelUnits(
    time=None,
    extent=None,
    substance=None,
    length=None,
    area=None,
    volume=None,
)

Class for storing model units information.

The ModelUnits define globally the units for time, extent, substance, length, area and volume.

The following SBML Level 3 base units can be used.

ampere farad joule lux radian volt avogadro gram katal metre second watt becquerel gray kelvin mole siemens weber candela henry kilogram newton sievert coulomb hertz litre ohm steradian dimensionless item lumen pascal tesla

Construct ModelUnits.

set_model_units staticmethod

set_model_units(model, model_units)

Set the main units in model from dictionary.

Setting the model units is important for understanding the model dynamics. Allowed keys are: time extent substance length area volume

:param model: SBMLModel :param model_units: dict of units :return:

Sbase

Sbase(
    sid=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Base class of all SBML objects.

get_notes_xml

get_notes_xml()

Get notes xml string.

create_port

create_port(model)

Create port if existing.

create_uncertainties

create_uncertainties(obj, model)

Create distrib:Uncertainty objects.

create_replaced_by

create_replaced_by(sbase, model)

Create comp:ReplacedBy.

create_key_value_pairs

create_key_value_pairs(sbase)

Create fbc:keyValuePair.

KeyValuePair

KeyValuePair(
    key,
    value,
    uri,
    sid=None,
    name=None,
    sboTerm=None,
    metaId=None,
    notes=None,
    annotations=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: Sbase

KeyValuePair.

Create a KeyValuePair.

create_sbml

create_sbml(sbase)

Create KeyValuePair on object.

Value

Value(
    sid,
    value,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: Sbase

Helper class.

The value field is a helper storage field which is used differently by different subclasses.

UnitDefinition

UnitDefinition(
    sid,
    definition=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    replacedBy=None,
)

Bases: Sbase

Unit.

Corresponds to the information in the libsbml.UnitDefinition.

Construct UnitDefinition.

create_sbml

create_sbml(model)

Create libsbml.UnitDefinition.

get_uid_for_unit staticmethod

get_uid_for_unit(unit)

Get unit id for given definition string.

Units

Base class for unit definitions.

attributes classmethod

attributes()

Get the attributes list.

create_unit_definitions classmethod

create_unit_definitions(model)

Create the libsbml.UnitDefinitions in the model.

ValueWithUnit

ValueWithUnit(
    sid,
    value,
    unit=dimensionless,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: Value

Helper class.

The value field is a helper storage field which is used differently by different subclasses.

Function

Function(
    sid,
    value,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: Sbase

SBML FunctionDefinitions.

FunctionDefinitions consist of a lambda expression in the value field, e.g., lambda(x,y, piecewise(x,gt(x,y),y) ) # definition of minimum function lambda(x, sin(x) )

Construct Function.

create_sbml

create_sbml(model)

Create FunctionDefinition SBML in model.

Parameter

Parameter(
    sid,
    value=None,
    unit=None,
    constant=True,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: ValueWithUnit

Parameter.

Construct Parameter.

create_sbml

create_sbml(model)

Create Parameter SBML in model.

Compartment

Compartment(
    sid,
    value,
    unit=None,
    constant=True,
    spatialDimensions=3,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: ValueWithUnit

Compartment.

Construct Compartment.

create_sbml

create_sbml(model)

Create Compartment SBML in model.

Species

Species(
    sid,
    compartment,
    initialAmount=None,
    initialConcentration=None,
    substanceUnit=None,
    hasOnlySubstanceUnits=False,
    constant=False,
    boundaryCondition=False,
    charge=None,
    chemicalFormula=None,
    conversionFactor=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: Sbase

Species.

Construct Species.

create_sbml

create_sbml(model)

Create Species SBML in model.

InitialAssignment

InitialAssignment(
    symbol,
    value,
    unit=dimensionless,
    sid=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: Value

InitialAssignments.

The unit attribute is only for the case where a parameter must be created (which has the unit). In case of an initialAssignment of a value the units have to be defined in the math.

Construct InitialAssignment.

create_sbml

create_sbml(model)

Create InitialAssignment.

Creates a required parameter if the symbol for the initial assignment does not exist in the model.

RuleWithVariable

Rule.

check_model_for_rule

check_model_for_rule(model)

Check model for rule requirements.

Creates a required parameter if the symbol for the initial assignment does not exist in the model.

AssignmentRule

AssignmentRule(
    variable,
    value,
    unit=dimensionless,
    sid=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: ValueWithUnit, RuleWithVariable

AssignmentRule.

The unit attribute is only for the case where a parameter must be created (which has the unit). In case of an initialAssignment of a value the units have to be defined in the math.

Construct AssignmentRule.

create_sbml

create_sbml(model)

Create AssignmentRule.

RateRule

RateRule(
    variable,
    value,
    unit=dimensionless,
    sid=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: ValueWithUnit, RuleWithVariable

RateRule.

Construct RateRule.

create_sbml

create_sbml(model)

Create RateRule.

AlgebraicRule

AlgebraicRule(
    sid,
    value,
    unit=dimensionless,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: ValueWithUnit, RuleWithVariable

AlgebraicRule.

Construct AlgebraicRule.

create_sbml

create_sbml(model)

Create AlgebraicRule.

Reaction

Reaction(
    sid,
    equation,
    formula=None,
    pars=None,
    rules=None,
    compartment=None,
    fast=False,
    reversible=None,
    lowerFluxBound=None,
    upperFluxBound=None,
    geneProductAssociation=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: Sbase

Reaction.

Class for creating libsbml.Reaction.

Equations are of the form '1.0 S1 + 2 S2 => 2.0 P1 + 2 P2 [M1, M2]'

The equation consists of - substrates concatenated via '+' on the left side (with optional stoichiometric coefficients) - separation characters separating the left and right equation sides: '<=>' or '<->' for reversible reactions, '=>' or '->' for irreversible reactions (irreversible reactions are written from left to right) - products concatenated via '+' on the right side (with optional stoichiometric coefficients) - optional list of modifiers within brackets [] separated by ','

Examples of valid equations are

'1.0 S1 + 2 S2 => 2.0 P1 + 2 P2 [M1, M2]', 'c__gal1p => c__gal + c__phos', 'e__h2oM <-> c__h2oM', '3 atp + 2.0 phos + ki <-> 16.98 tet', 'c__gal1p => c__gal + c__phos [c__udp, c__utp]', 'A_ext => A []', '=> cit', 'acoa =>',

Construct Reaction.

create_sbml

create_sbml(model)

Create Reaction SBML in model.

set_kinetic_law staticmethod

set_kinetic_law(model, reaction, formula)

Set the kinetic law in reaction based on given formula.

Event

Event(
    sid,
    trigger,
    assignments=None,
    trigger_persistent=True,
    trigger_initialValue=False,
    useValuesFromTriggerTime=True,
    priority=None,
    delay=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: Sbase

Event.

Trigger have the format of a logical expression

time%200 == 0

Assignments have the format sid = value

Construct Event.

create_sbml

create_sbml(model)

Create Event SBML in model.

Constraint

Constraint(
    sid,
    math,
    message=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: Sbase

Constraint.

The Constraint object is a mechanism for stating the assumptions under which a model is designed to operate. The constraints are statements about permissible values of different quantities in a model.

The message must be well formated XHTML, e.g., message='ATP must be non-negative'

Constraint constructor.

create_sbml

create_sbml(model)

Create Constraint SBML in model.

UncertParameter

UncertParameter(type, value=None, var=None, unit=None)

UncertParameter.

FIXME: This is an SBase!

Construct UncertParameter.

UncertSpan

UncertSpan(
    type,
    valueLower=None,
    varLower=None,
    valueUpper=None,
    varUpper=None,
    unit=None,
)

UncertSpan.

FIXME: This is an SBase!

Construct UncertSpan.

Uncertainty

Uncertainty(
    sid=None,
    formula=None,
    uncertParameters=None,
    uncertSpans=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    replacedBy=None,
)

Bases: Sbase

Uncertainty.

Uncertainty information for Sbase.

Uncertainty constructor.

create_sbml

create_sbml(sbase, model)

Create libsbml Uncertainty.

:param sbase: :param model: :return:

ExchangeReaction

ExchangeReaction(
    species_id,
    compartment=None,
    fast=False,
    reversible=True,
    lowerFluxBound=None,
    upperFluxBound=None,
    geneProductAssociation=None,
    name=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: Reaction

Exchange reactions define substances which can be exchanged.

This is important for FBC models.

EXCHANGE_IMPORT (-INF, 0): is defined as negative flux through the exchange reaction, i.e. the upper bound must be 0, the lower bound some negative value, e.g. -INF

EXCHANGE_EXPORT (0, INF): is defined as positive flux through the exchange reaction, i.e. the lower bound must be 0, the upper bound some positive value, e.g. INF

Construct ExchangeReaction.

GeneProduct

GeneProduct(
    sid,
    label,
    associatedSpecies=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: Sbase

GeneProduct.

GeneProduct is a new FBC class derived from SBML SBase that inherits metaid and sboTerm, as well as the subcomponents for Annotation and Notes. The purpose of this class is to define a single gene product. It implements two required attributes id and label as well as two optional attributes name and associatedSpecies.

Create a GeneProduct.

create_sbml

create_sbml(model)

Create GeneProduct.

UserDefinedConstraintComponent

UserDefinedConstraintComponent(
    coefficient,
    variable,
    variableType=None,
    sid=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: Sbase

UserDefinedConstraintComponent.

Create a UserDefinedConstraintComponent.

create_sbml

create_sbml(constraint)

Create Objective.

UserDefinedConstraint

UserDefinedConstraint(
    lowerBound,
    upperBound,
    components=None,
    variableType=FBC_VARIABLE_TYPE_LINEAR,
    sid=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: Sbase

UserDefinedConstraint.

The FBC UserDefinedConstraint class is derived from SBML SBase and inherits metaid and sboTerm, as well as the subcomponents for Annotation and Notes. It’s purpose is to define non-stoichiometric constraints, that is constraints that are not necessarily defined by the stoichiometrically coupled reaction network. In order to achieve, we defined a new type of linear constraint, the UserDefinedConstraint

Create an UserDefinedConstraint.

create_sbml

create_sbml(model)

Create UserDefinedConstraint.

FluxObjective

FluxObjective(
    reaction,
    coefficient,
    variableType,
    sid=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: Sbase

FluxObjective.

Create a FluxObjective.

normalize_variable_type classmethod

normalize_variable_type(variable_type)

Normalize variable type.

create_sbml

create_sbml(objective)

Create Objective.

Objective

Objective(
    sid,
    objectiveType=OBJECTIVE_TYPE_MAXIMIZE,
    active=True,
    fluxObjectives=None,
    variableType=FBC_VARIABLE_TYPE_LINEAR,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    port=None,
    uncertainties=None,
    replacedBy=None,
)

Bases: Sbase

Objective.

Create an Objective.

FluxObjectives can either be provided as a list of FluxObjectives or as a dictionary with the reaction ids as keys and the coefficients as values.

normalize_objective_type classmethod

normalize_objective_type(objective_type)

Normalize objective type.

create_sbml

create_sbml(model)

Create Objective.

ModelDefinition

ModelDefinition(
    sid,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    units=None,
    compartments=None,
    species=None,
)

Bases: Sbase

ModelDefinition.

Create a ModelDefinition.

create_sbml

create_sbml(model)

Create ModelDefinition.

ExternalModelDefinition

ExternalModelDefinition(
    sid,
    source,
    modelRef,
    md5=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
)

Bases: Sbase

ExternalModelDefinition.

Create an ExternalModelDefinition.

create_sbml

create_sbml(model)

Create ExternalModelDefinition.

Submodel

Submodel(
    sid,
    modelRef=None,
    timeConversionFactor=None,
    extentConversionFactor=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
)

Bases: Sbase

Submodel.

Create a Submodel.

create_sbml

create_sbml(model)

Create SBML Submodel.

SbaseRef

SbaseRef(
    sid,
    portRef=None,
    idRef=None,
    unitRef=None,
    metaIdRef=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
)

Bases: Sbase

SBaseRef.

Create an SBaseRef.

ReplacedElement

ReplacedElement(
    sid,
    elementRef,
    submodelRef,
    deletion=None,
    conversionFactor=None,
    portRef=None,
    idRef=None,
    unitRef=None,
    metaIdRef=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
)

Bases: SbaseRef

ReplacedElement.

Create a ReplacedElement.

create_sbml

create_sbml(model)

Create SBML ReplacedElement.

ReplacedBy

ReplacedBy(
    sid,
    elementRef,
    submodelRef,
    portRef=None,
    idRef=None,
    unitRef=None,
    metaIdRef=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
)

Bases: SbaseRef

ReplacedBy.

Create a ReplacedElement.

create_sbml

create_sbml(sbase, model)

Create SBML ReplacedBy.

Deletion

Deletion(
    sid,
    submodelRef,
    portRef=None,
    idRef=None,
    unitRef=None,
    metaIdRef=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
)

Bases: SbaseRef

Deletion.

Initialize Deletion.

create_sbml

create_sbml(model)

Create SBML Deletion.

PortType

Bases: StrEnum

Supported port types.

Port

Port(
    sid,
    portRef=None,
    idRef=None,
    unitRef=None,
    metaIdRef=None,
    portType=PORT,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
)

Bases: SbaseRef

Port.

Ports are stored in an optional child ListOfPorts object, which, if present, must contain one or more Port objects. All of the Ports present in the ListOfPorts collectively define the 'port interface' of the Model.

Create a Port.

create_sbml

create_sbml(model)

Create SBML for Port.

Package

Bases: StrEnum

Supported/tested packages.

ModelDict

Bases: TypedDict

ModelDict.

The ModelDict allows to define the Model as dictionary and then use:

md: ModelDict Model(**md)

For model construction. If possible use the Model object directly.

Model

Model(
    sid,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    packages=None,
    creators=None,
    model_units=None,
    units=None,
    objects=None,
    external_model_definitions=None,
    model_definitions=None,
    submodels=None,
    functions=None,
    compartments=None,
    species=None,
    parameters=None,
    assignments=None,
    rules=None,
    rate_rules=None,
    algebraic_rules=None,
    reactions=None,
    events=None,
    constraints=None,
    ports=None,
    replaced_elements=None,
    deletions=None,
    user_defined_constraints=None,
    objectives=None,
    gene_products=None,
    layouts=None,
)

Bases: Sbase, FrozenClass, BaseModel

Model.

Model constructor.

create_sbml

create_sbml(doc)

Create Model.

To create the complete SBMLDocument with the model use:

doc = Document(model=model).create_sbml()

get_sbml

get_sbml()

Create SBML model.

check_packages

check_packages(packages)

Check that all provided packages are supported.

merge_models staticmethod

merge_models(models)

Merge information from multiple models.

Document

Document(
    model,
    sid=None,
    name=None,
    sboTerm=None,
    metaId=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
    sbml_level=SBML_LEVEL,
    sbml_version=SBML_VERSION,
)

Bases: Sbase

Document.

Document constructor.

create_sbml

create_sbml()

Create SBML model.

get_sbml

get_sbml()

Return SBML string of the model.

:return: SBML string

get_json

get_json()

Get JSON representation.

FactoryResult dataclass

FactoryResult(
    model, sbml_path, antimony_path=None, markdown_path=None
)

Data structure for model creation.

create_objects

create_objects(model, obj_iter, key=None)

Create the objects in the model.

This function calls the respective create_sbml function of all objects in the order of the objects.

:param model: SBMLModel instance :param obj_iter: iterator of given model object classes like Parameter, ... :param key: object key :return: dictionary of SBML objects

ast_node_from_formula

ast_node_from_formula(model, formula)

Parse the ASTNode from given formula string with model.

:param model: SBMLModel instance :param formula: formula str :return: astnode

set_notes

set_notes(sbase, notes, format=MARKDOWN)

Set notes information on SBase.

:param sbase: SBase :param notes: notes information (xml string) :return:

set_model_history

set_model_history(sbase, creators, set_timestamps=True)

Set the model history from given creators.

:param sbase: SBML model :param creators: list of creators :param set_timestamps: boolean flag to set timestamps on history. :return:

date_now

date_now()

Get current time stamp for history.

:return: current libsbml Date

create_model

create_model(
    model,
    filepath,
    sbml_level=SBML_LEVEL,
    sbml_version=SBML_VERSION,
    validate=True,
    validation_options=None,
    show_sbml=False,
    annotations=None,
    create_antimony=False,
    create_markdown=False,
)

Create SBML model from models.

This is the entry point for creating models. If multiple models are provided these are merged in the process of model creation. See merge_models for more details.

Additional model annotations can be provided via a file.

The created SBML can be serialized to additional formats for inspection, which are written next to the SBML file: the antimony serialization of the model (create_antimony, *.ant) and the markdown overview of the ODE system (create_markdown, *.md, see sbmlutils.converters.odefac).

:param model: Model or iterable of Model instances which are merged in single model :param filepath: Path to write the SBML model to :param sbml_level: set SBML level for model generation :param sbml_version: set SBML version for model generation :param validate: boolean flag to validate the SBML file :param validation_options: options for model validation :param show_sbml: boolean flag to show SBML :param annotations: Path to annotations file :param create_antimony: write the antimony serialization to *.ant :param create_markdown: write the markdown overview of the ODE system to *.md

:return: FactoryResult