Topology

connectedComponents(model, type, figures, files)[source]

Assuming two reactions are connected if they share metabolites, calculates the connected components in the stoichiometric matrix, that is, the sets of reactions that share a set of metabolites

USAGE:

[groups, orphans, R, C] = connectedComponents (model, type, figures)

INPUT:

model – COBRA model structure with fields:

  • .S - m x n stoichiometric matrix

  • .SIntRxnBool - n x 1 true for internal (non-exchange) reactions

  • .rxns - n x 1 reaction abbreviations

OPTIONAL INPUTS:
  • type – {(‘allComponents’), ‘largestComponent’}

  • figures – Will generate plots of the grouping algorithm as it creates block diagonal groups in from top left to bottom right in W.

  • files – Indicator, whether several files containing indicator matrices are generated.

OUTPUTS:
  • groups – a structure array (the number of distinct groups is length(groups)) with fields:

    • groups(i).num_els - number of reactions in group i.

    • groups(i).block - sub-block identity of group i.

    • groups(i).elements - reactions of W that are in group i.

    • groups(i).degrees - degrees of connection for each reaction in group i.

  • orphans – elements of W that were not in any group, becasue they did not meet the constraints.

  • R – reaction adjacency

  • C – compound adjacency

All components require: Connected Component Analysis on an Undirected Graph by Tristan Ursell http://www.mathworks.com/matlabcentral/fileexchange/35442-connected-component-analysis-on-an-undirected-graph.

Largest component requires: gaimc : Graph Algorithms In Matlab Code by David Gleich http://www.mathworks.com/matlabcentral/fileexchange/24134-gaimc-graph-algorithms-in-matlab-code.

findCyclicRxns(model, printLevel)[source]

Computes the reactions that are part of one or more stoichiometrically balanced cycles in the network

USAGE:

[cyclicRxnBool, rankS] = findCyclicRxns (model, printLevel)

INPUT:
  • model – COBRA model structure with field:

    • .S - m x n stoichiometric matrix

  • printLevel – verbose level

OUTPUTS:
  • cyclicRxnBool – boolean value

  • rankS – scalar giving rank of S

getCorrespondingCols(A, rowBool, colBool, mode)[source]

Returns a boolean vector that is true for a subset of the true cols in colBool according to whether the cols ‘exclusive’, ‘inclusive’, or ‘partial’ -ly correspond to true entries in rowBool

USAGE:

restrictedColBool = getCorrespondingCols (A, rowBool, colBool, mode)

INPUTS:
  • Am x n matrix

  • rowBoolm x 1 boolean vector

  • colBooln x 1 boolean vector

  • mode – ‘exclusive’ or ‘inclusive’ or ‘partial’

OUTPUT:

restrictedColBooln x 1 boolean vector

Example

A =
-1

0 0 0 0 2 -3 0 0 0 0 4 -5 0 0 0 0 6 -7 0 0 0 0 0 0

rowBool = [1; 1; 1; 0; 0]; colBool = [1; 1; 1; 1; 1];

%Therefore, the subset of rows and columns considered for inclusion are % -1 0 0 0 0 % 2 -3 0 0 0 % 0 4 -5 0 0

%If mode = ‘exclusive’ then restrictedColBool corresponds to this subset % -1 0 % 2 -3 % 0 4 %i.e. subset of colBool reactions exclusively involving rowBool metabolites

%If mode = ‘inclusive’ then restrictedColBool corresponds to this subset % -1 0 0 % 2 -3 0 % 0 4 -5 %i.e. subset of colBool reactions involving at least one rowBool metabolite

%If mode =’partial’ then restrictedColBool corresponds to the extra cols %with inclusive that are not present with exclusive.

getCorrespondingRows(A, rowBool, colBool, mode)[source]

Returns a boolean vector that is true for a subset of the true rows in rowBool according to whether the rows ‘exclusive’, ‘inclusive’, or ‘partial’ -ly correspond to true entries in colBool

USAGE:

restricedRowBool = getCorrespondingRows (A, rowBool, colBool, mode)

INPUTS:
  • Am x n matrix

  • rowBoolm x 1 boolean vector

  • colBooln x 1 boolean vector

  • mode – ‘exclusive’ , ‘inclusive’ or ‘partial’

OUTPUT:

restricedRowBoolm x 1 boolean vector

Example

A =
-1

0 0 0 0 2 -3 0 0 0 0 4 -5 0 0 0 0 6 -7 0 0 0 0 0 0

rowBool = [1; 1; 1; 1; 1]; colBool = [1; 1; 1; 0; 0];

% Therefore, the subset of rows and columns considered for inclusion are % -1 0 0 % 2 -3 0 % 0 4 -5 % 0 0 6 % 0 0 0

% If mode = ‘exclusive’ then restrictedRowBool corresponds to this subset % -1 0 0 % 2 -3 0 % 0 4 -5 % i.e subset of rowBool metabolites exclusively involved in the colBool % reactions

% If mode = ‘inclusive’ then restrictedRowBool corresponds to this subset % -1 0 0 % 2 -3 0 % 0 4 -5 % 0 0 6 % i.e subset of rowBool metabolites involved in colBool reactions

% If mode =’partial’ then restrictedRowBool corresponds to the extra rows % with inclusive that are not present with exclusive.

integerizeS(model, printLevel, internalRxnsOnly)[source]

Convert an S matrix with non-integer coefficients into one with all integer coefficients

Assumes that there are a maximum of six significant digits in the biomass reaction. Scales each reaction by the least common multiple of the denominators of its stoichiometric coefficients.

USAGE:

[modelOut, g] = integerizeS (model, printLevel, internalRxnsOnly)

INPUTS:

model – COBRA model structure with fields:

  • .S - m x n stoichiometric matrix

  • .rxns - n x 1 reaction abbreviations

  • .SConsistentRxnBool - n x 1 true for stoichiometrically consistent reactions (optional)

  • .SIntRxnBool - n x 1 true for internal reactions (set if absent)

  • .SIntMetBool - m x 1 true for internal metabolites (set if absent)

OPTIONAL INPUTS:
  • printLevel – verbosity level (default: 1)

  • internalRxnsOnly – 1 = integerise internal reactions only (default), 0 = integerise all reactions

OUTPUTS:
  • modelOut – model structure with modelOut.S integerised

  • gn x 1 scaling vector such that modelIn.S * diag(g) = modelOut.S

matrixCoherence(A)[source]

Computes the coherence of a matrix A, that is the maximum absolute value of the cross correlations between the columns of A

USAGE:

[mu, Q] = matrixCoherence (A)

INPUT:

A – Matrix

OUTPUTS:
  • mu – coherence

  • Q – matrix used by mu

rankMetabolicConnectivity(model, param)[source]

Rank the metabolites in a model by decreasing connectivity

Connectivity is the number of reactions in which a metabolite participates, computed from the binary form of the stoichiometric matrix.

USAGE:

[rankMetConnectivity, rankMetInd, rankConnectivity] = rankMetabolicConnectivity (model, param)

INPUTS:

model – COBRA model structure with fields:

  • .S - m x n stoichiometric matrix

  • .mets - m x 1 metabolite abbreviations

  • .SConsistentMetBool - m x 1 true for stoichiometrically consistent metabolites

  • .SConsistentRxnBool - n x 1 true for stoichiometrically consistent reactions

OPTIONAL INPUT:

param – structure of parameters with fields:

  • .internal - {(1), 0} if only internal reaction connectivity is considered

  • .plot - {(1), 0} if plots are produced

  • .n - (10) number of top ranked metabolites to plot

OUTPUTS:
  • rankMetConnectivity – metabolite abbreviations by decreasing connectivity

  • rankMetInd – rank ordered metabolite indices

  • rankConnectivity – metabolite connectivity by decreasing connectivity

testForTypeIIIPathways(model, ListExch, filename)[source]

Sets up the model to run extreme pathway analysis (expa) for identifying loops in the model (Type III pathways) and runs expa.

USAGE:

testForTypeIIIPathways (model, ListExch, filename)

INPUTS:
  • model – COBRA model structure with fields:

    • .lb - n x 1 lower flux bounds

    • .ub - n x 1 upper flux bounds

    • .c - n x 1 linear objective coefficients

    • .rxns - n x 1 reaction abbreviations

  • ListExch – List of position of exchange reactions in S matrix

  • filename – name of the file