0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 function convertModelToEX(model,filename,rxnzero)
0022
0023 fid = fopen(filename,'w');
0024 fprintf(fid,'(Internal Fluxes)\n');
0025
0026 EXrxns = [strmatch('EX_',model.rxns);strmatch('DM_',model.rxns)];
0027 EXrxns = model.rxns(EXrxns);
0028 checkEX = ismember(model.rxns,EXrxns);
0029
0030
0031 for i = 1:length(model.rxns)
0032 if checkEX(i) == 0
0033
0034 for t = 1:size(rxnzero,1)
0035 if i == rxnzero(t)
0036 fprintf(fid,'// ');
0037 end
0038 end
0039 fprintf(fid,'%s\t',model.rxns{i});
0040 if model.rev(i) == 0
0041 fprintf(fid,'I\t');
0042 else
0043 fprintf(fid,'R\t');
0044 end
0045 reactionPlace = find(model.S(:,i));
0046 if abs(model.S(reactionPlace,i)) > 1 - 1e-2
0047 for j = 1:size(reactionPlace,1)
0048 fprintf(fid,'%i\t%s\t',model.S(reactionPlace(j),i),model.mets{reactionPlace(j)});
0049 end
0050 else
0051 for j = 1:size(reactionPlace,1)
0052 newS(j,i) = 2*model.S(reactionPlace(j),i);
0053 fprintf(fid,'%i\t%s\t',newS(j,i),model.mets{reactionPlace(j)});
0054 end
0055 end
0056 fprintf(fid,'\n');
0057 end
0058 end
0059
0060
0061 fprintf(fid,'(Exchange Fluxes)\n');
0062 for i = 1:length(model.rxns)
0063 if checkEX(i) == 1
0064 metabolitePlace = find(model.S(:,i));
0065 fprintf(fid,'%s\t',model.mets{metabolitePlace});
0066 if model.lb(i) >= 0 && model.ub(i) >= 0
0067 fprintf(fid,'Output\n');
0068 else if model.lb(i) <= 0 && model.ub(i) <= 0
0069 fprintf(fid,'Input\n');
0070 else
0071 fprintf(fid,'Free\n');
0072 end
0073 end
0074 end
0075 end
0076
0077 fclose(fid);