psamm.mapmaker
– Mapmaker Functions¶
Functions for predicting compound pairs using the MapMaker algorithm.
The MapMaker algorithm is described in [Tervo16].
-
psamm.mapmaker.
default_weight
(element)¶ Return weight of formula element.
This implements the default weight proposed for MapMaker.
-
exception
psamm.mapmaker.
UnbalancedReactionError
¶ Raised when an unbalanced reaction is provided.
-
psamm.mapmaker.
predict_compound_pairs
(reaction, compound_formula, solver, epsilon=1e-05, alt_elements=None, weight_func=<function default_weight>)¶ Predict compound pairs of reaction using MapMaker.
Yields all solutions as dictionaries with compound pairs as keys and formula objects as values.
Parameters: - reaction –
psamm.reaction.Reaction
object. - compound_formula – Dictionary mapping compound IDs to formulas. Formulas must be flattened.
- solver – LP solver (MILP).
- epsilon – Threshold for rounding floating-point values to integers in the predicted transfers.
- alt_elements – Iterable of elements to consider for alternative solutions. Only alternate solutions that have different transfers of these elements will be returned (default=all elements).
- weight_func – Optional function that returns a weight for a formula element (should handle specific Atom and Radical objects). By default, the standard MapMaker weights will be used (H=0, R=40, N=0.4, O=0.4, P=0.4, *=1).
- reaction –