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, 2010-12-16

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, 2010-12-16
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 %Get the reactions that could not be mapped
0055 carriesFlux=union(modelA.rxns(conditionA~=0),modelB.rxns(conditionB~=0));
0056 
0057 rxnsInModel={};
0058 %Loop through the pathway structure and get the reaction that can be mapped
0059 for i=1:numel(pathway.listOfSpecies)
0060     if strcmp(pathway.listOfSpecies(i).type,'PROTEIN')
0061         if ~isempty(pathway.listOfSpecies(i).note)
0062             rxnsInModel=[rxnsInModel;pathway.listOfSpecies(i).note(1)]; 
0063         end
0064     end
0065 end
0066 
0067 %Find all reaction bounds that are "non-standard". Since the default bounds
0068 %are not indicated in the model structure it is assumed that the maximal
0069 %bound value is the default one.
0070 rxnBoundsA=find(modelA.ub~=max(modelA.ub) | (modelA.lb~=-max(modelA.ub) & modelA.rev==1) | (modelA.lb~=0 & modelA.rev==0));
0071 rxnBoundsB=find(modelB.ub~=max(modelB.ub) | (modelB.lb~=-max(modelB.ub) & modelB.rev==1) | (modelB.lb~=0 & modelB.rev==0));
0072 
0073 notMapped=setdiff(carriesFlux,rxnsInModel);
0074 
0075 pathway=colorPathway(pathway,modelA.rxns,conditionA,conditionB,cutOff);
0076 pathway=markPathwayWithFluxes(pathway,modelA.rxns,conditionA,conditionB);
0077 
0078 h=figure;
0079 drawPathway(pathway,h,cutOff);
0080 
0081 %Plot labels and title at pathway map
0082 plotLabels(h,pathway);
0083 setTitle(h,pathway,title);
0084 
0085 %Plot example box, color example and additional information
0086 exampleBoxText(1)={'Reaction ID'};
0087 exampleBoxText(2)={'Condition A'};
0088 exampleBoxText(3)={'Condition B'};
0089 if nargin>7
0090     exampleBoxText(4)={'Other data'};
0091 end
0092 
0093 additionalText={};
0094 additionalText=[additionalText;{'Objective function'}];
0095 
0096 additionalText=[additionalText;{getObjectiveString(true, objectiveNames, objectiveValues)}];
0097 additionalText=[additionalText;{''}];
0098 additionalText=[additionalText;{'Constraints (condition A)'}];
0099 
0100 counter=numel(additionalText)+1;
0101 for i=1:length(rxnBoundsA)
0102     additionalText{counter}=[modelA.rxns{rxnBoundsA(i)} '  [' ...
0103         num2str([modelA.lb(rxnBoundsA(i)) modelA.ub(rxnBoundsA(i))]) ']'];
0104     counter=counter+1;
0105 end
0106 
0107 additionalText=[additionalText;{''}];
0108 additionalText=[additionalText;{'Constraints (condition B)'}];
0109 
0110 counter=numel(additionalText)+1;
0111 for i=1:length(rxnBoundsB)
0112     additionalText{counter}=[modelB.rxns{rxnBoundsB(i)} '  [' ...
0113         num2str([modelB.lb(rxnBoundsB(i)) modelB.ub(rxnBoundsB(i))]) ']'];
0114     counter=counter+1;
0115 end
0116 
0117 plotAdditionalInfo(h, pathway, additionalText, exampleBoxText, 1);
0118 
0119 if nargin>5
0120     if any(filename)
0121         set(gcf, 'PaperType', 'A4'); 
0122         orient landscape;
0123         print('-dpdf', '-r600', filename);
0124         fprintf('File saved as %s\n',filename);
0125     end
0126 end
0127 end

Generated on Tue 23-Apr-2013 15:18:37 by m2html © 2005