Learn R Programming

MALDIquant (version 1.3)

detectPeaks-methods: Detects peaks in a MassSpectrum object.

Description

This method looks for peaks in mass spectrometry data (represented by a MassSpectrum object). A peak is a local maximum above a user defined noise threshold.

Usage

## S3 method for class 'MassSpectrum':
detectPeaks(object,
    halfWindowSize=20, fun, SNR=2,
    \dots)

Arguments

object
MassSpectrum object or a list of MassSpectrum objects.
halfWindowSize
numeric, half window size. The resulting window reaches from mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize]. A local maximum have to be the highest one in the given window to
fun
function, noise estimation function. If no fun argument is given the noise would be estimated automatically by calling estimateNoise,MassSp
SNR
single numeric value. SNR is an abbreviation for signal-to-noise-ratio. A local maximum has to be higher than SNR*noise to be recognize as peak.
...
arguments to be passed to fun

Value

  • Returns a MassPeaks object.

cr

## e.g. estimate noise using Friedman's 'super smoother' estimateNoiseSuperSmoother <- function(x, y, ...) { s <- supsmu(x=x, y=y, ...);

return(cbind(x, s$y)); }

Details

fun: A user-defined function to estimate the noise of a MassSpectrum object. At least three arguments are needed:
  • x:double, the mass of theMassSpectrumobject.
y: double, the intensity of the MassSpectrum object. ...: further arguments

References

See website: http://strimmerlab.org/software/maldiquant/

See Also

MassPeaks, MassSpectrum, estimateNoise,MassSpectrum-method

Examples

Run this code
## load library
library("MALDIquant");

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

## choose only the first mass spectrum
s <- fiedler2009subset[[1]];

## transform intensities
s <- transformIntensity(s, sqrt);

## remove baseline
s <- removeBaseline(s);

## plot spectrum
plot(s);

## call peak detection
p <- detectPeaks(s);

## draw peaks on the plot
points(p);

## label 10 highest peaks
top10 <- intensity(p) %in% sort(intensity(p), decreasing=TRUE)[1:10];
labelPeaks(p, index=top10);

Run the code above in your browser using DataLab