sbmlutils.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 =>’,
Module Contents¶
Classes¶
EquationPart. |
|
Representation of stoichiometric equations with modifiers. |
Attributes¶
- class sbmlutils.reaction_equation.EquationPart[source]¶
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.
stoichiometry=None, constant=False, sid=str
- class sbmlutils.reaction_equation.ReactionEquation(reactants=None, products=None, modifiers=None, reversible=True)[source]¶
Representation of stoichiometric equations with modifiers.
- Parameters:
reactants (Optional[List[EquationPart]]) –
products (Optional[List[EquationPart]]) –
modifiers (Optional[List[str]]) –
reversible (bool) –
- static from_str(equation_str)[source]¶
Parse components of equation string.
- Parameters:
equation_str (str) –
- Return type:
- _parse_half_equation(string)[source]¶
Parse half-equation.
Only ‘+ supported in equation !, do not use negative stoichiometries.
- Parameters:
string (str) –
- Return type:
List[EquationPart]
- static _parse_reactant(item)[source]¶
Parse stoichiometry, species, sid information.
- Parameters:
item (str) –
- Return type:
- static _to_string_side(items)[source]¶
- Parameters:
items (Iterable[EquationPart]) –
- Return type:
str