getAllSubGraphs Get all metabolic subgraphs in a model. Two metabolites are connected if they share a reaction. model a model structure directed true if all metabolites must be reached from all other metabolites in the subgraph. Probably has little physiological meaning (opt, default false) subGraphs a structure with the subgraphs listed in order of the number of participating metabolites. The elements are string arrays with the metabolite IDs Usage: subGraphs=getAllSubGraphs(model,directed) Rasmus Agren, 2013-02-06
0001 function subGraphs=getAllSubGraphs(model,directed) 0002 % getAllSubGraphs 0003 % Get all metabolic subgraphs in a model. Two metabolites 0004 % are connected if they share a reaction. 0005 % 0006 % model a model structure 0007 % directed true if all metabolites must be reached from all other 0008 % metabolites in the subgraph. Probably has little physiological 0009 % meaning (opt, default false) 0010 % 0011 % subGraphs a structure with the subgraphs listed in order of the 0012 % number of participating metabolites. The elements are 0013 % string arrays with the metabolite IDs 0014 % 0015 % Usage: subGraphs=getAllSubGraphs(model,directed) 0016 % 0017 % Rasmus Agren, 2013-02-06 0018 % 0019 0020 if nargin<2 0021 directed=false; 0022 end 0023 0024 %Generate the connectivity graph. Metabolites are connected through 0025 %reactions. This is not a bipartite graph with the reactions. 0026 if directed==false 0027 G=model.S*model.S'; 0028 G(G~=0)=1; 0029 end 0030 0031 %Get all subgraphs 0032 [S,C]=graphconncomp(G,'Directed',true,'Weak',~directed); 0033 0034 subGraphs=cell(S,1); 0035 0036 for i=1:S 0037 subGraphs{i}=strcat(model.metNames(C==i),'[',model.comps(model.metComps(C==i)),']'); 0038 end 0039 end