Code covered by the BSD License  

Highlights from
Absolute and Comparison Analysis for Affymetrix Data

Absolute and Comparison Analysis for Affymetrix Data

by

 

31 Mar 2005 (Updated )

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

[bM,nM]=affyBackgrNoise(intensMatrix,varargin)
function [bM,nM]=affyBackgrNoise(intensMatrix,varargin)
%AFFYBACKGRNOISE calculates the background and noise values for each cell
%   [BM,NM]=AFFYBACKGRNOISE(INTENSMATRIX) calculates the BACKGROUND and NOISE
%   values for each cell of the chip using smoothing adjustment based on
%   the distances between given cell and centers of the zones.
%
%   [BM,NM]=AFFYBACKGRNOISE(INTENSMATRIX,NDIVZONES,NUMPERCENT,SMCOEFF) 
%   calculates the BACKGROUND and NOISE for given values of the parametrs
%   NDIVZONES,NUMPERCENT and SMCOEFF.
%   
%   Default values of the parametrs are NDIVZONES=4, NUMPERCENT=2 and
%   SMCOEFF=100.

%   $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 > 4
    warning('The code expects at most 4 input agruments') 
end 
%
if (nargin >= 2 && (~isscalar(varargin{1}) && ~isempty(varargin{1}))) ||...
   (nargin >= 3 && (~isscalar(varargin{2}) && ~isempty(varargin{2}))) ||...
   (nargin >= 4 && (~isscalar(varargin{3}) && ~isempty(varargin{3})))
   error('NDIVZONES, NUMPERCENT and SMCOEFF must be scalars')
end
%
if nargin >= 2
    nDivZones=varargin{1};
end
if nargin >= 3
    numPercent=varargin{2};
end
if nargin >= 4
    smCoeff=varargin{3};
end
%
% Set Defaults
%
if nargin < 2 || isempty(nDivZones)
    nDivZones=4;
end
if nargin < 3 || isempty(numPercent)
    numPercent=2;
end
if nargin < 4 || isempty(smCoeff)
    smCoeff=100;
end
%
nrc=size(intensMatrix,1);
Nrc=nrc*nrc;
zoneSize=nrc/nDivZones;
N=nDivZones*nDivZones;
[bZ,nZ]=affyZoneBackground(intensMatrix,nDivZones,numPercent);
coordX=reshape(repmat([1:nrc]',1,nrc)',Nrc,1);
coordX=single(repmat(coordX,1,N));
coordY=repmat([1:nrc]',nrc,1);
coordY=single(repmat(coordY,1,N));
xCenters=reshape(repmat([zoneSize/2:zoneSize:zoneSize*(nDivZones-1/2)]',...
                                      1,nDivZones)',1,N);
xCenters=single(repmat(xCenters,Nrc,1));
yCenters=repmat([zoneSize/2:zoneSize:zoneSize*(nDivZones-1/2)],1,nDivZones);
yCenters=single(repmat(yCenters,Nrc,1)); 
weight=(coordX-xCenters).^2+(coordY-yCenters).^2+smCoeff;
BZ=reshape(bZ,N,1);    
background=(weight*BZ)./sum(weight,2);
bM=zeros(nrc);
bM(:)=background;
NZ=reshape(nZ,N,1);
noise=(weight*NZ)./sum(weight,2);
nM=zeros(nrc);
nM(:)=noise;

Contact us