Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

smoothIntensity-methods

Smoothes intensities of a MassSpectrum object.


Description

This method smoothes the intensity values of a MassSpectrum object.

Usage

## S4 method for signature 'MassSpectrum'
smoothIntensity(object,
  method=c("SavitzkyGolay", "MovingAverage"), halfWindowSize,
  ...)

Arguments

object

AbstractMassObject object or a list of AbstractMassObject objects.

method

used smoothing method, one of "SavitzkyGolay" or "MovingAverage".

halfWindowSize

half window size. The resulting window reaches from mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize] (window size is 2*halfWindowSize+1). The best size differs depending on the selected method.

...

arguments to be passed to method. SavitzkyGolay has an additional polynomialOrder argument (default: 3) to control the order of the filter. MovingAverage has an additional weighted argument (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 as 1/2^abs(-halfWindowSize:halfWindowSize) with the sum of all weigths normalized to 1.

Details

halfWindowSize: Depends on the selected method. For the SavitzkyGolay the halfWindowSize should be smaller than FWHM of the peaks (full width at half maximum; please find details in Bromba and Ziegler 1981). In general the halfWindowSize for the MovingAverage has to be much smaller than for SavitzkyGolay to conserve the peak shape.

Author(s)

Sebastian Gibb mail@sebastiangibb.de

Weighted moving average: Sigurdur Smarason

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.

See Also

Examples

## load package
library("MALDIquant")

## load example data
data("fiedler2009subset", package="MALDIquant")

## smooth spectra
s <- smoothIntensity(fiedler2009subset, method="MovingAverage",
                     halfWindowSize=2)
## or
s <- smoothIntensity(fiedler2009subset, method="MovingAverage",
                     halfWindowSize=2, weighted=TRUE)
## or
s <- smoothIntensity(fiedler2009subset, method="SavitzkyGolay",
                     halfWindowSize=10)

MALDIquant

Quantitative Analysis of Mass Spectrometry Data

v1.19.3
GPL (>= 3)
Authors
Sebastian Gibb [aut, cre] (<https://orcid.org/0000-0001-7406-4443>), Korbinian Strimmer [ths] (<https://orcid.org/0000-0001-7917-2056>)
Initial release
2019-05-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.