psamm.datasource.reaction
– Parser for reactions¶
Reaction parser.
-
exception
psamm.datasource.reaction.
ParseError
(*args, **kwargs)¶ Error raised when parsing reaction fails.
-
class
psamm.datasource.reaction.
ReactionParser
(arrows=None, parse_global=False)¶ Parser of reactions equations.
This parser recognizes:
- Global compartment specification as a prefix (when
parse_global
isTrue
) - Configurable reaction arrow tokens (
arrows
) - Compounds quoted by pipe (
|
) (required only if the compound name includes a space) - Compound counts that are affine expressions.
-
parse
(s)¶ Parse reaction string.
- Global compartment specification as a prefix (when
-
psamm.datasource.reaction.
parse_compound
(s, global_compartment=None)¶ Parse a compound specification.
If no compartment is specified in the string, the global compartment will be used.
-
psamm.datasource.reaction.
parse_compound_count
(s)¶ Parse a compound count (number of compounds).
-
psamm.datasource.reaction.
parse_reaction
(s)¶ Parse reaction string using the default parser.