Smooths 'MSnExp' or 'Spectrum' instances
smooth-methods.RdThis method smooths individual spectra (Spectrum instances)
or whole experiments (MSnExp instances).
Currently, the Savitzky-Golay-Smoothing (method = "SavitzkyGolay")
and the Moving-Average-Smoothing (method = "MovingAverage") are
available, as implemented in the MALDIquant::smoothIntensity function.
Additional methods might be added at a later stage.
Methods
signature(x = "MSnExp", method = "character", halfWindowSize = "integer", verbose = "logical", ...)-
Smooths all spectra in
MSnExp.methodcould be"SavitzkyGolay"or"MovingAverage"."halfWindowSize"controls the window size of the filter. The resulting window size is2 * halfWindowSize + 1. The best size differs depending on the selectedmethod. Formethod = "SavitzkyGolay"it should be lower than FWHM of the peaks (full width at half maximum; please find details in Bromba and Ziegler 1981). The arguments...are passed to the internal functions. Formethod="MovingAverage"there is an additionalweightedargument (default:FALSE) to indicate if the average should be equal weight (default) or if it should have weights depending on the distance from the center as calculated as1/2^abs(-halfWindowSize:halfWindowSize)with the sum of all weigths normalized to 1. Formethod="SavitzkyGolay"an additonal argument ispolynomialOrder(default: 3). It controls the polynomial order of the Savitzky-Golay Filter. This method displays a progress bar ifverbose = TRUE. Returns anMSnExpinstance with smoothed spectra. signature(x = "Spectrum", method = "character", halfWindowSize = "integer", ...)-
Smooths the spectrum (
Spectruminstance). This method is the same as above but returns a smoothedSpectruminstead of anMSnExpobject. It has noverboseargument. Please read the details for the aboveMSnExpmethod.
See also
clean, pickPeaks, removePeaks and
trimMz for other spectra processing methods.
References
A. Savitzky and M. J. Golay. 1964. Smoothing and differentiation of data by simplified least squares procedures. Analytical chemistry, 36(8), 1627-1639.
M. U. Bromba and H. Ziegler. 1981. Application hints for Savitzky-Golay digital smoothing filters. Analytical Chemistry, 53(11), 1583-1586.
S. Gibb and K. Strimmer. 2012. MALDIquant: a versatile R package for the analysis of mass spectrometry data. Bioinformatics 28: 2270-2271. http://strimmerlab.org/software/maldiquant/
Examples
sp1 <- new("Spectrum1",
intensity = c(1:6, 5:1),
mz = 1:11)
sp2 <- smooth(sp1, method = "MovingAverage", halfWindowSize = 2)
intensity(sp2)
#> [1] 3.0 3.0 3.0 4.0 4.6 4.8 4.6 4.0 3.0 3.0 3.0
data(itraqdata)
itraqdata2 <- smooth(itraqdata,
method = "MovingAverage",
halfWindowSize = 2)
processingData(itraqdata2)
#> - - - Processing information - - -
#> Data loaded: Wed May 11 18:54:39 2011
#> Updated from version 0.3.0 to 0.3.1 [Fri Jul 8 20:23:25 2016]
#> Spectra smoothed (MovingAverage): Tue Aug 26 11:39:14 2025
#> MSnbase version: 1.1.22