Learn R Programming

MALDIquant (version 0.2)

.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,SingleSpectrum-method should be used instead.

Usage

.estimateBaselineSnip(x, y, iterations=100)

Arguments

x
vector of x values (only needed to return a two-column matrix)
y
vector of y values
iterations
maximal window size

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} }$$ Where k is increase by one until iterations is reached.

References

C.G. Ryan, E. Clayton, W.L. Griffin, S.H. Sie, and D.R. Cousens. 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, 1988. ISSN 0168-583X. doi:10.1016/0168-583X(88)90063-8. http://www.sciencedirect.com/science/article/B6TJN-46YSYTJ-30/2/e0d015ceb8ea8a7bc0702a857a19750b

See Also

SingleSpectrum, estimateBaseline,SingleSpectrum-method, removeBaseline,SingleSpectrum-method

Examples

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

## load readBrukerFlexData library for fid file import 
## (is also done automatically by importSingleSpectrum)
library("readBrukerFlexData");

## get examples directory
exampleDirectory <- system.file("Examples", package="readBrukerFlexData");

## read example spectrum
s <- importSingleSpectrum(file.path(exampleDirectory,
    "2010_05_19_Gibb_C8_A1/0_A1/1/1SLin/fid"));

## 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=paste("iterations=", c(75, 150), sep=""), 
    col=c(2, 3));

Run the code above in your browser using DataLab