Code covered by the BSD License

# Absolute and Comparison Analysis for Affymetrix Data

### Abram Jujunashvili (view profile)

31 Mar 2005 (Updated )

Perform single-array and comparison analysis for Affymetrix data given by CEL and CDF files ...

[bZ,nZ]=affyZoneBackground(intensMatrix,varargin)
```function [bZ,nZ]=affyZoneBackground(intensMatrix,varargin)
%AFFYZONEBACKGROUND calculates the zone values for rectangular parts of chip
%   [BZ,NZ]=AFFYZONEBACKGROUND(INTENSMATRIX) returns the mean values of the
%   lower part of intensities and their standard deviations for each zone.
%
%   [BZ,NZ]=AFFYZONEBACKGROUND(INTENSMATRIX,NDIVZONES,NUMPERCENT) returns the
%   values of background and noise for the given values of the parameters
%   NDIVZONES and NUMPERCENT.
%
%   Default values of the parametrs are NDIVZONES=4 and NUMPERCENT=2.

%   \$Revision: 1.0 \$  \$Date: 2005/03/15 \$
%   Copyright (c) Abram Jujunashvili ajujunas@math.cudenver.edu.remove
%            and  Andrew Knyazev
%
%      THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
%      EXPRESSED OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
%
%      The software is provided free of charge.
%
%   Tested on MATLAB Version 7.0.1.24704 (R14) Service Pack 1.
%   The code uses Statistics toolbox.
%   Statistics Toolbox Version 5.0.1 (R14SP1) was used.
%
%Availability:
%
%   http://www-math.cudenver.edu/~ajujunas/software/bioinform/microarray/

% Check input variables:
if nargin < 1
error('There must be at least 1 input agrument: INTENSMATRIX')
end
if nargin > 3
warning('The code expects at most 3 input agruments')
end
%
if (nargin >= 2 && (~isscalar(varargin{1}) && ~isempty(varargin{1}))) ||...
(nargin >= 3 && (~isscalar(varargin{2}) && ~isempty(varargin{2})))
error('NDIVZONES and NUMPERCENT must be scalars')
end
%
if nargin >= 2
nDivZones=varargin{1};
end
if nargin >= 3
numPercent=varargin{2};
end
%
% Set Defaults
%
if nargin < 2 || isempty(nDivZones)
nDivZones=4;
end
if nargin < 3 || isempty(numPercent)
numPercent=2;
end
%
K=nDivZones;
nrc=size(intensMatrix,1);
zoneSize=floor(nrc/K);
for j=1:K
for i=1:K

intens=reshape(intensMatrix(((j-1)*zoneSize+1):(j*zoneSize),...
((i-1)*zoneSize+1):(i*zoneSize)),zoneSize*zoneSize,1);
intens=intens(intens~=0);
intens=sort(intens);
nLow=floor(length(intens)*numPercent/100)+1;
bZ(i,j)=mean(intens(1:nLow));
nZ(i,j)=std(intens(1:nLow));
end
end
```