Core
momapy.sbml.core
Core classes for SBML (Systems Biology Markup Language) maps.
This module provides dataclasses representing SBML model elements including compartments, species, reactions, and annotations using BioModels qualifiers.
Examples:
from momapy.sbml.core import Compartment, Species, Model
compartment = Compartment(name="cytosol")
species = Species(name="glucose", compartment=compartment)
model = Model(name="glycolysis", compartments={compartment}, species={species})
Classes:
| Name | Description |
|---|---|
BQBiol |
BioModels.net biology qualifiers. |
BQModel |
BioModels.net model qualifiers. |
BiomodelQualifier |
Abstract base class for BioModels.net qualifiers. |
Compartment |
SBML compartment representing a bounded region. |
ModifierSpeciesReference |
Reference to a species that modifies a reaction. |
RDFAnnotation |
RDF annotation linking model elements to external resources. |
Reaction |
SBML reaction representing a biochemical transformation. |
SBML |
Root container for SBML documents. |
SBMLModel |
SBML model container. |
SBOTerm |
SBO (Systems Biology Ontology) term annotation. |
SBase |
Abstract base class for all SBML elements. |
SimpleSpeciesReference |
Base class for species references in reactions. |
Species |
SBML species representing a pool of entities. |
SpeciesReference |
Reference to a reactant or product species. |
BQBiol
Bases: BiomodelQualifier
BioModels.net biology qualifiers.
These qualifiers describe the relationship between biological elements and external resources.
Attributes:
| Name | Type | Description |
|---|---|---|
ENCODES |
The element encodes the resource. |
|
HAS_PART |
The element has the resource as a part. |
|
HAS_PROPERTY |
The element has the resource as a property. |
|
HAS_VERSION |
The element has the resource as a version. |
|
IS |
The element is exactly the resource. |
|
IS_DESCRIBED_BY |
The resource describes the element. |
|
IS_ENCODED_BY |
The element is encoded by the resource. |
|
IS_HOMOLOG_TO |
The element is homologous to the resource. |
|
IS_PART_OF |
The element is part of the resource. |
|
IS_PROPERTY_OF |
The element is a property of the resource. |
|
IS_VERSION_OF |
The element is a version of the resource. |
|
OCCURS_IN |
The process occurs in the resource. |
|
HAS_TAXON |
The element has the resource as a taxon. |
BQModel
Bases: BiomodelQualifier
BioModels.net model qualifiers.
These qualifiers describe the relationship between the model and external resources such as publications or databases.
Attributes:
| Name | Type | Description |
|---|---|---|
HAS_INSTANCE |
The resource is an instance of this model. |
|
IS |
The resource is exactly this model. |
|
IS_DERIVED_FROM |
The model is derived from the resource. |
|
IS_DESCRIBED_BY |
The resource describes the model. |
|
IS_INSTANCE_OF |
The model is an instance of the resource. |
BiomodelQualifier
Bases: Enum
Abstract base class for BioModels.net qualifiers.
BioModels qualifiers are used in RDF annotations to describe the relationship between model elements and external resources.
Compartment
dataclass
Compartment(*, id_: str = make_uuid4_as_str(), name: str | None = None, sbo_term: SBOTerm | None = None, metaid: str | None = None, outside: Optional[ForwardRef(Compartment, module=core)] = None)
Bases: SBase
SBML compartment representing a bounded region.
A compartment defines a container where species are located.
Attributes:
| Name | Type | Description |
|---|---|---|
outside |
Optional[ForwardRef(Compartment, module=core)]
|
Optional outer compartment for hierarchical nesting. |
Examples:
ModifierSpeciesReference
dataclass
ModifierSpeciesReference(*, id_: str = make_uuid4_as_str(), name: str | None = None, sbo_term: SBOTerm | None = None, metaid: str | None = None, referred_species: Species)
Bases: SimpleSpeciesReference
Reference to a species that modifies a reaction.
Modifier species influence reaction kinetics without being consumed or produced (e.g., catalysts, inhibitors).
RDFAnnotation
dataclass
RDFAnnotation(*, id_: str = make_uuid4_as_str(), qualifier: BiomodelQualifier, resources: frozenset[str] = frozenset())
Bases: ModelElement
RDF annotation linking model elements to external resources.
Attributes:
| Name | Type | Description |
|---|---|---|
qualifier |
BiomodelQualifier
|
The BioModels qualifier describing the relationship. |
resources |
frozenset[str]
|
Set of resource URIs linked to this annotation. |
Examples:
from momapy.sbml.core import RDFAnnotation, BQBiol
annotation = RDFAnnotation(
qualifier=BQBiol.IS,
resources={"https://identifiers.org/chebi:4167"}
)
Reaction
dataclass
Reaction(*, id_: str = make_uuid4_as_str(), name: str | None = None, sbo_term: SBOTerm | None = None, metaid: str | None = None, reversible: bool, compartment: Compartment | None = None, reactants: frozenset[SpeciesReference] = frozenset(), products: frozenset[SpeciesReference] = frozenset(), modifiers: frozenset[ModifierSpeciesReference] = frozenset())
Bases: SBase
SBML reaction representing a biochemical transformation.
Reactions describe the conversion of reactants into products, potentially influenced by modifiers.
Attributes:
| Name | Type | Description |
|---|---|---|
reversible |
bool
|
Whether the reaction can proceed in both directions. |
compartment |
Compartment | None
|
Optional compartment where the reaction occurs. |
reactants |
frozenset[SpeciesReference]
|
Set of species consumed by the reaction. |
products |
frozenset[SpeciesReference]
|
Set of species produced by the reaction. |
modifiers |
frozenset[ModifierSpeciesReference]
|
Set of species that modify the reaction. |
Examples:
reaction = Reaction(
name="hexokinase",
reversible=False,
reactants={glucose_ref, atp_ref},
products={g6p_ref, adp_ref}
)
SBML
dataclass
SBML(*, id_: str = make_uuid4_as_str(), name: str | None = None, sbo_term: SBOTerm | None = None, metaid: str | None = None, xmlns: str = 'http://www.sbml.org/sbml/level3/version2/core', level: int = 3, version: int = 2, model: SBMLModel | None = None)
Bases: SBase
Root container for SBML documents.
Represents the top-level SBML element containing model metadata and the model definition.
Attributes:
| Name | Type | Description |
|---|---|---|
xmlns |
str
|
XML namespace for the SBML version. |
level |
int
|
SBML level (version). |
version |
int
|
SBML version within the level. |
model |
SBMLModel | None
|
The model contained in this SBML document. |
Examples:
SBMLModel
dataclass
SBMLModel(*, id_: str = make_uuid4_as_str(), name: str | None = None, sbo_term: SBOTerm | None = None, metaid: str | None = None, compartments: frozenset[Compartment] = frozenset(), species: frozenset[Species] = frozenset(), reactions: frozenset[Reaction] = frozenset())
Bases: SBase, Model
SBML model container.
Models aggregate compartments, species, and reactions into a complete biological system description.
Attributes:
| Name | Type | Description |
|---|---|---|
compartments |
frozenset[Compartment]
|
Set of compartments in the model. |
species |
frozenset[Species]
|
Set of species in the model. |
reactions |
frozenset[Reaction]
|
Set of reactions in the model. |
Examples:
model = SBMLModel(
name="glycolysis",
compartments={cytosol},
species={glucose, atp, g6p},
reactions={hexokinase}
)
SBOTerm
dataclass
Bases: ModelElement
SBO (Systems Biology Ontology) term annotation.
SBO terms provide standardized vocabulary for describing model elements.
SBase
dataclass
SBase(*, id_: str = make_uuid4_as_str(), name: str | None = None, sbo_term: SBOTerm | None = None, metaid: str | None = None)
Bases: ModelElement
Abstract base class for all SBML elements.
SBase provides common attributes shared by all SBML components.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str | None
|
Human-readable name of the element. |
sbo_term |
SBOTerm | None
|
Optional SBO term for semantic annotation. |
metaid |
str | None
|
Optional metadata identifier for RDF annotations. |
SimpleSpeciesReference
dataclass
Species
dataclass
Species(*, id_: str = make_uuid4_as_str(), name: str | None = None, sbo_term: SBOTerm | None = None, metaid: str | None = None, compartment: Compartment | None = None)
Bases: SBase
SBML species representing a pool of entities.
A species represents a population of chemically identical entities (molecules, ions, etc.) located in a specific compartment.
Attributes:
| Name | Type | Description |
|---|---|---|
compartment |
Compartment | None
|
The compartment containing this species. |
Examples:
compartment = Compartment(name="cytosol")
glucose = Species(name="glucose", compartment=compartment)
SpeciesReference
dataclass
SpeciesReference(*, id_: str = make_uuid4_as_str(), name: str | None = None, sbo_term: SBOTerm | None = None, metaid: str | None = None, referred_species: Species, stoichiometry: float | None = None)
Bases: SimpleSpeciesReference
Reference to a reactant or product species.
Attributes:
| Name | Type | Description |
|---|---|---|
stoichiometry |
float | None
|
Optional stoichiometric coefficient. |
Examples:
species = Species(name="ATP", compartment=compartment)
ref = SpeciesReference(referred_species=species, stoichiometry=2)