Metabolomics

constrainRxns(model, specificData, param, mode, printLevel)[source]

Function used to apply constraints in the XomicsToModel function

USAGE

[newModel, rxnsConstrained, rxnBoundsCorrected, newOptions] = constrainRxns (model, specificData, param, mode, metabolomicWeights, printLevel)

INPUTS
  • model.S – m x n stoichiometric matrix

  • model.rxns – n x 1 cell array of reaction identifiers

  • model.rxnNames – n x 1 cell array of reaction names

  • model.lb – n x 1 vector with lower bounds

  • model.ub – n x 1 vector with upper bounds

  • model.constraintDescription

  • model.SIntRxnBool

  • model.SinkRxnBool

  • model.DMRxnBool

  • specificData.rxns2constrain

  • specificData.mediaData

  • specificData.exoMet.rxns k x 1 cell array of reaction identifiers

  • specificData.exoMet.mean k x 1 numeric array of mean measured reaction flux

  • specificData.exoMet.SD k x 1 numeric array of standard deviation in measured reaction flux

  • specificData.essentialAA

  • param.TolMinBoundary

  • param.TolMaxBoundary

  • param.boundPrecisionLimit

  • param.metabolomicWeights – String indicating the type of weights to be applied to penalise the difference between of predicted and experimentally measured fluxes by, where ‘SD’ weights = 1/(1+exoMet.SD^2) ‘mean’ weights = 1/(1+exoMet.mean^2) ‘RSD’ weights = 1/((exoMet.SD./exoMet.mean)^2)

  • param.eta – lower bound on significant bound costraint perturbation Default: feasTol*10;

  • param.printLevel

  • mode – String indicating the type of constraints to be applied ‘customConstraints’ uses specificData.rxns2constrain ‘mediaDataConstraints’ uses specificData.mediaData ‘exometabolomicConstraints’ uses specificData.exoMet

  • printLevel

OUTPUTS
  • newModel

  • rxnsConstrained

  • rxnBoundsCorrected

  • newSpecificData

OUTPUTS
  • newModel – A cobra model with constraints applied

  • rxnsConstrained – List of the reactions constrained

  • rxnBoundsCorrected – list of reactions whose restrictions should have been modified to comply with TolMinBoundary, TolMaxBoundary and boundPrecisionLimit.

  • newSpecificData – A new structure containing arguments for the XomicsToModel function

exoMetLOOCV(model, measuredFluxes, param)[source]

model: COBRA model

measuredFluxes: table with the fluxes obtained from exometabolomics experiments with the following variables
  • .rxns: k x 1 cell array of reaction identifiers

  • .mean: k x 1 double of measured mean flux

  • .SD: k x 1 double standard deviation of the measured flux

  • .labels: k x 1 cell array of labels to display on y axis

  • .Properties.Description: string describing the data, used in plot legend

param.alpha: alpha in (alpha/2)(v-h)’*H*(v-h), default = 10000; param.metabolomicWeights: String indicating the type of weights to be applied to penalise the difference

between of predicted and experimentally measured fluxes by, where ‘SD’ weights = 1/(1+exoMet.SD^2) ‘mean’ weights = 1/(1+exoMet.mean^2) ‘RSD’ weights = 1/((exoMet.SD./exoMet.mean)^2)

param.relaxBounds: True to relax bounds on reaction whose fluxes are to be fitted to exometabolomic data

OUTPUTS

V – table with the fluxes predicted by leave one out cross validation * .rxns: n x 1 cell array of reaction identifiers, one for each in input model * .v: n x 1 double of predicted mean flux * .lb: n x 1 double lower bound on reaction flux * .ub: n x 1 double upper bound on reaction flux

LIBkey:

EXAMPLE:

NOTE:

Author(s):

fitExperimentalFlux(model, vExp, weightLower, weightUpper, weightExpFlux, param)[source]

fit a vector of change in concentration, over a time interval, to the range of a stoichiometric matrix, minimising the weighed norm of the perturbations to the given lower and upper bounds on the corresponding exchange reactions of a model, to ensure that a steady state solution exists.

INPUT

model: (the following fields are required - others can be supplied)

  • .S - m x 1 Stoichiometric matrix

  • .c - n x 1 Linear objective coefficients

  • .osense - objective sense

  • .lb - n x 1 Lower bounds

  • .ub - n x 1 Upper bounds

vExp: n x 1 experimental flux vector (NaN if no info)

weightLower: n x 1 positive weight penalty on relaxation of lower bounds weightUpper: n x 1 positive weight penalty on relaxation of lower bounds

weightExpFlux: n x 1 positive weight penalty on deviation from experimental flux

growthMediaToModel(model, specificData, param, coreRxnAbbr, modelGenerationReport)[source]
USAGE

[model, specificData, coreRxnAbbr, modelGenerationReport] = growthMediaToModel (model, specificData, param, coreRxnAbbr, modelGenerationReport)

INPUTS
  • model.rxns

  • model.rxnNames

  • model.lb

  • model.ub

  • specificData.mediaData

  • specificData.mediaData.mets

  • specificData.mediaData.rxns

  • specificData.exoMet

  • param.metabolomicsBeforeExtraction

  • param.debug

  • param.workingDirectory

  • param.printLevel

  • param.TolMinBoundary

  • param.TolMaxBoundary

  • param.relaxOptions

  • coreRxnAbbr

  • modelGenerationReport

OUTPUTS
  • model.rxns

  • model.rxnNames

  • model.lb

  • model.ub

  • specificData.mediaData

  • specificData.mediaData.mediaData

  • specificData.mediaData.mets

  • specificData.mediaData.Properties

  • specificData.mediaData.rxns

  • specificData.exoMet

  • specificData.exoMet.exoMet

  • specificData.exoMet.ismedia

  • coreRxnAbbr

  • modelGenerationReport

EXAMPLE:

NOTE:

Author(s): Aga W.

mediaConstraints(model, uptakeRates, uptakeInChi, uptakeNames)[source]

this function finds the highest uptake rate for each metabolite in the uptakeRatesTable and sets this value as a lower boudary in the exchange reaction for that metabolite. If maximum uptake rate is higer than 0 (metabolite is only secreted by the cells) then lower boundary is set to 0

Inputs:

model - Cobra model uptakesRatesTable - Table consisting of ‘Chemical_Name’, ‘InChICode’,

and numeric columns with the experimental data (uptake/secretion rates in mmol/gDW/h )

Output:

model - Cobra model with constrained uptake rates

20190617 Agnieszka Wegrzyn

metabolomicsTomodel(model, specificData, param, coreRxnAbbr, modelGenerationReport)[source]

Integrates metabolomics data to COBRA models obtained in the cell culture media either by metabolomics experiments or by the content of the culture medium

USAGE

[model, specificData, coreRxnAbbr, modifiedFluxes, modelGenerationReport] = metabolomicsToModel (model, specificData, param, coreRxnAbbr, modelGenerationReport)

INPUT
  • model – A generic COBRA model

    • .S - Stoichiometric matrix

    • .mets - Metabolite ID vector

    • .rxns - Reaction ID vector

    • .lb - Lower bound vector

    • .ub - Upper bound vector

    • .genes - Upper bound vector

  • specificData – A structure containing the context-specific data

  • param – a structure containing the parameters for the function

  • coreRxnAbbr – Set of core reactions

  • modelGenerationReport – A struct array where the data will be saved

OUTPUTS
  • model – A Context-specific COBRA model with the metabolomic data.

  • specificData – The exometabolomic data is updated according to the relaxations

  • coreRxnAbbr – A Context-specific COBRA model with the metabolomic data.

  • modifiedFluxes – New set of core reactions.

  • modelGenerationReport – an updated version od the struct array

metsToKeep(dataOrg, metRep, calRelErr, param)[source]

removes the metabolomics measurements from the dataOrg table that have low measurement quality based on the relative SD of technical replicate sample (RSDqc provided in the metRep variable) and/or the average relative error (measured vs actual concentration) of the calibration line samples (RE provided in the calRelErr variable)

USAGE

[cleanedData, metToKeepSummary] = metsToKeep (dataOrg, metRep, calRelErr, param)

INPUTS
  • dataOrg – A table with original metabolomics data in a long format with information about measured samples, compounds, retention times (RT), area(s), concentrations, etc. the following column is required for the analysis:

    • .compound - compound (metabolite names) identical

      to the names used in the metRep and calRE variables

  • metRep – A table with quality information based on the dataOrg in a long format (output from mzQuality tool). The following columns are required for the analysis:

    • .compound - compound (metabolite names) identical

      to the names used in the dataOrg and calRE variables

    • .RSDqc_* - one or more columns specifying the

      relative standard deviation of the repeated measurement of a (quality) sample (per batch) per metabolite

  • calRelErr – A table with quality information about the relative error (RE) of the concentration estimation of the calibration line samples based on the dataOrg in a long format with information about measured samples, compounds, retention times (RT), known concentrations, estimated concentrations, and relative error etc. The following columns are required for the analysis:

    • .compound - compound (metabolite names) identical

      to the names used in the dataOrg and calRE variables

    • .RE* - a columns specifying the relative error of

      the concentration estimation of the calibration line samples

  • param.tresholdRSDqc – the treshold value for the relative SD of the repeated measurement of sample (default = 25 (%); based on the based on the “Guidelines and considerations for the use of system suitability and quality control samples in mass spectrometry assays applied in untargeted clinical metabolomic studies”)

  • param.tresholdCalRE – the treshold value for the relative error of the concentration estimation of the calibration line samples (default = 25 (%)

OUTPUTS
  • cleanedData – table in the same format as dataOrg without the metabolites of low quality (above set tresholds)

  • metToKeepSummary

    table in the same format as metRep variable with an

    added columns:

    • .keep - specifies whether a metabolite is to be

      kept (1) or removed (0) from the further analysis

    • .REcheck - specifies whether a metabolite passed

      (1) or failed (0) the check based on the relative error of the concentration estimation of the calibration line sample

    • .RSDqcCheck - specifies whether a metabolite passed

      (1) or failed (0) the check based on the relative standard deviation of the repeated measurement of a (QC) sample

    • .sumRE - shows the average relative error of the

      concentration estimation of the calibration line sample per metabolite

EXAMPLE:

NOTE:

Author(s): Agnieszka Wegrzyn (2021)

plotExperimentalvsPredictedExchange(measuredFluxes, predictedFluxes, otherFluxes, extraFluxes, param)[source]

plot a comparison of experimental and predicted exchange reaction rates

INPUT measuredFluxes: table with the fluxes obtained from exometabolomics experiments with the following variables

  • .rxns: k x 1 cell array of reaction identifiers

  • .mean: k x 1 double of measured mean flux

  • .SD: k x 1 double standard deviation of the measured flux

  • .labels: k x 1 cell array of labels to display on y axis

  • .Properties.Description: string describing the data, used in plot legend

predictedFluxes: table with the following variables
  • .rxns: k x 1 cell array of reaction identifiers

  • .v: k x 1 double of predicted mean flux

  • .lb: k x 1 double lower bound on reaction flux

  • .ub: k x 1 double upper bound on reaction flux

  • .labels: k x 1 cell array of labels to display on y axis

  • .Properties.Description: string describing the data, used in plot legend

OPTIONAL INPUT otherFluxes: table with the following variables

  • .rxns: k x 1 cell array of reaction identifiers

  • .Properties.Description: sring describing the data, used in plot legend

  • .labels: k x 1 cell array of labels to display on y axis

and
  • .mean: k x 1 double of measured mean flux

  • .SD: k x 1 double standard deviation of the measured flux

or
  • .v: k x 1 double of predicted mean flux

  • .lb: k x 1 double lower bound on reaction flux

  • .ub: k x 1 double upper bound on reaction flux

param: paramters structure with the following fields
  • .measuredFluxes {(1),0} set to zero to not display experimental fluxes

  • .labelType determines which y axes lables to display

    ‘metabolitePlatform’ = platform left and metabolite name right ‘metabolite’ = metabolite only right (default) ‘platform’ = platform only left

  • .expOrder {(1),0}

    1 = order reactions by value of experimental flux 0 = order reactions by value of predicted flux (predictedFluxes) for each reaction corresponding to an experimental flux

  • .saveFigures = 1 saves figure as .fig and .png to current directory

  • .plotTitle: title of the plot

plotPredictedAndExperimentalReactionRates[source]

Plot experimental uptake and secretion rates as well as error bars on logarithmic scale options to be specified and loaded before:

exoMet = glcValidationData; fullReport = comparisonData_C1.fullReport; condition = ‘Complex I inhibition’; objective = ‘unWeightedTCBMfluxConc’; comparisonObjective=[]; labelType = ‘metabolite’; %’platform’ saveFigures = 1; comparison = comparisonData_glc.fullReport; % second predicted flux to be added for comparison comparison_label = ‘Control’;

plotPredictedExchange(predictedFluxes, otherFluxes, extraFluxes, param)[source]

plot a comparison of experimental and predicted exchange reaction rates

INPUT predictedFluxes: table with the following variables

  • .rxns: k x 1 cell array of reaction identifiers

  • .v: k x 1 double of predicted mean flux

  • .lb: k x 1 double lower bound on reaction flux

  • .ub: k x 1 double upper bound on reaction flux

  • .labels: k x 1 cell array of labels to display on y axis

  • .Properties.Description: string describing the data, used in plot legend

OPTIONAL INPUT otherFluxes: table with the following variables

  • .rxns: k x 1 cell array of reaction identifiers

  • .Properties.Description: sring describing the data, used in plot legend

  • .labels: k x 1 cell array of labels to display on y axis

and
  • .mean: k x 1 double of measured mean flux

  • .SD: k x 1 double standard deviation of the measured flux

or
  • .v: k x 1 double of predicted mean flux

  • .lb: k x 1 double lower bound on reaction flux

  • .ub: k x 1 double upper bound on reaction flux

param: paramters structure with the following fields
  • .rxns: subset of reactions to plot

  • .measuredFluxes {(1),0} set to zero to not display experimental fluxes

  • .labelType determines which y axes lables to display

    ‘metabolitePlatform’ = platform left and metabolite name right ‘metabolite’ = metabolite only right (default) ‘platform’ = platform only left

  • .expOrder {(1),0}

    1 = order reactions by value of experimental flux 0 = order reactions by value of predicted flux (predictedFluxes) for each reaction corresponding to an experimental flux

  • .saveFigures = 1 saves figure as .fig and .png to current directory

  • .plotTitle: title of the plot

summaryConcentrations(cleanedData, param)[source]

function to summarise metabolite concentrations per group/perturbation (calculate mean and SD), function can detect and remove outliers before data is summarised (param.removeOutliers). Furthermore, function can map metabolite names into model IDs using either user specified metabolite lookup table (param.metLookupTable) or/and model structure (param.model).

Required inputs
  • cleanedData.Properties

  • cleanedData.Properties.Properties

  • cleanedData.Properties.VariableNames

  • cleanedData.group

  • cleanedData.perturbation

  • cleanedData.compound

  • cleanedData.sample

  • cleanedData.concentration

    cleanedData - metabolomics data in long format (output from

    mzQuality, required columns: sample, type, compound, concentration, cellLine or group, perturbation)

Optional inputs
  • param.model - cobra model used to map metabolite to metss
    • param.metLookupTable - table with metabolite names and model – identifiers to be mapped onto (required columns: ChemicalName, AlternativeName, Mets(containing metss)

    • param.excludeGroup - specifies any groups to be excluded from the – analysis (default: none)

    • param.group - specify which groups are to be analysed (default – all unique groups specified in the cleanedData)

    • param.printLevel - specifies if plots with median concentration – values should be printed (0)

    • param.perturbation - specifies perturbations to that should be – summarised separately (default: all unique perturbations specified in the cleanedData)

    • param.removeOutliers - should outliers be found and removed from – the dataset (0)

2021/12 Aga Wegrzyn