Skip to content

SBML

SBML-related import helpers from annnet.io.SBML_io and annnet.io.sbml_cobra_io.

Core SBML

annnet.io.SBML_io

Classes

Functions

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_hyperedge_coeffs (reactants negative, products positive, modifiers -1). Default True.

True

COBRA SBML

annnet.io.sbml_cobra_io

SBML (Systems Biology Markup Language) → AnnNet adapter

Targets the provided AnnNet API.

Two entry points: - from_sbml(path, graph=None, slice="default", preserve_stoichiometry=True) - from_cobra_model(model, graph=None, slice="default", preserve_stoichiometry=True)

If AnnNet.set_hyperedge_coeffs(edge_id, coeffs: dict[str, float]) is not available, stoichiometric coefficients are stored under an edge attribute stoich (lossy but usable).

Classes

Functions

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(path, graph=None, *, slice='default', preserve_stoichiometry=True, quiet=True)

Read SBML using COBRApy if available; falls back to python-libsbml (if you extend this file).