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 (optional, default false) I boolean vector of the reactions rxnNames the names of the reactions Usage: [I, rxnNames]=getRxnsInComp(model,comp,includePartial)
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 (optional, 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 comp=char(comp); 0017 if nargin<3 0018 includePartial=false; 0019 end 0020 0021 J=find(ismember(upper(model.comps),upper(comp))); 0022 0023 if numel(J)~=1 0024 EM=['No unique match to compartment "' comp{1} '"']; 0025 dispEM(EM); 0026 end 0027 0028 K=model.metComps==J; %Get all metabolites in the compartment 0029 0030 S=model.S~=0; 0031 0032 %Find the reactions which involve any of the mets 0033 [~, I]=find(S(K,:)); 0034 I=unique(I); 0035 0036 %Then remove the ones which also include metabolites in other comps 0037 if includePartial==false 0038 I=I(sum(S(:,I))==sum(S(K,I))); 0039 end 0040 rxnNames=model.rxnNames(I); 0041 end