mslowess

Smooth mass spectrum using nonparametric method

Syntax

Yout = mslowess(MZ, Y, 'PropertyName', PropertyValue...)
mslowess(..., 'Order', OrderValue)
mslowess(..., 'Span', SpanValue)
mslowess(..., 'Kernel', KernelValue)
mslowess(..., 'RobustIterations', RobustIterationsValue)
mslowess(..., 'ShowPlot', ShowPlotValue)

Arguments

MZ

Mass/charge vector with the range of ions in the spectra.

Y

Ion intensity vector with the same length as the mass/charge vector (MZ). Y can also be a matrix with several spectra that share the same mass/charge (MZ) range.

Description

Yout = mslowess(MZ, Y, 'PropertyName', PropertyValue...) smoothes a mass spectrum (Y) using a locally weighted linear regression (lowess) method with a default span of 10 samples.

mslowess(..., 'Order', OrderValue) specifies the order (OrderValue) of the Lowess smoother. Enter 1 (linear polynomial fit or Lowess), 2 (quadratic polynomial fit or Loess), or 0 (equivalent to a weighted local mean estimator and presumably faster because only a mean computation is performed instead of a least squares regression). The default value is 1.

mslowess(..., 'Span', SpanValue) specifies the window size for the smoothing kernel. If SpanValue is greater than 1, the window is equal to SpanValue number of samples independent of the mass/charge vector (MZ). The default value is 10 samples. Higher values will smooth the signal more at the expense of computation time. If SpanValue is less than 1, the window size is taken to be a fraction of the number of points in the data. For example, when SpanValue is 0.005, the window size is equal to 0.50% of the number of points in MZ.

mslowess(..., 'Kernel', KernelValue) selects the function (KernelValue) for weighting the observed ion intensities. Samples close to the MZ location being smoothed have the most weight in determining the estimate. Enter

'tricubic' (default)    (1 - (dist/dmax).^3).^3  
'gaussian'              exp(-(2*dist/dmax).^2)
'linear'                1-dist/dmax

mslowess(..., 'RobustIterations', RobustIterationsValue) specifies the number of iterations (RobustValue) for a robust fit. If RobustIterationsValue is 0 (default), no robust fit is performed. For robust smoothing, small residual values at every span are outweighed to improve the new estimate. 1 or 2 robust iterations are usually adequate while, larger values might be computationally expensive.

mslowess(..., 'ShowPlot', ShowPlotValue)plots the smoothed spectrum over the original spectrum. When mslowess is called without output arguments, the spectra are plotted unless ShowPlotValue is false. When ShowPlotValue is true, only the first spectrum in Y is plotted. ShowPlotValue can also contain an index to one of the spectra in Y.

Example

  1. Load sample data.

    load sample_lo_res
  2. Smooth spectrum and draw figure with unsmoothed and smoothed spectra.

    YS = mslowess(MZ_lo_res,Y_lo_res(:,1),'Showplot',true);

See Also

Bioinformatic Toolbox functions msalign, msbackadj, msheatmap, msnorm, msresample, mssgolay, msviewer


© 1994-2005 The MathWorks, Inc.