psamm.fastcore – Fastcore (approximate consistent subset)¶
Fastcore module implementing the fastcore algorithm
This is an implementation of the algorithms described in [Vlassis14].
Use the functions fastcore() and fastcc() to easily apply
these algorithms to a MetabolicModel.
-
exception
psamm.fastcore.FastcoreError¶ Indicates an error while running Fastcore
-
class
psamm.fastcore.FastcoreProblem(*args, **kwargs)¶ Represents a FastCore extension of a flux balance problem.
Accepts the same arguments as
FluxBalanceProblem, and an additionalepsilonkeyword argument.Parameters: - model –
MetabolicModelto solve. - solver – LP solver instance to use.
- epsilon – Flux threshold value.
-
lp7(reaction_subset)¶ Approximately maximize the number of reaction with flux.
This is similar to FBA but approximately maximizing the number of reactions in subset with flux > epsilon, instead of just maximizing the flux of one particular reaction. LP7 prefers “flux splitting” over “flux concentrating”.
-
lp10(subset_k, subset_p, weights={})¶ Force reactions in K above epsilon while minimizing support of P.
This program forces reactions in subset K to attain flux > epsilon while minimizing the sum of absolute flux values for reactions in subset P (L1-regularization).
-
find_sparse_mode(core, additional, scaling, weights={})¶ Find a sparse mode containing reactions of the core subset.
Return an iterator of the support of a sparse mode that contains as many reactions from core as possible, and as few reactions from additional as possible (approximately). A dictionary of weights can be supplied which gives further penalties for including specific additional reactions.
-
flip(reactions)¶ Flip the specified reactions.
-
is_flipped(reaction)¶ Return true if reaction is flipped.
- model –
-
psamm.fastcore.fastcc(model, epsilon, solver)¶ Check consistency of model reactions.
Yield all reactions in the model that are not part of the consistent subset.
Parameters: - model –
MetabolicModelto solve. - epsilon – Flux threshold value.
- solver – LP solver instance to use.
- model –
-
psamm.fastcore.fastcc_is_consistent(model, epsilon, solver)¶ Quickly check whether model is consistent
Return true if the model is consistent. If it is only necessary to know whether a model is consistent, this function is fast as it will return the result as soon as it finds a single inconsistent reaction.
Parameters: - model –
MetabolicModelto solve. - epsilon – Flux threshold value.
- solver – LP solver instance to use.
- model –
-
psamm.fastcore.fastcc_consistent_subset(model, epsilon, solver)¶ Return consistent subset of model.
The largest consistent subset is returned as a set of reaction names.
Parameters: - model –
MetabolicModelto solve. - epsilon – Flux threshold value.
- solver – LP solver instance to use.
Returns: Set of reaction IDs in the consistent reaction subset.
- model –
-
psamm.fastcore.fastcore(model, core, epsilon, solver, scaling=100000.0, weights={})¶ Find a flux consistent subnetwork containing the core subset.
The result will contain the core subset and as few of the additional reactions as possible.
Parameters: - model –
MetabolicModelto solve. - core – Set of core reaction IDs.
- epsilon – Flux threshold value.
- solver – LP solver instance to use.
- scaling – Scaling value to apply (see [Vlassis14] for more information on this parameter).
- weights – Dictionary with reaction IDs as keys and values as weights. Weights specify the cost of adding a reaction to the consistent subnetwork. Default value is 1.
Returns: Set of reaction IDs in the consistent reaction subset.
- model –