msDetrend: Baseline Correction

Description Usage Arguments Value Note See Also Examples

Description

Estimate and subsequently subtract the baselines from mass spectra. The basic technique for baseline estimation is to fit a curve locally to the intensity minima.

Usage

1
2
3
msDetrend(x, FUN="loess",
    attach.base=TRUE,    
    event="Baseline Correction", ...)

Arguments

x

An object of class msSet.

...

Additional arguments for the FUN specified. See the specific underlying function for details.

FUN

Either an object of class "character" or of class "function".

character: A character string denoting the method to use in smoothing the data to estimate the baseline. Supported choices are

"loess"

uses the function loess.smooth to fit a local regression model to the local minima.

"spline"

uses the function spline to interpolate through the local minima by means of a cubic spline.

"supsmu"

uses the function supsmu to fit a smooth curve to the local minima.

"approx"

uses the function approx to linearly interpolate the local minima.

"monotone"

uses the function cummin to fit a non-increasing curve to all the intensity values.

"mrd"

uses the function msSmoothMRD to extract wavelet-based multiresolution decomposition components relevant to baseline trends.

Default: "loess".

function: A user-defined function with an argument list of the form (x, ...) where x is a required argument corresponding to a numeric vector (typically these values will be the noise estimates of a mass spectrum).

In either case, the additional arguments ... will be passed directly to the specified routine.

attach.base

A logical value specifying if the estimated baseline needs to be attached as an element to the output, and the default is T. It has to be T if you want to visualize the baseline.

event

A character string denoting the name of the event to register with the (embedded) event history object of the input after processing the input data. Default: "Baseline Correction".

Value

An object of class msSet, optionally, with the estimated baseline attached as element "baseline".

Note

If FUN="mrd", an mrd object containing meta information regarding the multiresolution decomposition is attached to the msSet output object for subsequent use by other MRD-based function calls such as msPeak(x, FUN="mrd", ...).

See Also

msSmoothLoess, msSmoothSpline, msSmoothSupsmu, msSmoothApprox, msSmoothMonotone, msSmoothMRD.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
if (!exists("qcset")) data("qcset", package="msProcess")

## extract several spectra from the build-in
## dataset
z <- qcset[, 1:8]

## denoising
z <- msDenoise(z, FUN="wavelet", n.level=10, thresh.scale=2)

## baseline subtraction
z <- msDetrend(z, FUN="monotone", attach=TRUE)

## visualize the baseline
plot(z, process="msDetrend", subset=1:3,
    xlim=c(5000, 8500), lty=1, lwd=c(1,3))

zeehio/msProcess documentation built on May 4, 2019, 10:15 p.m.