Fluxomics¶
- C13ConfidenceInterval(v0, expdata, model, max_score, directions, majorIterationLimit)[source]¶
Computes confidence intervals for C13 metabolic fluxes by minimizing and maximizing each flux (or flux ratio) subject to the experimental data-fit error staying below max_score
- USAGE:
[vs, output, v0] = C13ConfidenceInterval (v0, expdata, model, max_score, directions, majorIterationLimit)
- INPUTS:
v0 – set of flux vectors to be used as initial guesses. They may be valid or not.
expdata – experimental data
model – the standard model, with fields:
.S - m x n stoichiometric matrix
.N - basis of the null space of S (= null(S), a basis of the flux space; computed if absent)
.lb - n x 1 lower flux bounds
max_score – maximum allowable data fit error
- OPTIONAL INPUTS:
directions – ones and zeros of which reactions to compute (size = n x 1) or numbers of reactions to use aka. [1; 5; 7; 8; 200] or reaction strings aka. {‘GPK’, ‘PGL’}. Ratios are possible with this input only. Default = [] meaning - do FVA with no ratios.
majorIterationLimit – default = 10000
- OUTPUT:
vs – matrix
output – structure
v0 – as in input
- calcMDVfromSamp(glc, points, experiment)[source]¶
Converts a set of sampled flux points into mass-distribution vectors (MDVs) by solving the EMU network for each point and collecting the results
- USAGE:
[output] = calcMDVfromSamp (glc, points, experiment)
- INPUTS:
glc – substrate (glucose) label distribution; if empty, experiment.inputfrag is used
points – #fluxes x #samples array of sampled flux vectors, one per column
experiment – experiment structure controlling which fragments are collected, with fields:
.inputfrag - default substrate label distribution used when glc is empty
.fragments - structure of measured metabolite fragments, one field per fragment
.input - substrate label distribution stored on the output as xglc
- OUTPUT:
output – structure of MDV results, with fields mdv, names, ave, stdev (and xglc when experiment is supplied)
- compareBinsOfFluxes(xglc, model, sammin, sammax, metabolites)[source]¶
Takes the overall sammin and sammax samples, bins them into separate bin sizes and compares them, then compares the results to the largest bin size. calls [totalz, zscore, mdv1, mdv2] = compareTwoSamp(xglc, model, samp1, samp2, measuredMetabolites) sammin and sammax each contain bins of fluxes in x.samps(r,1).points
- USAGE:
[output] = compareBinsOfFluxes (xglc, model, sammin, sammax, metabolites)
- INPUTS:
xglc – sugar distribution
model – model structure
sammin – samples containing bins of fluxes
sammax – samples containing bins of fluxes
- OPTIONAL INPUT:
metabolites – list of metabolites
- OUTPUT:
output – result of comparison
- compareMultSamp(xglc, model, samps, measuredMetabolites)[source]¶
Compare the multiple sets of samples
- USAGE:
[totalz, zscore, mdvs] = compareMultSamp (xglc, model, samps, measuredMetabolites)
- INPUTS:
xglc – sugar distribution, a random sugar distribution is calculated if empty
model – model structure, expects model.rxns to contain a list of rxn names
samps – samples, expects to have a field named points containing an array of sampled points
- OPTIONAL INPUT:
measuredMetabolites – parameter fed to calcMDVfromSamp.m which only calculates the MDVs for the metabolites listed in this array
- OUTPUTS:
totalz – sum of all zscores
zscore – calculated difference for each mdv element distributed across all the points
mdvs – contains fields:
mdv - the calculated mdv distribution converted from the idv solved from each point contained in their respective samples sampX
names - the names of the metabolites
ave - the average of each mdv element across all of the points
stdev - the standard dev for each mdv element across all points
- compareTwoMDVs(mdv1, mdv2)[source]¶
Compares the 2 sets of mdvs
- USAGE:
[totalz, zscore] = compareTwoMDVs (mdv1, mdv2)
- INPUTS:
mdv1 – first MDV set to compare, with fields:
.names - the names of the metabolites
.ave - the average of each mdv element across all of the points
.stdev - the standard deviation for each mdv element across all points
mdv2 – second MDV set to compare, with fields:
.ave - the average of each mdv element across all of the points
.stdev - the standard deviation for each mdv element across all points
- OUTPUTS:
totalz – sum of all zscores
zscore – calculated difference for each mdv element distributed across all the points
- compareTwoSamp(xglc, model, samp1, samp2, measuredMetabolites)[source]¶
Compare the 2 sets of samples
- USAGE:
[totalz, zscore, mdv1, mdv2] = compareTwoSamp (xglc, model, samp1, samp2, measuredMetabolites)
- INPUTS:
xglc – sugar distribution, a random sugar distribution is calculated if empty
model – model structure, expects model.rxns to contain a list of rxn names
samp1 – first flux sample, with field:
.points - array of sampled flux points (one column per sample)
samp2 – second flux sample, with field:
.points - array of sampled flux points (one column per sample)
- OPTIONAL INPUT:
measuredMetabolites – parameter fed to calcMDVfromSamp.m which only calculates the MDVs for the metabolites listed in this array
- OUTPUTS:
totalz – sum of all zscores
zscore – calculated difference for each mdv element distributed across all the points
mdv1 – MDVs for samp1, with fields:
.mdv - the calculated mdv distribution converted from the idv solved from each sampled point
.names - the names of the metabolites
.ave - the average of each mdv element across all of the points
.stdev - the standard deviation for each mdv element across all points
mdv2 – MDVs for samp2, with the same fields as mdv1
- defineLinearConstraints(model, method)[source]¶
Builds the linear constraint set (in null-space or flux coordinates) used when fitting or bounding C13 flux vectors, after iteratively fixing the direction of reactions that are forced away from zero
- USAGE:
[A, b_L, b_U, model] = defineLinearConstraints (model, method)
- INPUTS:
model – model structure, with fields:
.S - m x n stoichiometric matrix
.N - basis of the null space of S (used as the constraint matrix when method is 1)
.lb - n x 1 lower flux bounds
.ub - n x 1 upper flux bounds
.mets - m x 1 array of metabolite identifiers
- OPTIONAL INPUT:
method – 1 uses the null-space basis N as the constraint matrix (default), 2 uses S
- OUTPUTS:
A – constraint matrix (rows with negligible norm removed)
b_L – lower bounds on the constraints
b_U – upper bounds on the constraints
model – the input model structure, returned unchanged
- fitC13Data(v0, expdata, model, majorIterationLimit)[source]¶
Fits one or more initial flux vectors to C13 experimental data by minimizing the data-fit error with a nonlinear solver subject to the model’s linear constraints
- USAGE:
[vout, rout] = fitC13Data (v0, expdata, model, majorIterationLimit)
- INPUTS:
v0 – It will automatically be converted to alpha by solving N*alpha = v; if v0 is a matrix then it is assumed to be a multiple start situation and vout will also have this size.
expdata – either a data structure or a cell array of structures, in which case it is assumed that you wan to fit the sum of the scores
model – model structure, with fields:
.S - m x n stoichiometric matrix
.N - basis of the null space of S (= null(S); computed if absent)
- OPTIONAL INPUT:
majorIterationLimit – max number of iterations solver is allowed to take. Default = 1000
- OUTPUTS:
vout – reflects size of v0, result of NLPsolution
rout – cell, result of NLPsolution
- generateRandomSample(model, n)[source]¶
Draws a near-uniform random sample of flux vectors from the solution space of a model using the general-purpose sampler, warming up from interior points until the mixed fraction is small enough
- USAGE:
[output] = generateRandomSample (model, n)
- INPUTS:
model – model structure, with fields:
.S - m x n stoichiometric matrix
.lb - n x 1 lower flux bounds
.ub - n x 1 upper flux bounds
n – number of warm-up points to generate, default = 5000
- OUTPUT:
output – structure with fields:
.point - array of sampled flux points (one column per sample)
.mf - final mixed fraction reported by the sampler
- getBinsOfFluxes(samp, numfluxes, numbins)[source]¶
Takes a samp.points fluxes and bin them by numfluxes (remainder not used) or divide up in to bins of fluxes by numbins (remainder not used) sample each bin of fluxes and compare the differences between them.
- USAGE:
[output] = getBinsOfFluxes (samp, numfluxes, numbins)
- INPUTS:
samp – fluxes
numfluxes – default = 100
numbins – default = []
- OUTPUT:
output – structure with .samps field
- getCompareBinsOfFluxes(xglc, model, samplo, samphi, metabolites)[source]¶
Compares the bins of fluxes between samplo and samphi, calls compareBinsOfFluxes(xglc, model, sammin, sammax, metabolites). `samplo and samphi each contain samples in x.points
- USAGE:
[output] = getCompareBinsOfFluxes (xglc, model, samplo, samphi, metabolites)
- INPUTS:
xglc – sugar distribution
model – model structure
samplo – samples containing bins of fluxes
samphi – samples containing bins of fluxes
- OPTIONAL INPUT:
metabolites – list of metabolites
- OUTPUT:
output – result of comparison
- getRandGlc()[source]¶
Generates random glucose in isotopomer format
- USAGE:
[xGlc] = getRandGlc()
- OUTPUT:
xGlc – random glucose
- goodInitialPoint(model, n)[source]¶
Generates 4*length(model.lb) random points, takes linear combinations of them so that all points are in the interior.
- USAGE:
[out] = goodInitialPoint (model, n)
- INPUTS:
model – model structure, with fields:
.lb - n x 1 lower flux bounds (sets the number of variables)
.c - objective coefficient vector, overwritten internally to probe each reaction
n – number, default = 1
- OUTPUT:
out – random points with linear combinations
- gradtest(v, model, expdata)[source]¶
Diagnostic that checks the finite-difference gradient of the C13 data-fit error by evaluating errorComputation2_grad over a range of step sizes and plotting each gradient component against the step size
- USAGE:
[out] = gradtest (v, model, expdata)
- INPUTS:
v – flux vector, converted to null-space (alpha) coordinates via model.N
model – model structure, with field:
.N - basis of the null space of S, mapping fluxes to alpha coordinates
expdata – experimental data structure passed through to the gradient evaluation
- OUTPUT:
out – declared output; the function is a plotting diagnostic and does not assign it
- isotopomerViewer(mdv1, mdv2, names)[source]¶
Takes in an “experiment” and views the isotopomer as distributions between mdv1 and mdv2. No output.
- USAGE:
isotopomerViewer (mdv1, mdv2, names)
- INPUTS:
mdv1 – first isotopomer distribution array (rows = isotopomers, columns = samples)
mdv2 – second isotopomer distribution array (rows = isotopomers, columns = samples)
names – names in the plot
- naturallabel(n)[source]¶
Returns a natural label idv of n carbons. Assumes 1.1% C13
- USAGE:
[out] = naturallabel (n)
- INPUT:
n – size of label
- OUTPUT:
out – natural label idv of n carbons
- runHiLoExp(experiment)[source]¶
Takes an experiment with the following structure and splits the sample space at the median of a target flux solves the two spaces with a given sugar and compares the resulting mdvs to provide a z-score.
- USAGE:
[experiment] = runHiLoExp (experiment)
- INPUTS:
experiment – structure describing the experiment, with fields:
.model - COBRA model structure (must contain S, rxns, c, lb, ub)
.points - #fluxes x #samples array of the sampled solution space; a sample is generated if missing or empty
.mfrac - mixed fraction reported by the sampler (set when a sample is generated)
.metabolites - optional parameter fed to calcMDVfromSamp.m; restricts which MDVs are calculated (may also be a structure of fragments)
.glcs - array of sugars in isotopomer (not MDV) format, one column per sugar; a random sugar is generated if empty
.glcsnames - cell array of human-readable sugar-mixture names, derived from glcs
.hilo - #targets x #samples array of 0/1 flags splitting each sample into the lo (0) and hi (1) side
.mdvs - structure of mdv results, one field per sugar (t1, t2, …); must be emptied by the user to force regeneration
.zscores - #targets x #glcs array of z-scores from each run
.rscores - #targets x #glcs array of ridge scores from each run
.kscores - #targets x #glcs array of KS scores from each run
- OUTPUT:
experiment – the experiment array.
This code will loop through one experiment per sugar, per target
- score_KS(mdv, hilo, lambda)[source]¶
Calculates KS score
- USAGE:
[out] = score_KS (mdv, hilo, lambda)
- INPUTS:
mdv – structure
hilo – (0’s and 1’s), ideally there will be a similar # of each.
- OPTIONAL INPUTS:
lambda – weighting, if the mean is less than lambda, the scores get weighted less, default = .02
- OUTPUT:
out – score
- score_ridge(mdv, hilo, lambda, crossval)[source]¶
Calculates ridge score
- USAGE:
[out] = score_ridge (mdv, hilo, lambda, crossval)
- INPUTS:
mdv – structure
hilo – (0’s and 1’s), ideally there will be a similar # of each.
- OPTIONAL INPUTS:
lambda – ridge parameter, default = .01
crossval – whether to do cross validation. This severely slows down the computation, default is no.
- OUTPUT:
out – score