%                    PREPROCESSING
%                    -------------
%
% data loaded from *.cel files and stored in a matlab structure called allpmStructNo24Ord. 
%
load allpmStructNo24Ord

narray=length(allpmStructNo24Ord);
nprobe=length(allpmStructNo24Ord{1}.PMIntensities);

PMmatrix=zeros(nprobe,narray);
for i=1:narray
    PMmatrix(:,i)=allpmStructNo24Ord{i}.PMIntensities;
end

ProbeIndices=allpmStructNo24Ord{1}.ProbeIndices;
save ProbeIndices ProbeIndices

clear allpmStructNo24Ord
save PMmatrix PMmatrix

%
%
% RMA with quantile normalization
%
% PMmatrix - matrix of data

%1) BACKGROUND ADJUSTMENT --> RMABACKADJ
% modification of the matlab function rmabackadj to remove some bugs
pmMatrix_bg=rmabackadj_Sacchi(PMmatrix);

%pmMatrix_bg matrix of data after background correction
%
clear PMmatrix
save pmMatrix_bg pmMatrix_bg