recalibrate {RMassBank} | R Documentation |
Predefined fits to use for recalibration: Loess fit and GAM fit.
recalibrate.loess(rcdata) recalibrate.identity(rcdata) recalibrate.mean(rcdata) recalibrate.linear(rcdata)
rcdata |
A data frame with at least the columns |
recalibrate.loess()
provides a Loess fit (recalibrate.loess
)
to a given recalibration parameter.
If MS and MS/MS data should be fit together, recalibrate.loess
provides good default settings for Orbitrap instruments.
recalibrate.identity()
returns a non-recalibration, i.e. a predictor
which predicts 0 for all input values. This can be used if the user wants to
skip recalibration in the RMassBank workflow.
#' recalibrate.mean()
and recalibrate.linear()
are simple recalibrations
which return a constant shift or a linear recalibration. They will be only useful
in particular cases.
recalibrate()
itself is only a dummy function and does not do anything.
Alternatively other functions can be defined. Which functions are used for recalibration
is specified by the RMassBank options file. (Note: if recalibrateMS1: common
, the
recalibrator: MS1
value is irrelevant, since for a common curve generated with
the function specified in recalibrator: MS2
will be used.)
Returns a model for recalibration to be used with predict
and the like.
Michael Stravs, EAWAG <michael.stravs@eawag.ch>
## Not run: rcdata <- subset(spec$peaksMatched, formulaCount==1) ms1data <- recalibrate.addMS1data(spec, mode, 15) rcdata <- rbind(rcdata, ms1data) rcdata$recalfield <- rcdata$dppm rcCurve <- recalibrate.loess(rcdata) # define a spectrum and recalibrate it s <- matrix(c(100,150,200,88.8887,95.0005,222.2223), ncol=2) colnames(s) <- c("mz", "int") recalS <- recalibrateSingleSpec(s, rcCurve) Alternative: define an custom recalibrator function with different parameters recalibrate.MyOwnLoess <- function(rcdata) { return(loess(recalfield ~ mzFound, data=rcdata, family=c("symmetric"), degree = 2, span=0.4)) } # This can then be specified in the RMassBank settings file: # recalibrateMS1: common # recalibrator: # MS1: recalibrate.loess # MS2: recalibrate.MyOwnLoess") # [...] ## End(Not run)