Skip to content

comp

Utilities for the creation and work with comp models.

Simplifies the port linking, submodel generation, ...

Heavily used in the dynamic FBA simulator. Mainly in the model creation process. But the flattening parts also during the simulation of the dynamic FBA models.

create_ExternalModelDefinition

create_ExternalModelDefinition(doc_comp, emd_id, source)

Create comp ExternalModelDefinition.

:param doc_comp: SBMLDocument comp plugin :param emd_id: id of external model definition :param source: source :return:

add_submodel_from_emd

add_submodel_from_emd(model_comp, submodel_id, emd)

Add submodel to the model from given ExternalModelDefinition.

:param model_comp: Model comp plugin :param submodel_id: :param emd: :return:

get_submodel_frameworks

get_submodel_frameworks(doc)

Read the SBO terms of the submodels.

These are used to distinguish the different frameworks of the submodels. :param doc: SBMLDocument :return:

create_ports

create_ports(
    model,
    portRefs=None,
    idRefs=None,
    unitRefs=None,
    metaIdRefs=None,
    portType=PORT,
    suffix=PORT_SUFFIX,
)

Create ports for given model.

Helper function to create port creation. :param model: SBML model :param portRefs: dict of the form {pid:portRef} :param idRefs: dict of the form {pid:idRef} :param unitRefs: dict of the form {pid:unitRef} :param metaIdRefs: dict of the form {pid:metaIdRef} :param portType: type of port :param suffix: suffix to use in port generation

:return:

replace_elements

replace_elements(model, sid, ref_type, replaced_elements)

Replace elements in comp.

:param model: :param sid: :param ref_type: :param replaced_elements: :return:

replace_element_in_submodels

replace_element_in_submodels(
    model, sid, ref_type, submodels
)

Replace elements submodels with the identical id.

For instance to replace all the units in the submodels.

:param model: :param sid: :param ref_type: :param submodels: :return:

replaced_by

replaced_by(model, sid, ref_type, submodel, replaced_by)

Create a ReplacedBy element.

The element with sid in the model is replaced by the replacing_id in the submodel with submodel_id.