colorPathway Calculates the color for those reactions that should be marked in the map and returns an updated pathway structure. pathway pathway structure of the metabolic network reactionsIDs cell array with the names of the reactions in the model fluxes vector with flux values from the simulation referenceFluxes vector with fluxes for the reference simulation cutOff a reaction is only colored if the absolute value of at least one of the fluxes is above the cutoff value (opt, default 0) defaultColor a color in Matlab format to be used if there are no changes between the fluxes. This color is also used to calculate the transition between the colors for up and down regulated fluxes (opt, default [1 1 1]) upColor a color in Matlab format to be used if the flux is larger than the reference flux (opt, default [0 1 0]) downColor a color in Matlab format to be used if the flux is smaller than the reference flux (opt, default [1 0 0]) returnPathway updated pathway structure which contains coloring data color array indicating the coloring of the enzyme signChange true if the reaction has changed direction Usage: returnPathway = colorPathway(pathway, reactionIDs, fluxes, referenceFluxes, ... cutOff, defaultColor, upColor, downColor) Rasmus Agren, 2010-12-16
0001 function returnPathway = colorPathway(pathway, reactionIDs, fluxes, referenceFluxes, ... 0002 cutOff, defaultColor, upColor, downColor) 0003 % colorPathway 0004 % Calculates the color for those reactions that should be marked in the 0005 % map and returns an updated pathway structure. 0006 % 0007 % pathway pathway structure of the metabolic network 0008 % reactionsIDs cell array with the names of the reactions in the model 0009 % fluxes vector with flux values from the simulation 0010 % referenceFluxes vector with fluxes for the reference simulation 0011 % cutOff a reaction is only colored if the absolute value of 0012 % at least one of the fluxes is above the cutoff value 0013 % (opt, default 0) 0014 % defaultColor a color in Matlab format to be used if there are no 0015 % changes between the fluxes. This color is also used to 0016 % calculate the transition between the colors for up and 0017 % down regulated fluxes (opt, default [1 1 1]) 0018 % upColor a color in Matlab format to be used if the flux is 0019 % larger than the reference flux (opt, default [0 1 0]) 0020 % downColor a color in Matlab format to be used if the flux is 0021 % smaller than the reference flux (opt, default [1 0 0]) 0022 % 0023 % returnPathway updated pathway structure which contains coloring data 0024 % color array indicating the coloring of the enzyme 0025 % signChange true if the reaction has changed direction 0026 % 0027 % Usage: returnPathway = colorPathway(pathway, reactionIDs, fluxes, referenceFluxes, ... 0028 % cutOff, defaultColor, upColor, downColor) 0029 % 0030 % Rasmus Agren, 2010-12-16 0031 % 0032 0033 if nargin<8 0034 downColor=[1 0 0]; 0035 end 0036 if nargin<7 0037 upColor=[0 1 0]; 0038 end 0039 if nargin<6 0040 defaultColor=[1 1 1]; 0041 end 0042 if nargin<5 0043 cutOff=0; 0044 end 0045 0046 %Loop through the components in the pathway. Check if any component has a 0047 %note and then check for the corresponding reaction id 0048 returnPathway=pathway; 0049 0050 for i=1:length(pathway.listOfSpecies) 0051 if strcmpi(pathway.listOfSpecies(i).type,'PROTEIN') 0052 if isfield(pathway.listOfSpecies(i),'note') 0053 if ~isempty(pathway.listOfSpecies(i).note) 0054 %If there is a note check if there is a corresponding reaction id 0055 correspondingReaction=find(strcmpi(reactionIDs,pathway.listOfSpecies(i).note)); 0056 if correspondingReaction>0 0057 %Check if either flux is above the cutoff value 0058 if abs(referenceFluxes(correspondingReaction))>=cutOff ||... 0059 abs(fluxes(correspondingReaction))>=cutOff 0060 %Calculate the corresponding color 0061 [color, signChange]=getColorCodes(referenceFluxes(correspondingReaction)... 0062 ,fluxes(correspondingReaction),1 , defaultColor, upColor, downColor); 0063 if ~isempty(color) 0064 returnPathway.listOfSpecies(i).color=color{1,1}; 0065 returnPathway.listOfSpecies(i).signChange=signChange{1,1}; 0066 end 0067 end 0068 end 0069 end 0070 end 0071 end 0072 end