Learn R Programming

MALDIquant (version 1.1)

removeBaseline-methods: Removes the baseline of a MassSpectrum object.

Description

This method removes the baseline of mass spectrometry data (represented by a MassSpectrum object). The intensity of the mass spectrometry data would be reduced by baseline.

Usage

## S3 method for class 'MassSpectrum':
removeBaseline(object,
    fun,
    \dots)

Arguments

object
MassSpectrum object or a list of MassSpectrum objects.
fun
function, baseline estimation function. If no fun argument is given the baseline would be estimate automatically by calling est
...
arguments to be passed to fun or to estimateBaseline,MassSpectrum-method.

Value

  • Returns a modified MassSpectrum object with reduced intensities.

cr

## e.g. moving median baseline estimation estimateBaselineMovingMedian <- function(x, y, halfWindowSize=100) { if (halfWindowSize<1) {="" stop(squote("halfwindowsize"),="" "=", halfWindowSize, " is="" too="" small!");="" }="" m="" <-="" runmed(y,="" k="(2*halfWindowSize+1));

return(cbind(x, m)); }

Details

fun: A user-defined function to estimate the baseline 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

MassSpectrum, estimateBaseline,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);

## subtract baseline 
b <- removeBaseline(s);

## draw modified spectrum on the plot
lines(b, col="blue");

Run the code above in your browser using DataLab