drawConc

PURPOSE ^

drawConc overlays a flux distribution onto a reaction map

SYNOPSIS ^

function options = drawConc(map,model,conc,options,varargin)

DESCRIPTION ^

drawConc overlays a flux distribution onto a reaction map

 options = drawConc(map,model,conc,options,varargin)

INPUTS
 map               COBRA map structure
 model             COBRA model structure
 conc              Vector containing concentration values

OPTIONAL INPTUS
 Optional parameters can be set using either the options structure, a
 parameter name / value pair input arguments, or a combination of both.

 options           Structure containing optional parameters
   lb              Lower limit to round smaller values up to.
   ub              Upper limit to round larger values down to.
   colorScale      Colormap
   scaleType       {1 - 'linear', 2 - 'log10'} (Default = 1)
  Note: see setMapOptions for additional options.

 varargin          optional parameter name / parameter value pairs

OUTPUT
 options           Structure containing optional parameters.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function options = drawConc(map,model,conc,options,varargin)
0002 %drawConc overlays a flux distribution onto a reaction map
0003 %
0004 % options = drawConc(map,model,conc,options,varargin)
0005 %
0006 %INPUTS
0007 % map               COBRA map structure
0008 % model             COBRA model structure
0009 % conc              Vector containing concentration values
0010 %
0011 %OPTIONAL INPTUS
0012 % Optional parameters can be set using either the options structure, a
0013 % parameter name / value pair input arguments, or a combination of both.
0014 %
0015 % options           Structure containing optional parameters
0016 %   lb              Lower limit to round smaller values up to.
0017 %   ub              Upper limit to round larger values down to.
0018 %   colorScale      Colormap
0019 %   scaleType       {1 - 'linear', 2 - 'log10'} (Default = 1)
0020 %  Note: see setMapOptions for additional options.
0021 %
0022 % varargin          optional parameter name / parameter value pairs
0023 %
0024 %OUTPUT
0025 % options           Structure containing optional parameters.
0026 %
0027 %
0028 %
0029 
0030 if nargin<4, options=[]; end
0031 %Parse optinal parameters
0032 if mod(length(varargin),2)==0
0033     for i=1:2:length(varargin)-1
0034         options = setMapOptions(options,map,model,varargin{i},varargin{i+1});
0035 %         switch lower(varargin{i})
0036 %             case 'lb', options.lb = varargin{i+1};
0037 %             case 'ub', options.ub = varargin{i+1};
0038 %             case 'scaletype', options.absFlag = varargin{i+1};
0039 %             case 'colorscale', options.colorScale = varargin{i+1};
0040 %             case 'filename', options.fileName = varargin{i+1};
0041 %         end
0042     end
0043 else
0044     error('Invalid number of parameters/values');
0045 end
0046 if ~isfield(options,'colorScale')
0047     options.colorScale = cool(100);
0048 end
0049 metListZero = (abs(conc)<=1e-9);
0050 if ~isfield(options,'scaleType'), options.scaleType=1; end
0051 if ~isfield(options,'lb'), lb=[]; else lb = options.lb; end
0052 if ~isfield(options,'ub'), ub=[]; else ub = options.ub; end
0053 switch lower(options.scaleType)
0054     case {1,'linear'}
0055         options.scaleTypeLabel='Linear;';
0056     case {2,'log10'}
0057         conc = log10(abs(conc));
0058         metListZero = model.mets(isinf(conc));
0059         options.scaleTypeLabel='Log10;';
0060     otherwise
0061         error('Invalid scaleType input')
0062 end
0063 if ~isempty(ub)
0064     conc(conc>ub)=ub;
0065     options.overlayUB = [num2str(ub) '+'];
0066     concMax = ub;
0067 else
0068     options.overlayUB = num2str(max(conc));
0069     concMax = max(conc);
0070 end
0071 if ~isempty(lb)
0072     conc(conc<lb)=lb;
0073     if lb==0
0074         options.overlayLB = '0';
0075     else
0076         options.overlayLB = [num2str(lb) '-'];
0077     end
0078     concMin = lb;
0079 else
0080     concMin = min(conc(~isinf(conc)));
0081     options.overlayLB = num2str(concMin);
0082 end
0083 if find(options.colorScale>1)
0084 else
0085     options.colorScale = round(options.colorScale*255);
0086 end
0087 if max(conc)~=0
0088     conc = repmat(conc,1,3)/max(conc);
0089 else
0090     conc=repmat(conc,1,3);
0091 end
0092 color = getColorFromColorScale(conc,options.colorScale);
0093 if isfield('zeroConcColor',options)
0094    color(metListZero,:) = repmat(options.zeroConcColor,length(metListZero),1);
0095 end
0096 options = setMapOptions(options,map,model,'nodeColor',color);
0097 options.overlayType = 'Concentration';
0098 options.lb = concMin;
0099 options.ub = concMax;
0100 drawCbMap(map,options);

Generated on Thu 21-Jun-2012 15:39:23 by m2html © 2003