# psamm.balancecheck – check balance of charge and formula¶

psamm.balancecheck.charge_balance(model)

Calculate the overall charge for all reactions in the model.

Yield (reaction, charge) pairs.

Parameters: model – psamm.datasource.native.NativeModel.
psamm.balancecheck.formula_balance(model)

Calculate formula compositions for each reaction.

Call reaction_formula() for each reaction. Yield (reaction, result) pairs, where result has two formula compositions or None.

Parameters: model – psamm.datasource.native.NativeModel.
psamm.balancecheck.reaction_charge(reaction, compound_charge)

Calculate the overall charge for the specified reaction.

Parameters: reaction – psamm.reaction.Reaction. compound_charge – a map from each compound to charge values.
psamm.balancecheck.reaction_formula(reaction, compound_formula)

Calculate formula compositions for both sides of the specified reaction.

If the compounds in the reaction all have formula, then calculate and return the chemical compositions for both sides, otherwise return None.

Parameters: reaction – psamm.reaction.Reaction. compound_formula – a map from compound id to formula.