Home > plotting > plotAdditionalInfo.m

plotAdditionalInfo

PURPOSE ^

plotAdditionalInfo

SYNOPSIS ^

function plotAdditionalInfo(handle, pathway, additionalText, exampleBoxText,maxChange, defaultColor, upColor, downColor)

DESCRIPTION ^

 plotAdditionalInfo
    Plots some additional information in a figure.

   handle              handle to the figure to plot the information on
   pathway             pathway structure of the metabolic network
   additionalText      array list with additional text to print (e.g.
                       fluxes or constraints)
   exampleBoxText      array list of text to put in an example box. The
                       text should explain what is printed in the enzyme
                       boxes
   maxChange           the logfold increase or decrease that corresponds
                       to full negative or full positive coloring. Must
                       be a positive value (opt, default 1)
   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])

   NOTE: At the moment the positions of the text/figures are (semi-)hard
           coded.

   Usage:  errorFlag = plotAdditionalInfo(handle, additionalText, exampleBoxText,...
               maxChange, defaultColor, upColor, downColor)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plotAdditionalInfo(handle, pathway, additionalText, exampleBoxText,...
0002     maxChange, defaultColor, upColor, downColor)
0003 % plotAdditionalInfo
0004 %    Plots some additional information in a figure.
0005 %
0006 %   handle              handle to the figure to plot the information on
0007 %   pathway             pathway structure of the metabolic network
0008 %   additionalText      array list with additional text to print (e.g.
0009 %                       fluxes or constraints)
0010 %   exampleBoxText      array list of text to put in an example box. The
0011 %                       text should explain what is printed in the enzyme
0012 %                       boxes
0013 %   maxChange           the logfold increase or decrease that corresponds
0014 %                       to full negative or full positive coloring. Must
0015 %                       be a positive value (opt, default 1)
0016 %   defaultColor        a color in Matlab format to be used if there are no
0017 %                       changes between the fluxes. This color is also used to
0018 %                       calculate the transition between the colors for up and
0019 %                       down regulated fluxes (opt, default [1 1 1])
0020 %   upColor             a color in Matlab format to be used if the flux is
0021 %                       larger than the reference flux (opt, default [0 1 0])
0022 %   downColor           a color in Matlab format to be used if the flux is
0023 %                       smaller than the reference flux (opt, default [1 0
0024 %                       0])
0025 %
0026 %   NOTE: At the moment the positions of the text/figures are (semi-)hard
0027 %           coded.
0028 %
0029 %   Usage:  errorFlag = plotAdditionalInfo(handle, additionalText, exampleBoxText,...
0030 %               maxChange, defaultColor, upColor, downColor)
0031 
0032 if nargin<8
0033     downColor=[1 0 0];
0034 end
0035 if nargin<7
0036     upColor=[0 1 0];
0037 end
0038 if nargin<6
0039     defaultColor=[1 1 1];
0040 end
0041 if nargin<5
0042     maxChange=1;
0043 end
0044 
0045 %Finds the the dimensions of the metabolic network. The additional
0046 %information will be positioned relative to that object.
0047 dimension=getPathwayDimensions(pathway);
0048 
0049 %Plots the example box
0050 rectangle('edgecolor',[0 0 0], 'facecolor', defaultColor, 'linewidth', 1,...
0051     'position', [dimension(1)+dimension(3)+100 100 700 320],'curvature', [0.1 0.1]);
0052 handle=text(dimension(1)+dimension(3)+100+6, 100+0.5*320,...
0053     exampleBoxText,'fontname','Small Fonts','fontsize',2,...
0054     'interpreter', 'tex','verticalalignment','middle','HorizontalAlignment','left');
0055 handle=text(dimension(1)+dimension(3)+300+126, 20,...
0056     'EXAMPLE:','fontname','Small Fonts','fontsize',4,...
0057     'interpreter', 'tex','HorizontalAlignment','center','verticalalignment','middle');
0058 
0059 %Calculates 10 colors between upColor and defaultColor The color is linear
0060 %from the upColor to the defaultColor
0061 colorValues=[];
0062 for i=1:11
0063     logvalue=maxChange-(i-1)*0.1*maxChange;
0064     colorValues=[colorValues;...
0065         [defaultColor(1)+(upColor(1)-defaultColor(1))*logvalue/(maxChange)...
0066         defaultColor(2)+(upColor(2)-defaultColor(2))*logvalue/(maxChange)...
0067         defaultColor(3)+(upColor(3)-defaultColor(3))*logvalue/(maxChange)]];
0068 end
0069 %The color is linear from the defaultColor to downColor
0070 for i=1:10
0071     logvalue=i*0.1*maxChange;
0072     colorValues=[colorValues;...
0073         [defaultColor(1)+(downColor(1)-defaultColor(1))*logvalue/(maxChange)...
0074         defaultColor(2)+(downColor(2)-defaultColor(2))*logvalue/(maxChange)...
0075         defaultColor(3)+(downColor(3)-defaultColor(3))*logvalue/(maxChange)]];
0076 end
0077 
0078 %Draw lines that represent the different colors
0079 handle=text(dimension(1)+dimension(3)+100, 560,...
0080     'log10(|condition A|/|condition B|)','fontname','Small Fonts','fontsize',3,...
0081     'interpreter', 'tex','HorizontalAlignment','left','verticalalignment','middle');
0082 lengthLine=40;
0083 startX=dimension(1)+dimension(3)+150;
0084 
0085 startY=650;
0086 width=6;
0087 for i=1:size(colorValues,1)
0088     line([startX; startX],[startY+(i-1)*lengthLine; startY+i*lengthLine],'color',colorValues(i,:),'linewidth',width);
0089 end
0090 
0091 handle=text(startX+3*width, startY,...
0092     ['-  ' num2str(maxChange)],'fontname','Small Fonts','fontsize',3,...
0093     'interpreter', 'tex','HorizontalAlignment','left','verticalalignment','middle');
0094 
0095 handle=text(startX+3*width, startY+5.5*lengthLine,...
0096     ['-  ' num2str(maxChange/2)],'fontname','Small Fonts','fontsize',3,...
0097     'interpreter', 'tex','HorizontalAlignment','left','verticalalignment','middle');
0098 
0099 handle=text(startX+3*width, startY+10.5*lengthLine,...
0100     ['-  0'],'fontname','Small Fonts','fontsize',3,...
0101     'interpreter', 'tex','HorizontalAlignment','left','verticalalignment','middle');
0102 
0103 handle=text(startX+3*width, startY+15.5*lengthLine,...
0104     ['-  -' num2str(maxChange/2)],'fontname','Small Fonts','fontsize',3,...
0105     'interpreter', 'tex','HorizontalAlignment','left','verticalalignment','middle');
0106 
0107 handle=text(startX+3*width, startY+20.5*lengthLine,...
0108     ['-  -' num2str(maxChange)],'fontname','Small Fonts','fontsize',3,...
0109     'interpreter', 'tex','HorizontalAlignment','left','verticalalignment','middle');
0110 
0111 %Plots the additional text
0112 handle=text(dimension(1)+dimension(3)+100, 1800,...
0113     additionalText,'fontname','Small Fonts','fontsize',3,...
0114     'interpreter', 'none','verticalalignment','top','HorizontalAlignment','left');
0115 end

Generated by m2html © 2005