0001 function closedModel=closeModel(model)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 closedModel=model;
0013
0014 closedModel.comps{numel(closedModel.comps)+1,1}='b';
0015 closedModel.compNames{numel(closedModel.compNames)+1,1}='boundary';
0016 if isfield(closedModel,'compMiriams')
0017 closedModel.compMiriams{numel(closedModel.compMiriams)+1,1}=[];
0018 end
0019 closedModel.unconstrained=zeros(numel(closedModel.mets),1);
0020
0021 for i=1:numel(closedModel.rxns)
0022 if sum(abs(closedModel.S(:,i)))==1
0023 closedModel.mets{numel(closedModel.mets)+1}=strcat(closedModel.mets{find(closedModel.S(:,i))},'_b');
0024 if isfield(closedModel,'metNames')
0025 closedModel.metNames{numel(closedModel.metNames)+1}=closedModel.metNames{find(closedModel.S(:,i))};
0026 end
0027 closedModel.metComps(numel(closedModel.metComps)+1)=numel(closedModel.comps);
0028 if isfield(closedModel,'inchis')
0029 closedModel.inchis{numel(closedModel.inchis)+1}=closedModel.inchis{find(closedModel.S(:,i))};
0030 end
0031 if isfield(closedModel,'metSmiles')
0032 closedModel.metSmiles{numel(closedModel.metSmiles)+1}=closedModel.metSmiles{find(closedModel.S(:,i))};
0033 end
0034 if isfield(closedModel,'metFormulas')
0035 closedModel.metFormulas{numel(closedModel.metFormulas)+1}=closedModel.metFormulas{find(closedModel.S(:,i))};
0036 end
0037 if isfield(closedModel,'metMiriams')
0038 closedModel.metMiriams{numel(closedModel.metMiriams)+1}=closedModel.metMiriams{find(closedModel.S(:,i))};
0039 end
0040 if isfield(closedModel,'metFrom')
0041 closedModel.metFrom{numel(closedModel.metFrom)+1}='';
0042 end
0043 if isfield(closedModel,'metCharges')
0044 closedModel.metCharges(numel(closedModel.metCharges)+1)=closedModel.metCharges(find(closedModel.S(:,i)));
0045 end
0046 if isfield(closedModel,'metDeltaG')
0047 closedModel.metDeltaG(numel(closedModel.metDeltaG)+1)=closedModel.metDeltaG(find(closedModel.S(:,i)));
0048 end
0049 closedModel.unconstrained(numel(closedModel.unconstrained)+1)=1;
0050 closedModel.b(numel(closedModel.b)+1)=0;
0051 closedModel.S=[closedModel.S;sparse(1,size(closedModel.S,2))];
0052 if sum(closedModel.S(:,i))==1
0053 closedModel.S(numel(closedModel.mets),i)=-1;
0054 else
0055 closedModel.S(numel(closedModel.mets),i)=1;
0056 end
0057 end
0058 end
0059
0060 end