sbmlutils.comp.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.
Module Contents¶
Functions¶
|
Create comp ExternalModelDefinition. |
|
Add submodel to the model from given ExternalModelDefinition. |
Read the SBO terms of the submodels. |
|
|
Create ports for given model. |
|
Create port in given model. |
|
Replace elements in comp. |
|
Replace elements submodels with the identical id. |
|
Create a replaced element. |
|
Create a ReplacedBy element. |
|
Get the comp plugin by sid. |
|
Set reference for given reference type in the object. |
Attributes¶
- sbmlutils.comp.comp.create_ExternalModelDefinition(doc_comp, emd_id, source)[source]¶
Create comp ExternalModelDefinition.
- Parameters:
doc_comp (libsbml.CompSBMLDocumentPlugin) – SBMLDocument comp plugin
emd_id (str) – id of external model definition
source (str) – source
- Returns:
- Return type:
libsbml.ExternalModelDefinition
- sbmlutils.comp.comp.add_submodel_from_emd(model_comp, submodel_id, emd)[source]¶
Add submodel to the model from given ExternalModelDefinition.
- Parameters:
model_comp (libsbml.CompModelPlugin) – Model comp plugin
submodel_id (str) –
emd (libsbml.ExternalModelDefinition) –
- Returns:
- Return type:
libsbml.Submodel
- sbmlutils.comp.comp.get_submodel_frameworks(doc)[source]¶
Read the SBO terms of the submodels.
These are used to distinguish the different frameworks of the submodels. :param doc: SBMLDocument :return:
- Parameters:
doc (libsbml.SBMLDocument) –
- Return type:
Dict[str, Any]
- sbmlutils.comp.comp.create_ports(model, portRefs=None, idRefs=None, unitRefs=None, metaIdRefs=None, portType=factory.PortType.PORT, suffix=factory.PORT_SUFFIX)[source]¶
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
- Returns:
- Parameters:
model (libsbml.Model) –
portRefs (Optional[Any]) –
idRefs (Optional[Any]) –
unitRefs (Optional[Any]) –
metaIdRefs (Optional[Any]) –
portType (sbmlutils.factory.PortType) –
suffix (str) –
- Return type:
List[sbmlutils.factory.Port]
- sbmlutils.comp.comp._create_port(model, pid, name=None, portRef=None, idRef=None, unitRef=None, metaIdRef=None, portType=factory.PortType.PORT)[source]¶
Create port in given model.
- Parameters:
model (libsbml.Model) –
pid (str) –
name (Optional[str]) –
portRef (Optional[str]) –
idRef (Optional[str]) –
unitRef (Optional[str]) –
metaIdRef (Optional[str]) –
portType (sbmlutils.factory.PortType) –
- Return type:
libsbml.Port
- sbmlutils.comp.comp.replace_elements(model, sid, ref_type, replaced_elements)[source]¶
Replace elements in comp.
- Parameters:
model (libsbml.Model) –
sid (str) –
ref_type (str) –
replaced_elements (Dict[str, List[str]]) –
- Returns:
- Return type:
None
- sbmlutils.comp.comp.replace_element_in_submodels(model, sid, ref_type, submodels)[source]¶
Replace elements submodels with the identical id.
For instance to replace all the units in the submodels.
- Parameters:
model (libsbml.Model) –
sid (str) –
ref_type (str) –
submodels (List[str]) –
- Returns:
- Return type:
libsbml.ReplacedElement
- sbmlutils.comp.comp._create_replaced_element(model, sid, submodel, replaced_id, ref_type)[source]¶
Create a replaced element.
- Parameters:
model (libsbml.Model) –
sid (str) –
submodel (str) –
replaced_id (str) –
ref_type (str) –
- Return type:
libsbml.ReplacedElement
- sbmlutils.comp.comp.replaced_by(model, sid, ref_type, submodel, replaced_by)[source]¶
Create a ReplacedBy element.
The element with sid in the model is replaced by the replacing_id in the submodel with submodel_id.
- Parameters:
model (libsbml.Model) –
sid (str) –
ref_type (str) –
submodel (str) –
replaced_by (str) –
- Return type:
libsbml.ReplacedBy