baseline | R Documentation |
This function perform baseline correction by wrapping around the methods
implemented on baselineCorrection
and baselineCorrectionQuant
.
baseline(ncdf, bsline_method = c('classic', 'quantiles', 'none'), ...)
ncdf |
A list containing the raw chromatogram data. The list can be generated by
|
bsline_method |
A string to select the baseline retention method. Options
are |
... |
Extra parameters to be passed to |
.
This is a wrapper function around the different baseline correction algorithms. It is not intended to be executed by the average user. Please refer to the respective man pages for details.
Returns a list with the same elements as the input, but the element "Peaks"
containing baseline corrected values.
Alvaro Cuadros-Inostroza
RIcorrect
, baselineCorrection
, baselineCorrectionQuant
# get a random sample CDF from TargetSearchData
require(TargetSearchData)
cdffile <- sample(tsd_cdffiles(), 1)
pdata <- peakCDFextraction(cdffile)
# restrict mass range to reduce computing time (not needed for
# actual data)
pdata$Peaks <- pdata$Peaks[, 1:10] ; pdata$massRange <- c(85, 94)
# make a fake baseline as constant + noise (the CDF files have been
# already baseline corrected by the vendor software).
nscans <- length(pdata$Time)
noise <- as.integer(1000 + rnorm(nscans, sd=5))
pdata$Peaks <- pdata$Peaks + noise
# use Classic and Quantile methods for baseline correction (def parameters)
pdata_c <- baseline(pdata, 'classic')
# use Quantile method
pdata_q <- baseline(pdata, 'quantiles')
# plot function to compare traces
plfun <- function(p, q, k, n, titl) {
plot(p$Time, p$Peaks[, k], col='blue', type='l', xlab='time', ylab='intensity')
lines(q$Time, q$Peaks[, k] - n, col='red')
legend('topleft', c('corrected', 'original'), col=c('blue', 'red'), lty=1, lwd=2)
title(paste('method:', titl))
}
op <- par(mfrow=c(2,2))
plfun(pdata_c, pdata, 1, noise, 'classic')
plfun(pdata_q, pdata, 1, noise, 'quantile')
plfun(pdata_c, pdata, 7, noise, 'classic')
plfun(pdata_q, pdata, 7, noise, 'quantile')
par(op)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.