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
## S4 method for signature 'MassSpectrum'
detectPeaks(object,
halfWindowSize=20, method=c("MAD", "SuperSmoother"), SNR=2,
...)
## S4 method for signature 'list'
detectPeaks(object, ...)
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 be recognized as peak.
method
a noise estimation function; see
estimateNoise,MassSpectrum-method.
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
estimateNoise,MassSpectrum-method. If
object is a listmc.cores is also supported.
## load package
library("MALDIquant")
## load example data
data("fiedler2009subset", package="MALDIquant")
## choose only the first mass spectrum
s <- fiedler2009subset[[1]]
## transform intensities
s <- transformIntensity(s, method="sqrt")
## smoothing spectrum
s <- smoothIntensity(s, method="MovingAverage")
## 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)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(MALDIquant)
This is MALDIquant version 1.15
Quantitative Analysis of Mass Spectrometry Data
See '?MALDIquant' for more information about this package.
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MALDIquant/detectPeaks-methods.Rd_%03d_medium.png", width=480, height=480)
> ### Name: detectPeaks-methods
> ### Title: Detects peaks in a MassSpectrum object.
> ### Aliases: detectPeaks detectPeaks,MassSpectrum-method
> ### detectPeaks,list-method
> ### Keywords: methods
>
> ### ** Examples
>
> ## load package
> library("MALDIquant")
>
> ## load example data
> data("fiedler2009subset", package="MALDIquant")
>
> ## choose only the first mass spectrum
> s <- fiedler2009subset[[1]]
>
> ## transform intensities
> s <- transformIntensity(s, method="sqrt")
>
> ## smoothing spectrum
> s <- smoothIntensity(s, method="MovingAverage")
>
> ## 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)
>
>
>
>
>
> dev.off()
null device
1
>