Skip to content

reaction_equation

Module for parsing reaction equation strings.

Various string formats are allowed which are subsequently brought into an internal standard format.

Equations are of the form '1.0 S1 + 2 S2 => 2.0 P1 + 2 P2 [M1, M2]'

The equation consists of - substrates concatenated via '+' on the left side (with optional stoichiometric coefficients) - separation characters separating the left and right equation sides: '<=>' or '<->' for reversible reactions, '=>' or '->' for irreversible reactions (irreversible reactions are written from left to right) - products concatenated via '+' on the right side (with optional stoichiometric coefficients) - optional list of modifiers within brackets [] separated by ','

Examples of valid equations are

'1.0 S1 + 2 S2 => 2.0 P1 + 2 P2 [M1, M2]', 'c__gal1p => c__gal + c__phos', 'e__h2oM <-> c__h2oM', '3 atp + 2.0 phos + ki <-> 16.98 tet', 'c__gal1p => c__gal + c__phos [c__udp, c__utp]', 'A_ext => A []', '=> cit', 'acoa =>',

In addition, variable stoichiometries can be used, by providing sids as stoichiometries. Examples of valid equations with variable stoichiometries are: 'fS1 S1 + 2 S2 => 2.0 P1 + 2 P2 [M1, M2]', 'f1 c__gal1p => f1 c__gal + f1 c__phos', 'f1 * e__h2oM <-> f1 * c__h2oM', '3 atp + 2.0 phos + ki <-> stet tet', 'f * c__gal1p => f * c__gal + f * c__phos [c__udp, c__utp]', 'A_ext => f * A []', '=> f * cit', 'f * acoa =>',

EquationPart dataclass

EquationPart(
    species,
    stoichiometry=None,
    sid=None,
    constant=True,
    metaId=None,
    sboTerm=None,
    name=None,
    annotations=None,
    notes=None,
    keyValuePairs=None,
)

EquationPart.

FIXME: this must be a SpeciesReference, but circular imports!

An equation consists of parts which define species with their respective stoichiometries. The stoichiometries could be constant or vary over time.

The sid may be target of an InitialAssignment, EventAssignment or Rule.

Two main cases exists: 1. stoichiometry=float, constant=True The EquationPart has a constant stoichiometry and does not change in the simulation. It could be set via an InitialAssignment if an sid is provided. 2. stoichiometry=None, constant=False, sid=str

ReactionEquation

ReactionEquation(
    reactants=None,
    products=None,
    modifiers=None,
    reversible=True,
)

Representation of stoichiometric equations with modifiers.

Initialize equation.

EquationException

Bases: Exception

Exception in Equation.

from_str staticmethod

from_str(equation_str)

Parse components of equation string.

to_string

to_string(modifiers=False)

Get string representation of equation.

info

info()

Print overview of parsed equation.

help staticmethod

help()

Get help information string.