ACHR¶
- ACBSampler(model, warmupPoints, fileName, nFiles, pointsPerFile, nMixPts, nWarmupNeeded, saveMatFlag, biasOpt)¶
Artificial centering boundary sampler
USAGE:
ACBSampler(model, warmupPoints, fileName, nFiles, pointsPerFile, nMixPts, nWarmupNeeded, saveMatFlag, biasOpt)
- INPUTS:
model: Model structure warmupPoints: Warmup points fileName: Base fileName for saving results nFiles: Number of sample point files created pointsPerFile: Number of points per file saved nMixPts: Number of steps initially used for mixing (not saved)
- OPTIONAL INPUTS:
nWarmupNeeded: Number of warmup points needed (Default = 20000) saveMatFlag: Save points in mat format vs txt format (Default = true) biasOpt: Options for biasing sampler (Default = no bias)
- ACHRSampler(model, warmupPoints, fileName, nFiles, pointsPerFile, stepsPerPoint, initPoint, fileBaseNo, maxTime, printLevel, minFlux, maxFlux)¶
Artificial Centering Hit-and-Run sampler
USAGE:
ACHRSampler(model, warmupPoints, fileName, nFiles, pointsPerFile, stepsPerPoint, initPoint, fileBaseNo, maxTime)
- INPUTS:
model: Model structure warmupPoints: Warmup points fileName: Base fileName for saving results nFiles: Number of files created pointsPerFile: Number of points per file saved stepsPerPoint: Number of sampler steps per point saved printLevel: 0 silent / 1 active
- OPTIONAL INPUTS:
initPoint: Initial point (Default = centerPoint) fileBaseNo: Base file number for continuing previous sampler run
(Default = 0)
maxTime: Maximum time limit (Default = 36000 s) minFlux: Lower bound of the solution space given by FVA maxFlux: Upper bound of the solution space given by FVA
- ACHRSamplerParallelGeneral(sampleStruct, nLoops, stepsPerPoint, maxtime, proc, fdirectory)¶
Artificial Centering Hit-and-Run sampler with in place (memory) point management
USAGE:
sampleStruct = ACHRSamplerParallelGeneral(sampleStruct, nLoops, stepsPerPoint, maxtime, proc, fdirectory)
- INPUTS:
sampleStruct: Sampling structure nLoops: Number of iterations stepsPerPoint: Number of sampler steps per point saved maxtime: Amount of time to spend on calculation (in seconds)
- OPTIONAL INPUTS:
proc: Number of processes if > 0. Otherwise, the proces #. fdirectory: Do not use this parameter when calling function directly.
- OUTPUT:
sampleStruct: Sampling structure with sample points
- convRevSamples(model, samples)¶
Converts signs for reactions that are only running in reverse direction
USAGE:
[model, samples] = convRevSamples(model, samples)
- INPUT:
model: Constraint-based model
- OPTIONAL INPUT:
samples: Sample set
- OUTPUTS:
model: COBRA model structure with negative-direction fluxes reversed samples: Sample set with negative-direction fluxes reversed
- createHRWarmup(model, nPoints, verbFlag, bias, nPointsCheck)¶
Creates a warmup point set for hit-and-run sampling by combining orthogonal and random points
USAGE:
warmupPts = createHRWarmup(model, nPoints, verbFlag, bias, nPointsCheck)
- INPUTS:
model: Model structure
- OPTIONAL INPUTS:
nPoints: Number of warmup points (Default = 5000); verbFlag: Verbose flag (Default = false) bias: Structure with fields:
method - Biasing distribution: ‘uniform’, ‘normal’
index - The reaction indexes which to bias (nBias total)
param - nBias x 2 matrix of parameters (for uniform it’s min max, for normal it’s mu, sigma).
- OUTPUT:
warmupPts: Set of warmup points
- gpSampler(sampleStruct, nPoints, bias, maxTime, maxSteps, threads, nPointsCheck)¶
Samples an arbitrary linearly constrained space using a fixed number of points that are moved in parallel The space is defined by
\[\begin{split}A x \leq, =, \geq b \\ lb \leq x \leq ub\end{split}\]USAGE:
[sampleStructOut, mixedFraction] = gpSampler(sampleStruct, nPoints, bias, maxTime, maxSteps, threads, nPointsCheck)
- INPUTS:
- sampleStruct: Structure describing the space to be sampled and
previous point sets:
A - LHS matrix (optionally, if not A script checks for S)
b - RHS vector
lb - Lower bound
ub - Upper bound
csense - Constraint type for each row in A (‘G’, ‘L’, ‘E’)
warmupPoints - Set of warmup points (optional, generated by default)
points - Currently sampled points (optional)
- OPTIONAL INPUTS:
- nPoints: Number of points used in sampling
(default = 2 * nRxns or 5000 whichever is greater)
bias: Structure with fields:
method - Biasing distribution: ‘uniform’, ‘normal’
index - The reaction indexes which to bias (nBias total)
param - nBias x 2 matrix of parameters (for uniform it’s min max, for normal it’s mu, sigma).
- maxTime: Maximum time alloted for the sampling in seconds
(default 600 s, pass an empty number [] to set maxSteps instead)
- maxSteps: Maximum number of steps to take (default 1e10). Sampler
will run until either maxStep or maxTime is reached. Set maxStep or maxTime to 0 and no sampling will occur (only warmup points generated).
- threads: number of threads the sampler will use. If you have a
dual core machine, you can set it to 2 etc. The speed up is almost linear w/ the number of cores. If using this feature and 2009a or newer, a futher speedup can be obtained by starting matlab from the command line by “typing matlab -singleCompThread” New feature: if threads < 0, use distributed toolbox.
- nPointsCheck: Checks that minimum number of points (2 * nRxns) are
used. (Default = true).
- OUTPUTS:
sampleStructOut: The sampling structure with some extra fields. mixedFract: The fraction mixed (relative to the warmupPts). A value of 1
means not mixed at all. A value of .5 means completely mixed.
- mixFraction(sample1, sample2, fixed)¶
Compares two sets of sampled points and determines how mixed they are.
USAGE:
mix = mixFraction(sample1, sample2, fixed)
- INPUTS:
- sample1, sample2: Ordered set of points. The points must be in
the same order otherwise it does not make sense.
- OPTIONAL INPUT:
- fixed: The indexes of sampled reactions which are fixed
and are not expected to mix. They are ignored.
- OUTPUT:
- mix: The mix fraction. Goes from 0 to 1 with 1 being
completely unmixed and .5 being essentially perfectly mixed.
Example
example 1: mix = mixFraction(sample1, sample2) example 2: fixed = findRxnIDs({R1, R2, …, Rx}) mix = mixFraction(sample1, sample2, fixed)
- removeCorrelRxns(model, R, correlCutoff)¶
Removes fully or almost fully correlated reactions
USAGE:
[selRxns, rxnSets, rxnList, Rfilt] = removeCorrelRxns(model, R, correlCutoff)
- INPUTS:
model: COBRA model structure R: Correl coefficient matrix
- OPTIONAL INPUT:
correlCutoff: Cutoff level for fully correlated rxns (Default 0.99999)
- OUTPUTS:
selRxns: true/false vector that allow selecting non-redundant data rxnSets: Correlated reaction sets rxnList: Reaction list with correlated reactions concatenated Rfilt: Filtered R
- verifyPoints(sampleStruct)¶
Verify that a set of points are in the solutoin space of sampleStruct. Typically, this method would be called to check a set of warmup points or points generated via gpSampler. Also verifies if points moved from warmup points.
USAGE:
[errorsA, errorsLUB, stuckPoints] = verifyPoints(sampleStruct)
- INPUT:
sampleStruct: LPProblem containing points and warmup points
- OUTPUTS:
- errorsA: Row index of the constraint in sampleStruct that
is not consistent with the given points
errorsLUB: Upper and lower bounds of the constraint + tolerance stuckPoints: Index of points which did not move.