C13solver¶
- Combination(n, k)[source]¶
Produces the array of combinations possible picking k from n adapted from Combinadics http://msdn.microsoft.com/en-us/library/aa289166(VS.71).aspx
- USAGE:
[out] = Combination (n, k)
- INPUTS:
n – number of elements in the pool
k – number of elements to pick from n
- OUTPUT:
out – array of combinations
- cdv2idv(n)[source]¶
Transformation matrix to transform cumomers to idv’s. idv = cdv2idv(log2(length(cdv)))*cdv; Employs memoization.
- USAGE:
[out] = cdv2idv (n)
- INPUT:
n – cdv
- OUTPUT:
out – idv
- errorComputation2(x, Prob)[source]¶
Computes the total C13 data-fit error (objective value) for a set of fluxes given the experimental data and model carried in Prob
- USAGE:
[out] = errorComputation2 (x, Prob)
- INPUTS:
x – flux vector (in null-space / alpha coordinates) at which the error is evaluated
Prob – problem structure supplied by the solver, with field:
.user - structure of user data; .user.expdata (experimental data) and .user.model (model structure) are read here
- OUTPUT:
out – scalar C13 data-fit error; when .user.objective is set, the penalised linear objective is returned instead
- errorComputation2_grad(x, Prob)[source]¶
Computes the finite-difference gradient of the C13 data-fit error (errorComputation2) with respect to the fluxes x
- USAGE:
[out] = errorComputation2_grad (x, Prob)
- INPUTS:
x – flux vector (in null-space / alpha coordinates) at which the gradient is evaluated
Prob – problem structure supplied by the solver, with field:
.user - structure of user data; .user.model and, when present, .user.diff_interval and .user.useparfor are read here
- OUTPUT:
out – gradient vector of the C13 data-fit error, same size as x
- generateIsotopomerSolver(model, inputMet, experiment, FVAflag)[source]¶
Prints a file which looks like BiosyntheticMappingFile except that it has the indexes of every reaction in there as well. After that it calls converter.pl, optimizer.pl and validator.pl but I can take care of that.
- USAGE:
generateIsotopomerSolver (model, inputMet, experiment, FVAflag)
- INPUTS:
model – model structure with fields:
.isotopomer - cell array of isotopomer mapping strings, one per reaction
.rxns - n x 1 cell array of reaction identifiers
inputMet – input metabolites
experiment – experiment structure with field:
.fragments - structure of measured metabolite fragments, one field per fragment
FVAflag – default = false, if true then additinoal operations involving fluxVariability involved
Prints a file to /isotopomer/solver/ directory
- idv2cdv(n)[source]¶
Returns transformation to go from idv to cumomers. cdv = idv2cdv(log2(length(idv)))*idv;
- USAGE:
[out] = idv2cdv (n)
- INPUT:
n – idv
- OUTPUT:
out – cdv
- idv2idv(n)[source]¶
Outputs a transformation matrix for changing from forward to reverse order.
order 1 (Jennie’s)
000, 001, 010, 011, 100, 101, 110, 111
order 2 (mine)
000, 100, 010, 110, 001, 101, 011, 111
- USAGE:
[out] = idv2idv (n)
- INPUT:
n – matrix, size of matrix (2^n x 2^n)
- OUTPUT:
out – transforamtion matrix
- idv2mdv(n, fragment)[source]¶
Returns transofmation matrix from idv’s (either Jennie’s or Jan’s order). MDV = idv2mdv(log2(length(idv)))*idv;
- USAGE:
[out] = idv2mdv (n, fragment)
- INPUT:
n – matrix
- OPTIONAL INPUT:
fragment – a vector of carbons to be included. [ 0, 0, 1, 1, 1]’ = last 3 carbons.
- OUTPUT:
out – transformation matrix
- ratioScore(x, Prob)[source]¶
Computes a flux-ratio objective (ration’*x)/(ratiod’*x) used when computing confidence intervals on flux ratios
- USAGE:
[out] = ratioScore (x, Prob)
- INPUTS:
x – flux vector (in null-space / alpha coordinates)
Prob – problem structure supplied by the solver, with field:
.user - structure of user data; .user.ration (numerator coefficients) and .user.ratiod (denominator coefficients) are read here
- OUTPUT:
out – scalar value of the flux ratio at x
- ratioScore_grad(x, Prob)[source]¶
Computes the analytical gradient of the flux-ratio objective evaluated by ratioScore, with respect to the fluxes x
- USAGE:
[out] = ratioScore_grad (x, Prob)
- INPUTS:
x – flux vector (in null-space / alpha coordinates)
Prob – problem structure supplied by the solver, with field:
.user - structure of user data; .user.ration (numerator coefficients) and .user.ratiod (denominator coefficients) are read here
- OUTPUT:
out – gradient vector of the flux ratio at x, same size as x
- scoreC13Fit(flux, expdata, model, namesset, method)[source]¶
This function (1) computes the theoretical mdv distribution vector for a given flux vector, v, (2) and then computes an error score by taking a running sum of the squared difference between the theortical and experimental mdv vectors.
- USAGE:
[output] = scoreC13Fit (flux, expdata, model, namesset, method)
- INPUTS:
flux – flux vector
expdata – experimental data structure with fields:
.std2 - measurement standard deviation used to normalise the error
.fragments - structure of measured metabolite fragments, one field per fragment
.input - substrate label distribution in cumomer format (used by method 1)
.inputfrag - substrate label distribution in EMU/fragment format (used by method 2)
model – model structure with fields:
.lb - n x 1 lower flux bounds (used to test whether flux is a full flux vector)
.N - basis of the null space of S, mapping alpha coordinates back to fluxes
namesset – set of names
method – method 1 = cumomer, method 2 = CMU
- OUTPUT:
output – contains fields:
error - the calculated error sum value
theory - theoretical mdv vector
experimental - experimental mdv vector
Example
v - flux vector array expdata - experimental data structure
- e.g.
- ala57
met = xalaL
fragment = [1,1,1]’
data = [0.238,0.098,0.017]’
glc_cdv is a sugar distribution in cumomer format (see idv2cdv).
- solveLin(A, B)[source]¶
Solves the linear system A*x = B restricted to the connected block of variables reachable from the non-zero entries of B, leaving the remaining variables at zero
- USAGE:
[x] = solveLin (A, B)
- INPUTS:
A – square coefficient matrix of the linear system
B – right-hand side; a single column is solved directly, while for multiple columns the columns 2:end are solved and the first column is set so that each row of x sums to 1
- OUTPUT:
x – solution the same size as B; entries outside the connected block are left at zero