Base


calcGroupStats(data, groups, statName, groupList, randStat, nRand)[source]

calcGroupStats Calculate statistics such as mean or standard deviation for subgroups of a population

USAGE

[groupStat, groupList, groupCnt, zScore] = calcGroupStats (data, groups, statName, groupList, randStat, nRand)

INPUTS
  • data – Matrix of data (individuals x variables)

  • groups – Group identifier for each individual

  • statName – Name of the statistic to be computed for each group: ‘mean’: mean value for group (default) ‘std’: standard deviation for group ‘median’: median for group ‘count’: sum total of variable values for group

  • groupList – List of group identifiers to be considered (optional, default all values occurring in groups)

  • randStat – Perform randomization analysis

  • nRand – # of randomizations

Group identifier can be either strings or numerical values

OUTPUTS
  • groupStat – Matrix of group statistic values for each group and variable

  • groupList – List of group identifiers considered

  • groupCount – Number of individuals in a group

createDeltaMatchMatrix(set1, set2)[source]

Create a flux difference constraint matrix for MOMA type calculations

USAGE

A = createDeltaMatchMatrix (set1, set2)

INPUTS

set1, set2 – input sets

OUTPUT

A – flux difference matrix

generateSystemConfigReport()[source]

Generates a configuration report of the sytem and saves it as COBRAconfigReport.log

USAGE

generateSystemConfigReport()

Converts a url to a clickable link in order to improve usability when using the MATLAB desktop environment

USAGE

outLink = hyperlink (url, urlText, altText1, altText2)

INPUTS
  • url – url address

  • urlText – url for java

  • altText1 – alternative text before link

  • altText2 – alternative text after link

OUTPUT

outLink – clickable link

parseBoolean(str, tokens, allowedElementChars)[source]

Parses a Boolean logic statement

USAGE

[elements, newRule] = parseBoolean (str, tokens, allowedElementChars)

INPUTS
  • str – Input string or cell array of boolean statements

  • tokens – Allowed operators in boolean statements (optional, default ‘()&|~’)

  • allowedElementChars – Allowed characters in elements of the statement

OUTPUTS
  • elements – Non-operator elements

  • newRule – New rule translated to element numbers

  • rxnGeneMat – If str is a cell array, rxnGeneMat is the normal COBRA rxnGeneMat (a matrix with rows corresponding to reactions, and columns corresponding to genes).

parseCobraVarargin(varArgIn, optArgin, defaultValues, validator, problemTypes, keyForSolverParams, emptyForDefault)[source]

Parse varargin for a COBRA function to obtain function inputs and cobra-problem-specific parameters. Used to handle inputs for functions supporting all of (i) direct argument inputs, (ii) name-value inputs, and (iii) parameter structure inputss

USAGE

[funParams, cobraParams, solverVaragin] = parseCobraVarargin (optArgin, defaultValues, validator, problemTypes, keyForSolverParams, emptyForDefault)

INPUTS
  • varArgIn – cell array of additional inputs for the function (= varargin in that function)

  • optArgin – cell array of strings for the optional arguments of a function

  • defaultValues – cell array of default values corresponding to optArgin

  • validator – cell array of function handles for validating the inputs corresponding to optArgin Will return error if the inputs do not return true from the validator

OPTIONAL INPUTS
  • problemTypes – cell array of cobra supported optimization problems needed to solve in the function (default {‘LP’, ‘MILP’, ‘QP’, ‘MIQP’})

  • keyForSolverParams – the keyword for solver-specific parameter structure in optArgin if solver-specific parameter structure is an explicit optional input argument in optArgin (which is NOT encouraged when writing cobra functions because the solver-specific parameter structure as a convention among cobra functions can be inputted without keyword and is handled this way in this parsing process). If this is the case, provide the keyword and it will be handled (default ‘’). Note that in this case the solver parameter structure will not be included in funParams but instead integrated in solverVaragin

  • emptyForDefault – True to interpret empty inputs for positional arguments as using the default values (default false)

OUTPUTS
  • funParams – cell array of optional argument inputs corresponding to optArgin. Can be assigned in the function easily by [argIn1, argIn2, …] = deal(funParams{:})

  • cobraParams – structure containing parsed cobra parameters for each problem type in problemTypes, to be used within the cobra function being written.

  • solverVaragin – structure containing parsed cobra-problem-specific addition inputs as a cell array for each problem type in problemTypes, with the first cell being the solver-specific parameter structure e.g., solverVarargin.LP contains the additional inputs for solveCobraLP, with solverVarargin.LP{1} being the solver-specific parameter structure, called as solveCobraLP(LPproblem, solverVarargin.LP{:})

parseGPR(grRuleString, currentGenes, preparsed, positions)[source]

Convert a GPR rule in string format to a rule in logic format. We assume the following properties of GPR Rules: 1. There are no genes called “and” or “or” (in any capitalization). 2. A gene name does not contain any of the following characters: (),{},[],|,& and no whitespace. 3. The general format of a GPR is: Gene1 or Gene2 and (Gene3 or Gene4) 4. ‘and’ and ‘or’ operators as well as gene names have to be followed and preceded by either a whitespace character or a opening or closing bracket, respectively. Gene Names can also be at the beginning or the end of the string.

USAGE

[ruleString, totalGeneList, newGeneList] = parseGPR (grRuleString, currentGenes, preparsed)

INPUT
  • grRuleString – The rule string in textual format.

  • currentGenes – Names of all currently known genes. Encountered genes (column cell Array of Strings)

OPTIONAL INPUT
  • preparsed – Whether the sring inserted into the function was preparsed or not. If provided, it is assumed, that currentGenes ONLY contains the genes in this rule AND that positions is the actual position of each gene to be used for the rule.

  • positions – Only used when preparsed is true. positions(ismember(currentGenes,gene)) will become the number used for that gene in the rule.

OUTPUT
  • ruleString – The logical formula representing the grRuleString. Any position refers to the totalGeneList returned.

  • totalGeneList – The concatenation of currentGenes and newGeneList

  • newGeneList – A list of gene Names that were not present in currentGenes

parseMetNames(metNames)[source]

Figures out the base metabolite names and compartments for each metabolite

USAGE

[baseMetNames, compSymbols, uniqueMetNames, uniqueCompSymbols] = parseMetNames (metNames)

INPUT

metNames – List of metabolite names

OUTPUTS
  • baseMetNames – List of met names without compartment symbol

  • compSymbols – Compartment symbols for each metabolite

  • uniqueMetNames – Unique metabolite names (w/o comp symbol)

  • uniqueCompSymbols – Unique compartment symbols

Metabolite names should describe the compartment assignment in the form “metName[compName]”

parseRxnFormula(formula)[source]

Parses reaction formula into a list of metabolites and a list of S coefficients

USAGE

[metaboliteList, stoichCoeffList, revFlag] = parseRxnFormula (formula)

INPUT

formula – Reaction formula, may contain symbols ‘+’, ‘->’, ‘<=>’ in addition to stoichiometric coefficients and metabolite names examples: ‘0.01 cdpdag-SC[m] + 0.01 pg-SC[m] -> 0.01 clpn-SC[m] + cmp[m] + h[m]’ (irreversible reaction) ‘cit[c] + icit[x] <=> cit[x] + icit[c] ‘ (reversible reaction) If no stoichiometric coefficient is provided, it is assumed to be = 1. Reaction formula should be a string, not a cell array

OUTPUTS
  • metaboliteList – Cell array with metabolite names

  • stoichCoeffList – List of S coefficients

  • revFlag – Indicates whether the reaction is reversible (true) or not (false)

Example

formula = ‘0.01 cdpdag-SC[m] + 0.01 pg-SC[m] -> 0.01 clpn-SC[m] + cmp[m] + h[m]’

[metaboliteList, stoichCoeffList, revFlag] = parseRxnFormula(formula)

%metaboliteList = ‘cdpdag-SC[m]’ ‘pg-SC[m]’ ‘clpn-SC[m]’ ‘cmp[m]’ ‘h[m]’ %stoichCoeffList = -0.01 -0.01 0.01 1 1 %revFlag = false

preparseGPR(grRules)[source]

preparse model.grRules before parsing the remaining part and transforming model.grRules into model.rules

USAGE

preParsedGrRules = preparseGPR (grRules)

INPUT

grRules – grRules cell or single grRule

OUTPUT

preParsedGrRules – preparsed grRules cell or single grRule

reporterMets(model, data, nRand, pValFlag, nLayers, metric, dataRxns, inclExchFlag)[source]

Implements the reporter metabolites algorithm by Patil & Nielsen

USAGE

[normScore, nRxnsMet, nRxnsMetUni, rawScore] = reporterMets (model, data, nRand, pValFlag, nLayers, metric, dataRxns)

INPUTS
  • model – Metabolic network reconstruction structure

  • data – Data matrix/vector

  • nRand – Number of randomizations

  • pValFlag – The data are p-values and should be converted to z-scores

  • nLayers – Number of reaction layers around each metabolite considered (default = 1)

  • metric – Metric used to evaluate score (‘default’,’mean’, ‘median’, ‘std’, ‘count’)

  • dataRxns – Reaction list for the data file (if different from the model reactions)

  • inclExchFlag – Flag for exchange reactions

OUTPUTS
  • normScore – Normalized scores for each metabolite

  • nRxnsMet – Number of reactions connected to each metabolite

  • nRxnsMetUni

  • rawScore – Raw unnormalized scores

selMatrix(selVec)[source]

Create selection matrix from a selection vector

USAGE

selMat = selMatrix (selVec)

INPUT

selVec – selection vector

OUTPUT

selMat – selection matrix

Example

selVec = [1 0 0 1 0 0] % returns selMat = [1 0 0 0 0 0

0 0 0 1 0 0]

% For reversible selections selVec = [1 0 0 1 -1 0] % returns selMat = [1 0 0 0 0 0

0 0 0 1 -1 0]

setWorkerCount(nworkers)[source]

configures the number of (parallel) workers

USAGE

setWorkerCount (nworkers)

INPUT

nworkers – Number of workers in the pool

Note

Requires the Parallel computing toolbox

splitString(string, delimiter)[source]

Splits a string Perl style

USAGE

fields = splitString (string, delimiter)

INPUTS
  • string – Either a single string or a cell array of strings

  • delimiter – Splitting delimiter

OUTPUT

fields – Either a single cell array of fields or a cell array of cell arrays of fields

Default delimiter is ‘s’ (whitespace) Delimiters are perl regular expression style, e.g. ‘|’ has to be expressed as ‘|’ Results are returned in the cell array fields

translateList(list, trList1, trList2)[source]

Translate a list of identifiers (either numerical or cell array) using a dictionary

USAGE

list = translateList (list, trList1, trList2)

INPUTS
  • list – original list

  • trList1 – list of elemets to be changed

  • trList2 – list of elements to be changed into

OUTPUTS

list – list after changes

Example

% Define original list list = {‘a’, ‘b’, ‘c’}

% Define dictionary trList1 = {‘b’, ‘c’} trList2 = {‘B’, ‘C’}

newList = translateList(list, trList1, trList2);

% returns newList = {‘a’, ‘B’, ‘C’};