Skip to content

SBML

SBML-related import helpers from annnet.io.sbml and annnet.io.sbml_cobra.

Core SBML

annnet.io.sbml

SBML ingestion helper for AnnNet.

Provides: from_sbml(path, graph=None, slice="default", preserve_stoichiometry=True) -> AnnNet

This module reads SBML through python-libsbml when available and converts stoichiometric reactions into directed AnnNet hyperedges. Reactants and products are represented as edge endpoint sets, with optional stoichiometric coefficients stored on the edge.

Boundary reactions are represented using dedicated placeholder vertices.

Classes

Functions

from_sbml
from_sbml(
    path,
    graph=None,
    *,
    slice="default",
    preserve_stoichiometry=True
)

Read an SBML file into an AnnNet hypergraph.

Parameters:

Name Type Description Default
path str

Path to the .xml / .sbml file.

required
graph AnnNet | None

Optional existing AnnNet to merge into.

None
slice str

AnnNet slice name for default placement. Compartment-specific species will additionally appear in their compartment slice.

'default'
preserve_stoichiometry bool

Write signed stoichiometric coefficients into the incidence matrix via set_edge_coeffs (reactants negative, products positive, modifiers -1). Default True.

True

COBRA SBML

annnet.io.sbml_cobra

SBML and COBRA model ingestion helpers for AnnNet.

Provides: from_sbml(path, graph=None, slice="default", preserve_stoichiometry=True) -> AnnNet from_cobra_model(model, graph=None, slice="default", preserve_stoichiometry=True) -> AnnNet

This module converts stoichiometric models into directed AnnNet hyperedges. Reactants and products are represented as edge endpoint sets, with optional stoichiometric coefficients stored on the edge.

Boundary reactions are represented using dedicated placeholder vertices.

Classes

Functions

from_cobra_model
from_cobra_model(
    model,
    graph=None,
    *,
    slice="default",
    preserve_stoichiometry=True
)

Convert a COBRApy model to AnnNet. Requires cobra.util.array.create_stoichiometric_matrix.

Edge attributes added: name, default_lb, default_ub, gpr (Gene-Protein-Reaction rule [GPR]).

from_sbml
from_sbml(
    path,
    graph=None,
    *,
    slice="default",
    preserve_stoichiometry=True
)

Read SBML using COBRApy if available.