Utils¶
Parsers¶
Contains a parser for reaction strings and another of lists as strings.
-
class
app.utils.parsers.ReactionParser¶ ReactionParser class, whose goal is to parse a reaction string in the format: A_c + B_c <-> P_c
-
parse_coefficients(expression, sense)¶ Parses the stoichiometric coefficients from expression. Expression has the form 2.0 metabolite_id.
- Parameters
expression – metabolite with respective stoichiometric coefficient, “2.0 metabolite_id”
sense – whether the metabolite is consumed (-1) or produced (1)
- Returns
The stoichiometric coefficients
-
parse_reaction(reaction_str)¶ Given a reaction string in the form A_c + B_c <-> P_c, parses it to retrieve its reversibility (True or False) and stoichiometry in the form of a dictionary {metabolite_id : stoichoimetric_coefficient}.
- Parameters
reaction_str – a reaction string in the form A_c + B_c <-> P_c
- Returns
reaction reverisibility (True or False), and stoichiometry dictionary
-
Populate DB¶
Contains a bunch of functions to load data into the database. It is mostly used by the unit tests.