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
-
columnVector
(vec)[source]¶ Converts a vector to a column vector
Usage
vecT = columnVector(vec)Input
- vec – a vector
Output
- vecT – a column vector
-
countUnique
(list)[source]¶ Count unique elements in a vector (cell array or numerical) Also sorts the unique elements in descending order
Usage
[sortedList, sortedCount] = countUnique(list)Input
- list – input vector
Outputs
- sortedList – list with sorted elements
- sortedCount – number of elements
-
createDeltaMatchMatrix
(set1, set2)[source]¶ Create a flux difference constraint matrix for MOMA type calculations
Usage
A = createDeltaMatchMatrix(set1, set2)Input
- 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()
-
hyperlink
(url, urlText, altText1, altText2)[source]¶ 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).
-
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)Inputs
- grRuleString – The rule string in textual format.
- currentGenes – Names of all currently known genes. Encountered genes (column cell Array of Strings)
Optional inputs
- 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.
Outputs
- 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
-
showprogress
(x, whichbar)[source]¶ showprogress shows waitbars
Inputs
- x – percentage in integer (e.g.: 1 = 1%, 40 = 40%, etc.)
- whichbar – caption
- varagin – see waitbar header for explanation
Output
- fout – handle output from waitbar() (WAITBAR_TYPE = 1)
-
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
Output
- 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'};
-
unioncell
(A, colA, B, colB)[source]¶ Return a cell which is the union of cell B to cell A given by a comparing
Usage
AB = unioncell(A, colA, B, colB)Inputs
- A – cell array A
- colA – column of A for comparison
- B – cell array B
- colB – column of B for comparison
Output
- AB – cell which is the union of cell B to cell A