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