Rfastcormics¶
- GPRrulesMapper(exp, x)[source]¶
Evaluate Gene-Protein-Reaction (GPR) rules by mapping gene expression values to reactions using logical operators
- USAGE:
[res] = GPRrulesMapper (exp, x)
- INPUTS:
exp – cell array with the expression to evaluate from the rules field
x – value to plug into the expression
- OUTPUTS:
res – the numeric value resulting from evaluating the expression
- constrainModelOnMedium(model, mediumMets, notMediumConstrained, biomassReaction, functionToKeep)[source]¶
Constrain a metabolic model based on a defined medium by restricting the exchange reactions, while preserving essential functions
- USAGE:
[model] = constrainModelOnMedium (model, mediumMets, notMediumConstrained, biomassReaction, functionToKeep)
- INPUTS:
model – COBRA model structure with the following fields:
.S - m x n stoichiometric matrix
.lb - n x 1 lower flux bounds
.ub - n x 1 upper flux bounds
.rxns - n x 1 cell array of reaction identifiers
mediumMets – cell array of metabolites defining the growth medium
notMediumConstrained – list of reactions that should not be constrained by the medium
biomassReaction – reaction identifier of the biomass reaction to preserve
functionToKeep – list of reactions that must remain active
- OUTPUTS:
model – constrained metabolic model
- createFitL(xi, rest)[source]¶
Create a Gaussian fit of the residual (left) curve used for FPKM discretization
- USAGE:
[fitresult, gof] = createFitL (xi, rest)
- INPUTS:
xi – x values (log2(FPKM) grid) for the fit
rest – y values (residual density) to fit
- OUTPUTS:
fitresult – a cfit object representing the Gaussian fit
gof – structure with goodness-of-fit information
See also: FIT, CFIT, SFIT
- createFitR(x, hybrid_curve)[source]¶
Create a Gaussian fit of the hybrid (right) curve used for FPKM discretization
- USAGE:
[fitresult, gof] = createFitR (x, hybrid_curve)
- INPUTS:
x – x values (log2(FPKM) grid) for the fit
hybrid_curve – y values (hybrid density curve) to fit
- OUTPUTS:
fitresult – a cfit object representing the Gaussian fit
gof – structure with goodness-of-fit information
See also: FIT, CFIT, SFIT
- discretizeFPKM(fpkm, colnames, figflag, pathFigures, fileFormat)[source]¶
Discretize gene expression data (FPKM values) into three categories, expressed, not expressed, and unknown, based on a zFPKM transformation and half-Gaussian density fitting
- USAGE:
[discretized, scaledExpression] = discretizeFPKM (fpkm, colnames, figflag, pathFigures, fileFormat)
- INPUTS:
fpkm – m x n matrix or table of FPKM expression values (genes x samples)
colnames – 1 x n cell array of sample names
- OPTIONAL INPUTS:
figflag – flag to plot and save figures (default: 0)
pathFigures – path to save the figures (default: current folder)
fileFormat – file format used to store the figures (default: ‘.png’)
- OUTPUTS:
discretized – m x n matrix of discretized values:
1 - expressed
0 - unknown
-1 - not expressed
scaledExpression – scaled data after the zFPKM transformation
- findOrganicExRxns(model, biomassReaction, functionToKeep)[source]¶
Identify the exchange reactions that are carbon sources, excluding the biomass reaction, the reactions supplying the medium, and the reactions listed in the functionToKeep input
- USAGE:
[exOrgaRxns, ExOrgaInd] = findOrganicExRxns (model, biomassReaction, functionToKeep)
- INPUTS:
model – COBRA model structure with the following fields:
.S - m x n stoichiometric matrix
.rxns - n x 1 cell array of reaction identifiers
.mets - m x 1 cell array of metabolite identifiers
.metFormulas - m x 1 cell array of metabolite chemical formulas
biomassReaction – reaction identifier of the biomass reaction to exclude from constraining
functionToKeep – cell array of reaction identifiers to keep unconstrained
- OUTPUTS:
exOrgaRxns – cell array of the candidate exchange reaction identifiers (biomass and functionToKeep reactions excluded)
ExOrgaInd – indices of the organic exchange reactions among the candidates
- fixIrr(model)[source]¶
Convert irreversible backward reactions into irreversible forward reactions
- USAGE:
[model] = fixIrr (model)
- INPUTS:
model – COBRA model structure with the following fields:
.S - m x n stoichiometric matrix
.lb - n x 1 lower flux bounds
.ub - n x 1 upper flux bounds
.rxns - n x 1 cell array of reaction abbreviations
- OUTPUTS:
model – model with corrected reversibilities, with fields:
.rev - n x 1 reaction reversibility indicator (1 reversible, 0 irreversible)
.lb - updated n x 1 lower flux bounds
.ub - updated n x 1 upper flux bounds
.S - stoichiometric matrix with backward reactions flipped to forward
- mapExpressionToModel(model, data, dico, rownames, processTranscripts)[source]¶
Map the expression data to a model following the GPR rules (Pacheco et al., 2019)
- USAGE:
[mapping] = mapExpressionToModel (model, data, dico, rownames, processTranscripts)
- INPUTS:
model – COBRA model structure with the following fields:
.rxns - n x 1 cell array of reaction abbreviations
.genes - cell array of gene identifiers
.rules - cell array of GPR rules in x(i) logical form
data – expression or discretized values for the samples, size(data, 1) is the number of gene IDs and size(data, 2) is the number of samples
dico – table with corresponding gene identifier information, used to map the gene IDs to the genes in the model; can contain multiple columns with different identifiers
rownames – cell array with the gene IDs
- OPTIONAL INPUTS:
processTranscripts – 0 for inactive (default), 1 for active - if active, consider gene names of the model without any numbers after a “.”
- OUTPUTS:
mapping – matrix of the expression values mapped to the reactions according to the GPR rules, size(mapping, 1) equals the number of reactions and size(mapping, 2) equals size(data, 2)
- rFastcormics(model, discretized, rownames, dico, biomassReactionName, consensusProportion, epsilon, optionalSettings, fillingMediumFlag, adaptiveScalingFlag)[source]¶
Reconstruct a context-specific model (tissue, cell type, or any context) from RNAseq data and a generic reconstruction using the rFASTCORMICS algorithm (Pacheco et al. 2019)
- USAGE:
[contextSpecificModel, retainedRxns, indicesCompletedCoreOrig] = rFastcormics (model, discretized, rownames, dico, biomassReactionName, consensusProportion, epsilon, optionalSettings, fillingMediumFlag, adaptiveScalingFlag)
REQUIREMENTS:
Statistics and Machine Learning Toolbox, and Curve Fitting Toolbox
- INPUTS:
model – COBRA model structure with the following fields:
.S - m x n stoichiometric matrix
.lb - n x 1 lower flux bounds
.ub - n x 1 upper flux bounds
.rxns - n x 1 cell array of reaction abbreviations
.rules - cell array of GPR rules in x(i) logical form
.subSystems - reaction subsystem assignments
.metFormulas - m x 1 cell array of metabolite chemical formulas
discretized – discretized expression values, size(discretized, 1) is the number of genes and size(discretized, 2) is the number of samples
rownames – cell array with the gene IDs
dico – table with gene identifier information used to map the rownames to the model genes; can contain multiple columns with different identifiers:
.Properties - table metadata; the VariableNames identify the column that matches the gene IDs
biomassReactionName – reaction identifier of the objective (biomass) reaction
- OPTIONAL INPUTS:
consensusProportion – rate of samples that must (not) express a gene for it to be considered (not) expressed in the context of interest (default 0.9)
epsilon – smallest flux considered nonzero (default 1e-4)
optionalSettings – structure with optional constraints:
.func - cell array of reaction abbreviations that should carry a flux
.medium - cell array of metabolite abbreviations defining the growth medium
.notMediumConstrained - reaction abbreviations not in the medium that must be retained
fillingMediumFlag – fill the medium with supplementary reactions when the provided medium is not sufficient to fulfill the objective; 1 for active (default), 0 for inactive
adaptiveScalingFlag – adaptive scaling of the flux values (see LP10); 0 for inactive (default), 1 for active
- OUTPUTS:
contextSpecificModel – context-specific model, reduced to the retained reactions and associated genes
retainedRxns – indices of the retained reactions in the input model
indicesCompletedCoreOrig – indices of the core reactions in the input model
Example
[contextSpecificModel, retainedRxns, indicesCompletedCoreOrig] = rFastcormics(model, discretized, rownames, dico, biomassReactionName)