Home > plotting > drawMap.m

drawMap

PURPOSE ^

drawMap

SYNOPSIS ^

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

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)
   supressOpen     true if the pdf file should not be opened (opt, default
                   false)

   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,supressOpen)

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

Generated by m2html © 2005