Home > RAVEN > 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)

   Rasmus Agren, 2010-12-16

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 %   Rasmus Agren, 2010-12-16
0033 %
0034 
0035 if nargin<8
0036     downColor=[1 0 0];
0037 end
0038 if nargin<7
0039     upColor=[0 1 0];
0040 end
0041 if nargin<6
0042     defaultColor=[1 1 1];
0043 end
0044 if nargin<5
0045     maxChange=1;
0046 end
0047 
0048 %Finds the the dimensions of the metabolic network. The additional information will be
0049 %positioned relative to that object.
0050 dimension=getPathwayDimensions(pathway);
0051 
0052 %Plots the example box
0053 rectangle('edgecolor',[0 0 0], 'facecolor', defaultColor, 'linewidth', 1,...
0054     'position', [dimension(1)+dimension(3)+100 100 700 320],'curvature', [0.1 0.1]);
0055 handle=text(dimension(1)+dimension(3)+100+6, 100+0.5*320,...
0056             exampleBoxText,'fontname','Small Fonts','fontsize',2,...
0057             'interpreter', 'tex','verticalalignment','middle','HorizontalAlignment','left');
0058 handle=text(dimension(1)+dimension(3)+300+126, 20,...
0059             'EXAMPLE:','fontname','Small Fonts','fontsize',4,...
0060             'interpreter', 'tex','HorizontalAlignment','center','verticalalignment','middle');
0061 
0062 %Calculates 10 colors between upColor and defaultColor
0063 %The color is linear from the upColor to the defaultColor
0064 colorValues=[];
0065 for i=1:11
0066     logvalue=maxChange-(i-1)*0.1*maxChange;
0067     colorValues=[colorValues;...
0068                   [defaultColor(1)+(upColor(1)-defaultColor(1))*logvalue/(maxChange)...
0069                    defaultColor(2)+(upColor(2)-defaultColor(2))*logvalue/(maxChange)...
0070                    defaultColor(3)+(upColor(3)-defaultColor(3))*logvalue/(maxChange)]];
0071 end
0072 %The color is linear from the defaultColor to downColor
0073 for i=1:10
0074     logvalue=i*0.1*maxChange;
0075     colorValues=[colorValues;...
0076                   [defaultColor(1)+(downColor(1)-defaultColor(1))*logvalue/(maxChange)...
0077                    defaultColor(2)+(downColor(2)-defaultColor(2))*logvalue/(maxChange)...
0078                    defaultColor(3)+(downColor(3)-defaultColor(3))*logvalue/(maxChange)]];
0079 end
0080 
0081 %Draw lines that represent the different colors
0082 handle=text(dimension(1)+dimension(3)+100, 560,...
0083             'log10(|condition A|/|condition B|)','fontname','Small Fonts','fontsize',3,...
0084             'interpreter', 'tex','HorizontalAlignment','left','verticalalignment','middle');
0085 lengthLine=40;
0086 startX=dimension(1)+dimension(3)+150;
0087 
0088 startY=650;
0089 width=6;
0090 for i=1:size(colorValues,1)
0091     line([startX; startX],[startY+(i-1)*lengthLine; startY+i*lengthLine],'color',colorValues(i,:),'linewidth',width);
0092 end
0093 
0094 handle=text(startX+3*width, startY,...
0095             ['-  ' num2str(maxChange)],'fontname','Small Fonts','fontsize',3,...
0096             'interpreter', 'tex','HorizontalAlignment','left','verticalalignment','middle');
0097         
0098 handle=text(startX+3*width, startY+5.5*lengthLine,...
0099             ['-  ' num2str(maxChange/2)],'fontname','Small Fonts','fontsize',3,...
0100             'interpreter', 'tex','HorizontalAlignment','left','verticalalignment','middle');
0101 
0102 handle=text(startX+3*width, startY+10.5*lengthLine,...
0103             ['-  0'],'fontname','Small Fonts','fontsize',3,...
0104             'interpreter', 'tex','HorizontalAlignment','left','verticalalignment','middle');
0105         
0106 handle=text(startX+3*width, startY+15.5*lengthLine,...
0107             ['-  -' num2str(maxChange/2)],'fontname','Small Fonts','fontsize',3,...
0108             'interpreter', 'tex','HorizontalAlignment','left','verticalalignment','middle');
0109         
0110 handle=text(startX+3*width, startY+20.5*lengthLine,...
0111             ['-  -' num2str(maxChange)],'fontname','Small Fonts','fontsize',3,...
0112             'interpreter', 'tex','HorizontalAlignment','left','verticalalignment','middle');
0113 
0114 %Plots the additional text
0115 handle=text(dimension(1)+dimension(3)+100, 1800,...
0116             additionalText,'fontname','Small Fonts','fontsize',3,...
0117             'interpreter', 'none','verticalalignment','top','HorizontalAlignment','left');

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