getRxnsInComp Gets the reactions in a specified compartment model a model structure comp string with the compartment id includePartial true if reactions with metabolites in several compartments (normally transport reactions) should be included (opt, default false) I boolean vector of the reactions rxnNames the names of the reactions Usage: [I rxnNames]=getRxnsInComp(model,comp,includePartial) Rasmus Agren, 2013-08-01
0001 function [I rxnNames]=getRxnsInComp(model,comp,includePartial) 0002 % getRxnsInComp 0003 % Gets the reactions in a specified compartment 0004 % 0005 % model a model structure 0006 % comp string with the compartment id 0007 % includePartial true if reactions with metabolites in several 0008 % compartments (normally transport reactions) should 0009 % be included (opt, default false) 0010 % 0011 % I boolean vector of the reactions 0012 % rxnNames the names of the reactions 0013 % 0014 % Usage: [I rxnNames]=getRxnsInComp(model,comp,includePartial) 0015 % 0016 % Rasmus Agren, 2013-08-01 0017 % 0018 0019 if ischar(comp) 0020 comp={comp}; 0021 end 0022 if nargin<3 0023 includePartial=false; 0024 end 0025 0026 J=find(ismember(upper(model.comps),upper(comp))); 0027 0028 if numel(J)~=1 0029 dispEM(['No unique match to compartment "' comp{1} '"']); 0030 end 0031 0032 K=model.metComps==J; %Get all metabolites in the compartment 0033 0034 S=model.S~=0; 0035 0036 %Find the reactions which involve any of the mets 0037 [crap I]=find(S(K,:)); 0038 I=unique(I); 0039 0040 %Then remove the ones which also include metabolites in other comps 0041 if includePartial==false 0042 I=I(sum(S(:,I))==sum(S(K,I))); 0043 end 0044 rxnNames=model.rxnNames(I); 0045 end