home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.disi.unige.it
/
2015-02-11.ftp.disi.unige.it.tar
/
ftp.disi.unige.it
/
pub
/
.person
/
BarlaA
/
sw
/
matlab
/
Cromwell
/
basecorr2.m
< prev
next >
Wrap
Text File
|
2007-12-04
|
3KB
|
94 lines
function bc = basecorr2(raw, rawMass, M, L, thld)
%
% bc = basecorr2(raw, rawMass, M, L, thld)
% wrapper to perform wavelet denoising, baseline correction, and
% peak finding on a collection of spectra.
%
% inputs are:
% raw % matrix of intensities
% rawMass % vector of masses
% M % number of data points to ignore at beginning
% L % wavelet level
% thld % multiple of MAD at which to set the threshold
% output is:
% bc % matrix of baseline corrected intensities
%
% side effects:
% creates the collowing binary MATLAB (*.mat) files in the current directory
% baselineCorrected % the matrix bc
% noises % matrix of noise estimates
% normalized % matrix of normalized baselin corrected intensities
% meanBase % vector containing mean baseline corrected spectrum
% meanNorm % vector containing mean normalized spectrum
% peakLocations % matrix of peaks (uses trivialPeakFinder)
% numpeaks % vector of the number of peaks pe spectrum
% Copyright (c) 2003, 2004 UT M.D. Anderson Cancer Center. All rights reserved.
% See the accompanying file "license.txt" for details.
w = size(raw); % how much data are we handling?
n = floor(w(2)/2^L); % number of length 2^L pieces available
echo on
status = 'start baseline correction'
tic
echo off
%bc = repmat(0, [w(1) n*2^L]);
%noises = repmat(0, [w(1) n*2^L]);
bc = repmat(0, [w(1) w(2)]);
noises = repmat(0, [w(1) w(2)]);
for i = 1:w(1),
[b, s] = waveletSmoothAndBaselineCorrect(raw(i,:), thld, M, L);
bc(i,:) = b;
% noises(i, :) = raw(i, 1:(n*2^L)) - s;
noises(i, :) = raw(i, :) - s;
end
echo on
toc
status = 'end baseline correction'
echo off
lm = length(rawMass);
bc = bc(:, 1:lm);
noises = noises(:, 1:lm);
save baselineCorrected bc -V4
save noises noises -V4
sc = sum(bc(:, M:end)')';
nc = bc ./ repmat(sc, [1 lm]) * 10^4;
echo on
status = 'finished normalizing'
echo off
save normalized nc -V4
meanBase = mean(bc);
meanNorm = mean(nc);
save meanBase meanBase -V4
save meanNorm meanNorm -V4
echo on
status = 'start peak finding'
tic
echo off
peaks = repmat(0, [w(1) 1000]);
numpeaks = repmat(0, [w(1) 1]);
for i = 1:w(1),
i
to = trivialPeakFinder(nc(i,:));
numpeaks(i) = length(to);
if length(to) > 500,
to = to(1:500);
end
peaks(i, 1:length(to)) = to;
end
echo on
toc
peaks = peaks(:, 1:max(numpeaks));
status = 'end peak finding'
echo off
save peakLocations peaks -V4
save numpeaks numpeaks -V4