Learn R Programming

MALDIquant (version 1.8)

.estimateBaselineSnip: Estimates the baseline by SNIP algorithm.

Description

This function estimates the baseline of mass spectrometry data. The baseline estimation is based on the Statistics-sensitive Non-linear Iterative Peak-clipping algorithm (SNIP) described in Ryan et al 1988. It is hidden by NAMESPACE because it is a private function and estimateBaseline,MassSpectrum-method should be used instead.

Usage

.estimateBaselineSnip(x, y, iterations=100, decreasing=TRUE)

Arguments

x
vector of x values (only needed to return a two-column matrix)
y
vector of y values
iterations
half window size The resulting window reaches from mass[cur_index-iterations] to mass[cur_index+iterations].
decreasing
use a decreasing (if FALSE an increasing) clipping window.

Value

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

Details

The algorithm based on the following equation: $$y_i(k) = \min { y_i, \frac{(y_{i-k}+y_{i+k})}{2} }$$

decreasing: In Morhac 2009 a decreasing clipping window is suggested to get a smoother baseline. For decreasing == TRUE (decreasing == FALSE) k=iterations is decreased (increased) by one until zero (iterations) is reached.

References

C.G. Ryan, E. Clayton, W.L. Griffin, S.H. Sie, and D.R. Cousens. 1988. Snip, a statistics-sensitive background treatment for the quantitative analysis of pixe spectra in geoscience applications. Nuclear Instruments and Methods in Physics Research Section B: Beam Interactions with Materials and Atoms, 34(3): 396-402.

M. Morhac. 2009. An algorithm for determination of peak regions and baseline elimination in spectroscopic data. Nuclear Instruments and Methods in Physics Research Section A: Accelerators, Spectrometers, Detectors and Associated Equipment, 600(2), 478-487.

See Also

MassSpectrum, estimateBaseline,MassSpectrum-method, removeBaseline,MassSpectrum-method

Examples

Run this code
## load package
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="SNIP", iterations=75)
b2 <- estimateBaseline(s, method="SNIP", iterations=150)

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

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

Run the code above in your browser using DataLab