Home > RAVEN > drawMap.m

drawMap

PURPOSE ^

drawMap

SYNOPSIS ^

function notMapped=drawMap(title,pathway,modelA,conditionA,conditionB,modelB,filename,cutOff)

DESCRIPTION ^

 drawMap
   Imports a previously drawn map of the metabolic network and plots
   the fluxes on that map. If the pathway contains expression data the log-fold
   changes are plotted as well

   title           title to be printed on the map
   pathway         map structure as generated by 
                   constructPathwayFromCelldesigner
   modelA            model structure for condition A
   conditionA      flux vector for condition A
   conditionB        flux vector for condition B (opt)
   modelB            model structure for condition B (opt, default modelA)
   filename        exports the map as a pdf (opt)
   cutOff          only print fluxes where one of the fluxes are above this
                   value (opt, default 10^-7)

   notMapped         the reaction ids that carried a flux in either of the
                   conditions but that were not present in the metabolic map

   The objective function in modelA is assumed to be the objective function
   in both cases. If only one flux is supplied then that flux is printed two
   times in each box.

   Usage: notMapped=drawMap(title,pathway,modelA,conditionA,...
           conditionB,modelB,filename,cutOff)

   Rasmus Agren, 2013-06-27

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function notMapped=drawMap(title,pathway,modelA,conditionA,conditionB,modelB,filename,cutOff)
0002 % drawMap
0003 %   Imports a previously drawn map of the metabolic network and plots
0004 %   the fluxes on that map. If the pathway contains expression data the log-fold
0005 %   changes are plotted as well
0006 %
0007 %   title           title to be printed on the map
0008 %   pathway         map structure as generated by
0009 %                   constructPathwayFromCelldesigner
0010 %   modelA            model structure for condition A
0011 %   conditionA      flux vector for condition A
0012 %   conditionB        flux vector for condition B (opt)
0013 %   modelB            model structure for condition B (opt, default modelA)
0014 %   filename        exports the map as a pdf (opt)
0015 %   cutOff          only print fluxes where one of the fluxes are above this
0016 %                   value (opt, default 10^-7)
0017 %
0018 %   notMapped         the reaction ids that carried a flux in either of the
0019 %                   conditions but that were not present in the metabolic map
0020 %
0021 %   The objective function in modelA is assumed to be the objective function
0022 %   in both cases. If only one flux is supplied then that flux is printed two
0023 %   times in each box.
0024 %
0025 %   Usage: notMapped=drawMap(title,pathway,modelA,conditionA,...
0026 %           conditionB,modelB,filename,cutOff)
0027 %
0028 %   Rasmus Agren, 2013-06-27
0029 %
0030 
0031 if nargin<4
0032     conditionB=conditionA;
0033 end
0034 
0035 if nargin<5
0036     modelB=modelA;
0037 end
0038 
0039 if nargin<8
0040     cutOff=10^-7;
0041 end
0042 
0043 if isempty(conditionB)
0044     conditionB=conditionA;
0045 end
0046 
0047 if isempty(modelB)
0048     modelB=modelA;
0049 end
0050 
0051 objectiveNames=modelA.rxns(modelA.c~=0);
0052 objectiveValues=modelA.c(modelA.c~=0);
0053 
0054 %Replace all values which are below the cut-off with 0.0
0055 conditionA(abs(conditionA)<cutOff)=0;
0056 conditionB(abs(conditionB)<cutOff)=0;
0057 
0058 %Get the reactions that could not be mapped
0059 carriesFlux=union(modelA.rxns,modelB.rxns);
0060 
0061 rxnsInModel={};
0062 %Loop through the pathway structure and get the reaction that can be mapped
0063 for i=1:numel(pathway.listOfSpecies)
0064     if strcmp(pathway.listOfSpecies(i).type,'PROTEIN')
0065         if ~isempty(pathway.listOfSpecies(i).note)
0066             rxnsInModel=[rxnsInModel;pathway.listOfSpecies(i).note(1)]; 
0067         end
0068     end
0069 end
0070 
0071 %Find all reaction bounds that are "non-standard". Since the default bounds
0072 %are not indicated in the model structure it is assumed that the maximal
0073 %bound value is the default one.
0074 rxnBoundsA=find(modelA.ub~=max(modelA.ub) | (modelA.lb~=-max(modelA.ub) & modelA.rev==1) | (modelA.lb~=0 & modelA.rev==0));
0075 rxnBoundsB=find(modelB.ub~=max(modelB.ub) | (modelB.lb~=-max(modelB.ub) & modelB.rev==1) | (modelB.lb~=0 & modelB.rev==0));
0076 
0077 notMapped=setdiff(carriesFlux,rxnsInModel);
0078 
0079 pathway=colorPathway(pathway,modelA.rxns,conditionA,conditionB,cutOff);
0080 pathway=markPathwayWithFluxes(pathway,modelA.rxns,conditionA,conditionB);
0081 
0082 h=figure;
0083 drawPathway(pathway,h,cutOff);
0084 
0085 %Plot labels and title at pathway map
0086 plotLabels(h,pathway);
0087 setTitle(h,pathway,title);
0088 
0089 %Plot example box, color example and additional information
0090 exampleBoxText(1)={'Reaction ID'};
0091 exampleBoxText(2)={'Condition A'};
0092 exampleBoxText(3)={'Condition B'};
0093 if nargin>7
0094     exampleBoxText(4)={'Other data'};
0095 end
0096 
0097 additionalText={};
0098 additionalText=[additionalText;{'Objective function'}];
0099 
0100 additionalText=[additionalText;{getObjectiveString(true, objectiveNames, objectiveValues)}];
0101 additionalText=[additionalText;{''}];
0102 additionalText=[additionalText;{'Constraints (condition A)'}];
0103 
0104 counter=numel(additionalText)+1;
0105 for i=1:length(rxnBoundsA)
0106     additionalText{counter}=[modelA.rxns{rxnBoundsA(i)} '  [' ...
0107         num2str([modelA.lb(rxnBoundsA(i)) modelA.ub(rxnBoundsA(i))]) ']'];
0108     counter=counter+1;
0109 end
0110 
0111 additionalText=[additionalText;{''}];
0112 additionalText=[additionalText;{'Constraints (condition B)'}];
0113 
0114 counter=numel(additionalText)+1;
0115 for i=1:length(rxnBoundsB)
0116     additionalText{counter}=[modelB.rxns{rxnBoundsB(i)} '  [' ...
0117         num2str([modelB.lb(rxnBoundsB(i)) modelB.ub(rxnBoundsB(i))]) ']'];
0118     counter=counter+1;
0119 end
0120 
0121 plotAdditionalInfo(h, pathway, additionalText, exampleBoxText, 1);
0122 
0123 if nargin>5
0124     if any(filename)
0125         set(gcf, 'PaperType', 'A4'); 
0126         orient landscape;
0127         print('-dpdf', '-r600', filename);
0128         fprintf('File saved as %s\n',filename);
0129     end
0130 end
0131 end

Generated on Tue 16-Jul-2013 21:50:02 by m2html © 2005