Learn R Programming

MALDIquant (version 1.7)

.estimateBaselineTopHat: Estimates the baseline by TopHat filter.

Description

This function estimates the baseline of mass spectrometry data. The baseline estimation is based on the TopHat filter. It is hidden by NAMESPACE because it is a private function and estimateBaseline,MassSpectrum-method should be used instead.

Usage

.estimateBaselineTopHat(x, y, halfWindowSize=100)

Arguments

x
vector of x values (only needed to return a two-column matrix)
y
vector of y values
halfWindowSize
half size of the moving window for the TopHat filter. (The resulting window reaches from mass[cur_index-halfWindowSize] to mass[cur_index+halfWindowSize].

Value

  • Returns a two column matrix (first column: mass, second column: intensity) of the estimated baseline.

References

M. van Herk. 1992. A Fast Algorithm for Local Minimum and Maximum Filters on Rectangular and Octagonal Kernels. Pattern Recognition Letters 13.7: 517-521.

J. Y. Gil and M. Werman. 1996. Computing 2-Dimensional Min, Median and Max Filters. IEEE Transactions: 504-507.

See Also

MassSpectrum, estimateBaseline,MassSpectrum-method, removeBaseline,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]]

## plot spectrum
plot(s)

## estimate baseline (try different parameters)
b1 <- estimateBaseline(s, method="TopHat", halfWindowSize=75)
b2 <- estimateBaseline(s, method="TopHat", halfWindowSize=150)

## draw baselines on the plot
lines(b1, col=2)
lines(b2, col=3)

## draw legend
legend(x="topright", lwd=1, legend=paste0("halfWindowSize=", c(75, 150)),
       col=c(2, 3))

Run the code above in your browser using DataLab