# 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

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.

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)

Inputs

• model – model structure
• printLevel – verbose level

Outputs

• cyclicRxnBool – boolean value
• rankS – scalar giving rank of S
getCorrespondingCols(S, 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 ‘exclusively’ or ‘inclusively’ correspond to true entries in rowBool

Usage

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

Inputs

• Sm x n stoichiometric matrix
• rowBoolm x 1 boolean vector
• colBooln x 1 boolean vector
• mode – ‘exclusive’ or ‘inclusive’ or ‘partial’

Output

• restrictedColBooln x 1 boolean vector

Example

S =
-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(S, 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 ‘exclusively’ or ‘inclusively’ correspond to true entries in colBool

Usage

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

Inputs

• Sm x n stoichiometric matrix
• rowBoolm x 1 boolean vector
• colBooln x 1 boolean vector
• mode – ‘exclusive’ or ‘inclusive’

Output

• restrictedRowBoolm x 1 boolean vector

Example

S =
-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.

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
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
• ListExch – List of position of exchange reactions in S matrix
• filename – name of the file