ACHR

ACBSampler(model, warmupPoints, fileName, nFiles, pointsPerFile, nMixPts, nWarmupNeeded, saveMatFlag, biasOpt)[source]

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)[source]

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)[source]

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)[source]

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)[source]

Creates a warmup point set for hit-and-run sampling by combining orthogonal and random points

Usage

warmupPts = createHRWarmup(model, nPoints, verbFlag, bias, nPointsCheck)

Input

  • 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)[source]

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)

Input

  • 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)[source]

Compares two sets of sampled points and determines how mixed they are.

Usage

mix = mixFraction(sample1, sample2, fixed)

Input

  • 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)[source]

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)[source]

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.