0001 function followChanged(model,fluxesA,fluxesB, cutOffChange, cutOffFlux, cutOffDiff, metaboliteList)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 if nargin<4
0025 cutOffChange=10^-8;
0026 end
0027 if nargin<5
0028 cutOffFlux=10^-8;
0029 end
0030 if nargin<6
0031 cutOffDiff=10^-8;
0032 end
0033 if nargin<7
0034 metaboliteList=[];
0035 else
0036 metaboliteList=convertCharArray(metaboliteList);
0037 end
0038
0039
0040
0041 if nargin>6
0042 reactionIndexes=[];
0043 for i=1:length(metaboliteList)
0044 metaboliteIndex=find(strcmpi(metaboliteList(i),model.metNames));
0045 if ~isempty(metaboliteIndex)
0046 [~, b]=find(model.S(metaboliteIndex,:));
0047 reactionIndexes=[reactionIndexes; b(:)];
0048 else
0049 fprintf('Could not find any reactions with the metabolite %s\n\n',char(metaboliteList(i)))
0050 end
0051 end
0052 reactionIndexes=unique(reactionIndexes);
0053 else
0054 reactionIndexes=(1:length(fluxesA))';
0055 end
0056
0057
0058 in1=find(abs(fluxesA(reactionIndexes))>=cutOffFlux)';
0059 in2=find(abs(fluxesB(reactionIndexes))>=cutOffFlux)';
0060 ineither=reactionIndexes(unique([in1 in2]));
0061
0062
0063
0064 ineither=ineither(find(abs(fluxesA(ineither)-fluxesB(ineither))>=cutOffDiff));
0065
0066
0067
0068 nonZeroFluxes=ineither(find(fluxesA(ineither)));
0069 quota=1+cutOffChange/100;
0070 larger=nonZeroFluxes(find((fluxesB(nonZeroFluxes)./fluxesA(nonZeroFluxes))>=(quota)))';
0071 smaller=nonZeroFluxes(find((fluxesB(nonZeroFluxes)./fluxesA(nonZeroFluxes))<(1/quota)))';
0072 fluxIndexes=[larger smaller];
0073
0074
0075 zeroFluxes=ineither(find(fluxesA(ineither)==0));
0076 fluxIndexes=unique([fluxIndexes zeroFluxes(find(abs(fluxesB(zeroFluxes))>=cutOffFlux))']);
0077
0078 formulas=constructEquations(model,model.rxns(fluxIndexes));
0079
0080 if nargin>4
0081 if nargin>5
0082 fprintf('These reactions have flux values that differ by more than %s percent, absolute values above %s, and a total difference above %s (%s reactions)\n\n',num2str(cutOffChange),num2str(cutOffFlux),num2str(cutOffDiff),num2str(length(formulas)));
0083 else
0084 fprintf('These reactions have flux values that differ by more than %s percent and absolute values above %s (%s reactions)\n\n',num2str(cutOffChange),num2str(cutOffFlux),num2str(length(formulas)));
0085 end
0086 else
0087 fprintf('These reactions have flux values that differ by more than %s percent (%s reactions)\n\n',num2str(cutOffChange),num2str(length(formulas)));
0088 end
0089
0090 metaboliteNames=[];
0091 for i=1:length(metaboliteList)
0092 metaboliteNames=[metaboliteNames char(metaboliteList(i)) ' '];
0093 end
0094
0095 if ~isempty(metaboliteNames)
0096 fprintf('Only prints reactions involving one or more of the following metabolites:\n%s\n\n',metaboliteNames)
0097 end
0098
0099 for i=1:length(formulas)
0100 fluxText=['Flux: ' num2str(fluxesA(fluxIndexes(i))) ' Reference flux: ' num2str(fluxesB(fluxIndexes(i))) ' Difference: ' num2str(fluxesA(fluxIndexes(i))-fluxesB(fluxIndexes(i)))];
0101 fprintf('%s: %s\n\t%s\n\t%s\n\n', char(model.rxns(fluxIndexes(i))), char(formulas(i)),...
0102 char(model.rxnNames(fluxIndexes(i))),fluxText);
0103 end
0104 end