Fastcore¶
- LP10(K, P, v, LPproblem, epsilon, adaptiveScalingFlag, nonPen)[source]¶
Finds a flux vector that maintains the activity of any active irreversible core reaction (K) yet minimises the activity of any non-core reaction (P). Implementation of LP-10 for input sets K, P (see FASTCORE paper)
- USAGE:
V = LP10 (K, P, v, LPproblem, epsilon, adaptiveScalingFlag, nonPen)
- INPUTS:
K – indices of active irreversible core reactions to keep active
P – indices of non-core reactions whose activity is minimised
v – flux vector from the preceding LP7 solve, used to set core bounds
LPproblem – LP problem structure derived from the model with fields:
.A - constraint (stoichiometric) matrix
.b - right hand side vector for A*v = b
.lb - lower bounds on the variables
.ub - upper bounds on the variables
.csense - constraint sense character array ({L, E, G})
epsilon – smallest flux value that is considered nonzero
adaptiveScalingFlag – 0 = fixed scaling factor of 1e4, 1 = adaptive scaling
nonPen – indices of reactions that are not penalized in the objective
- OUTPUT:
V – flux vector minimising the activity of the non-core reactions
- LP10cvx(K, P, model, epsilon)[source]¶
CPLEX implementation of LP-9 for input sets K, P (see FASTCORE paper)
- USAGE:
V = LP10cvx (K, P, model, epsilon)
- INPUTS:
K – indices of active core reactions to keep active
P – indices of non-core reactions whose activity is minimised
model – COBRA model structure with fields:
.S - m x n stoichiometric matrix
.lb - n x 1 lower flux bounds
.ub - n x 1 upper flux bounds
epsilon – smallest flux value that is considered nonzero
- OUTPUT:
V – flux vector minimising the activity of the non-core reactions
- LP10weighted(W, K, P, model, LPproblem, epsilon)[source]¶
Weighted implementation of LP-9 for input sets K, P (see FASTCORE paper). Finds a flux vector that keeps the core reactions (K) active while minimising a weighted sum over the non-core reactions (P).
- USAGE:
V = LP9weighted (W, K, P, model, LPproblem, epsilon)
- INPUTS:
W – n x 1 nonnegative weight for each reaction (penalises high weights)
K – indices of active core reactions to keep active
P – indices of non-core reactions whose weighted activity is minimised
model – COBRA model structure with field:
.S - m x n stoichiometric matrix
LPproblem – LP problem structure derived from the model with fields:
.A - constraint (stoichiometric) matrix
.b - right hand side vector for A*v = b
.lb - lower bounds on the variables
.ub - upper bounds on the variables
.csense - constraint sense character array ({L, E, G})
epsilon – smallest flux value that is considered nonzero
- OUTPUT:
V – flux vector minimising the weighted activity of the non-core reactions
- LP3(J, model, LPproblem, basis)[source]¶
Implementation of LP-3 for input set J (see FASTCORE paper)
- USAGE:
[v, basis] = LP3 (J, model, LPproblem, basis)
- INPUTS:
J – indices of reactions whose flux is maximised in the objective
model – COBRA model structure with fields:
.S - m x n stoichiometric matrix
.ub - n x 1 upper flux bounds
LPproblem – LP problem structure derived from the model with fields:
.A - constraint (stoichiometric) matrix
.b - right hand side vector for A*v = b
.lb - lower bounds on the variables
.ub - upper bounds on the variables
.csense - constraint sense character array ({L, E, G})
- OPTIONAL INPUT:
basis – basis to warm-start the LP solve
- OUTPUTS:
v – optimal steady state flux vector
basis – basis returned by the LP solver
- LP3cvx(J, model)[source]¶
CVX implementation of LP-3 for input set J (see FASTCORE paper). Maximises the total flux through the reactions indexed by J.
- USAGE:
V = LP3cvx (J, model)
- INPUTS:
J – indices of reactions whose summed flux is maximised
model – COBRA model structure with fields:
.S - m x n stoichiometric matrix
.lb - n x 1 lower flux bounds
.ub - n x 1 upper flux bounds
- OUTPUT:
V – steady state flux vector returned by the CVX solve
- LP7(J, model, LPproblem, epsilon, basis)[source]¶
Implementation of LP-7 for input set J (see FASTCORE paper). Maximises the number of feasible fluxes in J whose value is at least epsilon
- USAGE:
[v, basis] = LP7 (J, model, LPproblem, epsilon, basis)
- INPUTS:
J – indicies of irreversible reactions
model – COBRA model structure
LPproblem – LP problem structure derived from the model with fields:
.A - constraint (stoichiometric) matrix
.b - right hand side vector for A*v = b
.lb - lower bounds on the variables
.ub - upper bounds on the variables
.csense - constraint sense character array ({L, E, G})
epsilon – tolerance (smallest flux considered nonzero)
- OPTIONAL INPUT:
basis – basis to warm-start the LP solve
- OUTPUTS:
v – optimal steady state flux vector
basis – basis returned by the LP solver
- LP7cvx(J, model, epsilon)[source]¶
CVX implementation of LP-7 for input set J (see FASTCORE paper). Maximises the number of reactions in J that carry a flux of at least epsilon.
- USAGE:
V = LP7cvx (J, model, epsilon)
- INPUTS:
J – indices of reactions to drive above the epsilon threshold
model – COBRA model structure with fields:
.S - m x n stoichiometric matrix
.lb - n x 1 lower flux bounds
.ub - n x 1 upper flux bounds
epsilon – smallest flux value that is considered nonzero
- OUTPUT:
V – steady state flux vector returned by the CVX solve
- LP7cvx2(J, model, epsilon)[source]¶
CVX implementation of LP-7 for input set J (see FASTCORE paper), scaling the indicator variables by epsilon. Maximises the number of reactions in J that carry a flux of at least epsilon.
- USAGE:
V = LP7cvx2 (J, model, epsilon)
- INPUTS:
J – indices of reactions to drive above the epsilon threshold
model – COBRA model structure with fields:
.S - m x n stoichiometric matrix
.lb - n x 1 lower flux bounds
.ub - n x 1 upper flux bounds
epsilon – smallest flux value that is considered nonzero
- OUTPUT:
V – steady state flux vector returned by the CVX solve
- fastCoreWeighted(C, model, weights, epsilon)[source]¶
Based on: The FASTCORE algorithm for context-specific metabolic network reconstruction, Vlassis et al., 2013, PLoS Comp Biol.
- USAGE:
A = fastCoreWeighted (C, model, weights, epsilon)
- INPUTS:
C – List of reaction numbers corresponding to the core set
model – Model structure with the fields:
.rxns - n x 1 cell array of reaction abbreviations
.lb - n x 1 lower flux bounds
weights – Weight vector for each reaction in the model
epsilon – Parameter (default: getCobraSolverParams(‘LP’, ‘feasTol’)*100; see Vlassis et al for more details)
- OUTPUT:
A – A most compact model consistent with the applied constraints and containing the desired core set reactions (as given in C)
- fastcc(model, epsilon, printLevel, modeFlag, method)[source]¶
The FASTCC algorithm for testing the consistency of a stoichiometric model. Output A is the consistent part of the model.
- USAGE:
[A, orientation, V] = fastcc (model, epsilon, printLevel, modeFlag, method)
- INPUTS:
model – cobra model structure containing the fields:
.S - m x n stoichiometric matrix
.lb - n x 1 flux lower bound
.ub - n x 1 flux upper bound
.rxns - n x 1 cell array of reaction abbreviations
.csense - m x 1 character array of constraint senses in {L,E,G} (optional; defaults to E)
.C - k x n left hand side of C*v <= d (optional coupling constraints)
- OPTIONAL INPUTS:
epsilon – smallest flux that is considered nonzero
printLevel – 0 = silent, 1 = summary, 2 = debug
modeFlag – {(0), 1}; 1 = return matrix of modes V
method – ‘original’ - default or ‘nonconvex’
- OUTPUTS:
A – indices of flux consistent reactions in model
orientation – n x 1 vector indicating the orientation of flux consistency, where -1 means flux consistent in reverse direction only
V – n x k matrix such that S(:,A) * V(:,A) = 0 and |V(:,A)|’ * 1 > 0
- fastcc_cvx(model, epsilon)[source]¶
The FASTCC algorithm for testing the consistency of a stoichiometric model, solving the underlying LPs with the CVX modelling framework.
- USAGE:
A = fastcc_cvx (model, epsilon)
- INPUTS:
model – cobra model structure containing the fields:
.S - m x n stoichiometric matrix
.lb - n x 1 flux lower bounds
.ub - n x 1 flux upper bounds
.rxns - n x 1 cell array of reaction abbreviations
epsilon – smallest flux value that is considered nonzero
- OUTPUT:
A – indices of the flux consistent reactions in the model
- fastcore(model, coreRxnInd, epsilon, printLevel, adaptiveScalingFlag, nonPen)[source]¶
Use the FASTCORE algorithm (‘Vlassis et al, 2014’) to extract a context specific model. FASTCORE algorithm defines one set of core reactions that is guaranteed to be active in the extracted model and find the minimum of reactions possible to support the core.
- USAGE:
[tissueModel, coreRxnBool, coreMetBool, coreCtrsBool] = fastcore (model, coreRxnInd, epsilon, printLevel, adaptiveScalingFlag, nonPen)
- INPUTS:
model – COBRA model structure with the required fields:
.S - m x n stoichiometric matrix
.lb - n x 1 lower bounds
.ub - n x 1 upper bounds
.rxns - n x 1 cell array of reaction abbreviations
.mets - m x 1 cell array of metabolite abbreviations
.ctrs - coupling-constraint identifiers (optional)
coreRxnInd – indices of reactions in cobra model that are part of the core set of reactions (called ‘C’ in ‘Vlassis et al, 2014’)
- OPTIONAL INPUTS:
epsilon – smallest flux value that is considered nonzero (default getCobraSolverParams(‘LP’, ‘feasTol’)*100)
printLevel – 0 = silent, 1 = summary, 2 = debug (default - 0)
adaptiveScalingFlag – 0 = adaptive scaling is off (default), 1 = adaptive scaling is on (recommended for ill scaled models)
nonPen – list of reactions whose addition to the model is not penalized
- OUTPUTS:
tissueModel – extracted context-specific model
coreRxnBool – n x 1 boolean vector indicating core reactions
coreMetBool – boolean vector indicating metabolites retained in tissueModel
coreCtrsBool – boolean vector indicating coupling constraints retained in tissueModel
‘Vlassis, Pacheco, Sauter (2014). Fast reconstruction of compact context-specific metbolic network models. PLoS Comput. Biol. 10, e1003424.’
- findSparseMode(J, P, singleton, model, LPproblem, epsilon, adaptiveScalingFlag, basis, nonPen)[source]¶
Finds a mode that contains as many reactions from J and as few from P. Returns its support, or [] if no reaction from J can get flux above epsilon
- USAGE:
Supp = findSparseMode (J, P, singleton, model, LPproblem, epsilon, adaptiveScaling, basis, nonPen)
- INPUTS:
J – Indicies of irreversible reactions
P – Reactions
singleton – Takes only first instance from J, else takes whole J
model – Model structure (for reference)
LPproblem – LPproblem structure
epsilon – Parameter (default: getCobraSolverParams(‘LP’, ‘feasTol’)*100; see Vlassis et al for more details)
- OPTIONAL INPUT:
adaptiveScalingFlag – scaling choice for LP10
basis – Basis
nonPen – indexes of unpenalized reactions
- OUTPUTS:
Supp – Support or [] if no reaction from J can get flux above epsilon
basis – Basis
- findSparseModeWeighted(J, P, singleton, model, LPproblem, weights, epsilon)[source]¶
Finds a mode that contains as many reactions from J and as few from P. Returns its support, or [] if no reaction from J can get flux above epsilon. Based on: The FASTCORE algorithm for context-specific metabolic network reconstruction. Input C is the core set, and output A is the reconstruction, Vlassis et al., 2013, PLoS Comp Biol.
- USAGE:
Supp = findSparseModeWeighted (J, P, singleton, model, LPproblem, weights, epsilon)
- INPUTS:
J – Indicies of irreversible reactions
P – Reactions
singleton – Takes only first instance from J, else takes whole J
model – Model structure
LPproblem – The LP problem for the model structure
weights – The weights associated with the reactions.
epsilon – Parameter (default: getCobraSolverParams(‘LP’, ‘feasTol’)*100; see Vlassis et al for more details)
- OUTPUT:
Supp – Support or [] if no reaction from J can get flux above epsilon
- tmplp7cvx(J, model, epsilon)[source]¶
CVX implementation of LP-7 for input set J (see FASTCORE paper). Maximises the number of reactions in J that carry a flux of at least epsilon.
- USAGE:
V = tmplp7cvx (J, model, epsilon)
- INPUTS:
J – indices of reactions to drive above the epsilon threshold
model – COBRA model structure with fields:
.S - m x n stoichiometric matrix
.lb - n x 1 lower flux bounds
.ub - n x 1 upper flux bounds
epsilon – smallest flux value that is considered nonzero
- OUTPUT:
V – steady state flux vector returned by the CVX solve
- tmplp8cvx[source]¶
CVX code fragment for a weighted LP-8 style solve: minimise the summed absolute flux over the penalised reaction set (Penal) subject to the steady state constraint and flux bounds, while forcing the core set (K) above the threshold z. Expects n, Penal, K, z, and model to be defined in the workspace.