% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/DataClasses.R, R/functions-Params.R,
%   R/methods-OnDiskMSnExp.R, R/methods-Params.R
\docType{class}
\name{findChromPeaks-centWave}
\alias{findChromPeaks-centWave}
\alias{centWave}
\alias{CentWaveParam-class}
\alias{CentWaveParam}
\alias{findChromPeaks,OnDiskMSnExp,CentWaveParam-method}
\alias{show,CentWaveParam-method}
\alias{ppm,CentWaveParam-method}
\alias{ppm}
\alias{ppm<-,CentWaveParam-method}
\alias{ppm<-}
\alias{peakwidth,CentWaveParam-method}
\alias{peakwidth}
\alias{peakwidth<-,CentWaveParam-method}
\alias{peakwidth<-}
\alias{snthresh,CentWaveParam-method}
\alias{snthresh}
\alias{snthresh<-,CentWaveParam-method}
\alias{snthresh<-}
\alias{prefilter,CentWaveParam-method}
\alias{prefilter}
\alias{prefilter<-,CentWaveParam-method}
\alias{prefilter<-}
\alias{mzCenterFun,CentWaveParam-method}
\alias{mzCenterFun}
\alias{mzCenterFun<-,CentWaveParam-method}
\alias{mzCenterFun<-}
\alias{integrate,CentWaveParam-method}
\alias{integrate<-,CentWaveParam-method}
\alias{integrate<-}
\alias{mzdiff,CentWaveParam-method}
\alias{mzdiff}
\alias{mzdiff<-,CentWaveParam-method}
\alias{mzdiff<-}
\alias{fitgauss,CentWaveParam-method}
\alias{fitgauss}
\alias{fitgauss<-,CentWaveParam-method}
\alias{fitgauss<-}
\alias{noise,CentWaveParam-method}
\alias{noise}
\alias{noise<-,CentWaveParam-method}
\alias{noise<-}
\alias{verboseColumns,CentWaveParam-method}
\alias{verboseColumns}
\alias{verboseColumns<-,CentWaveParam-method}
\alias{verboseColumns<-}
\alias{roiList,CentWaveParam-method}
\alias{roiList}
\alias{roiList<-,CentWaveParam-method}
\alias{roiList<-}
\alias{firstBaselineCheck,CentWaveParam-method}
\alias{firstBaselineCheck}
\alias{firstBaselineCheck<-,CentWaveParam-method}
\alias{firstBaselineCheck<-}
\alias{roiScales,CentWaveParam-method}
\alias{roiScales}
\alias{roiScales<-,CentWaveParam-method}
\alias{roiScales<-}
\title{Chromatographic peak detection using the centWave method}
\usage{
CentWaveParam(ppm = 25, peakwidth = c(20, 50), snthresh = 10,
  prefilter = c(3, 100), mzCenterFun = "wMean", integrate = 1L,
  mzdiff = -0.001, fitgauss = FALSE, noise = 0,
  verboseColumns = FALSE, roiList = list(),
  firstBaselineCheck = TRUE, roiScales = numeric())

\S4method{findChromPeaks}{OnDiskMSnExp,CentWaveParam}(object, param,
  BPPARAM = bpparam(), return.type = "XCMSnExp", msLevel = 1L)

\S4method{show}{CentWaveParam}(object)

\S4method{ppm}{CentWaveParam}(object)

\S4method{ppm}{CentWaveParam}(object) <- value

\S4method{peakwidth}{CentWaveParam}(object)

\S4method{peakwidth}{CentWaveParam}(object) <- value

\S4method{snthresh}{CentWaveParam}(object)

\S4method{snthresh}{CentWaveParam}(object) <- value

\S4method{prefilter}{CentWaveParam}(object)

\S4method{prefilter}{CentWaveParam}(object) <- value

\S4method{mzCenterFun}{CentWaveParam}(object)

\S4method{mzCenterFun}{CentWaveParam}(object) <- value

\S4method{integrate}{CentWaveParam}(f)

\S4method{integrate}{CentWaveParam}(object) <- value

\S4method{mzdiff}{CentWaveParam}(object)

\S4method{mzdiff}{CentWaveParam}(object) <- value

\S4method{fitgauss}{CentWaveParam}(object)

\S4method{fitgauss}{CentWaveParam}(object) <- value

\S4method{noise}{CentWaveParam}(object)

\S4method{noise}{CentWaveParam}(object) <- value

\S4method{verboseColumns}{CentWaveParam}(object)

\S4method{verboseColumns}{CentWaveParam}(object) <- value

\S4method{roiList}{CentWaveParam}(object)

\S4method{roiList}{CentWaveParam}(object) <- value

\S4method{firstBaselineCheck}{CentWaveParam}(object)

\S4method{firstBaselineCheck}{CentWaveParam}(object) <- value

\S4method{roiScales}{CentWaveParam}(object)

\S4method{roiScales}{CentWaveParam}(object) <- value
}
\arguments{
\item{ppm}{\code{numeric(1)} defining the maximal tolerated m/z deviation in
consecutive scans in parts per million (ppm) for the initial ROI
definition.}

\item{peakwidth}{\code{numeric(2)} with the expected approximate
peak width in chromatographic space. Given as a range (min, max)
in seconds.}

\item{snthresh}{\code{numeric(1)} defining the signal to noise ratio cutoff.}

\item{prefilter}{\code{numeric(2)}: \code{c(k, I)} specifying the prefilter
step for the first analysis step (ROI detection). Mass traces are only
retained if they contain at least \code{k} peaks with intensity
\code{>= I}.}

\item{mzCenterFun}{Name of the function to calculate the m/z center of the
chromatographic peak. Allowed are: \code{"wMean"}: intensity weighted
mean of the peak's m/z values, \code{"mean"}: mean of the peak's m/z
values, \code{"apex"}: use the m/z value at the peak apex,
\code{"wMeanApex3"}: intensity weighted mean of the m/z value at the
peak apex and the m/z values left and right of it and \code{"meanApex3"}:
mean of the m/z value of the peak apex and the m/z values left and right
of it.}

\item{integrate}{Integration method. For \code{integrate = 1} peak limits
are found through descent on the mexican hat filtered data, for
\code{integrate = 2} the descent is done on the real data. The latter
method is more accurate but prone to noise, while the former is more
robust, but less exact.}

\item{mzdiff}{\code{numeric(1)} representing the minimum difference in m/z
dimension required for peaks with overlapping retention times; can be
negative to allow overlap. During peak post-processing, peaks
defined to be overlapping are reduced to the one peak with the largest
signal.}

\item{fitgauss}{\code{logical(1)} whether or not a Gaussian should be fitted
to each peak. This affects mostly the retention time position of the
peak.}

\item{noise}{\code{numeric(1)} allowing to set a minimum intensity required
for centroids to be considered in the first analysis step (centroids with
intensity \code{< noise} are omitted from ROI detection).}

\item{verboseColumns}{\code{logical(1)} whether additional peak meta data
columns should be returned.}

\item{roiList}{An optional list of regions-of-interest (ROI) representing
detected mass traces. If ROIs are submitted the first analysis step is
omitted and chromatographic peak detection is performed on the submitted
ROIs. Each ROI is expected to have the following elements specified:
\code{scmin} (start scan index), \code{scmax} (end scan index),
\code{mzmin} (minimum m/z), \code{mzmax} (maximum m/z), \code{length}
(number of scans), \code{intensity} (summed intensity). Each ROI should
be represented by a \code{list} of elements or a single row
\code{data.frame}.}

\item{firstBaselineCheck}{\code{logical(1)}. If \code{TRUE} continuous
data within regions of interest is checked to be above the first baseline.}

\item{roiScales}{Optional numeric vector with length equal to \code{roiList}
defining the scale for each region of interest in \code{roiList} that
should be used for the centWave-wavelets.}

\item{object}{For \code{findChromPeaks}: an
    \code{\link{OnDiskMSnExp}}  object containing the MS- and all
    other experiment-relevant data.

    For all other methods: a parameter object.}

\item{param}{An \code{CentWaveParam} object containing all settings for the
centWave algorithm.}

\item{BPPARAM}{A parameter class specifying if and how parallel processing
should be performed. It defaults to \code{\link{bpparam}}.
See documentation of the \code{BiocParallel} for more details. If
parallel processing is enabled, peak detection is performed in parallel
on several of the input samples.}

\item{return.type}{Character specifying what type of object the method should
return. Can be either \code{"XCMSnExp"} (default), \code{"list"} or
\code{"xcmsSet"}.}

\item{msLevel}{\code{integer(1)} defining the MS level on which the peak
detection should be performed. Defaults to \code{msLevel = 1}.}

\item{value}{The value for the slot.}

\item{f}{For \code{integrate}: a \code{CentWaveParam} object.}
}
\value{
The \code{CentWaveParam} function returns a \code{CentWaveParam}
    class instance with all of the settings specified for chromatographic
    peak detection by the centWave method.

For \code{findChromPeaks}: if \code{return.type = "XCMSnExp"} an
    \code{\link{XCMSnExp}} object with the results of the peak detection.
    If \code{return.type = "list"} a list of length equal to the number of
    samples with matrices specifying the identified peaks.
    If \code{return.type = "xcmsSet"} an \code{\linkS4class{xcmsSet}} object
    with the results of the peak detection.
}
\description{
The centWave algorithm perform peak density and wavelet based
    chromatographic peak detection for high resolution LC/MS data in centroid
    mode [Tautenhahn 2008].

The \code{CentWaveParam} class allows to specify all settings
    for a chromatographic peak detection using the centWave method. Instances
    should be created with the \code{CentWaveParam} constructor.

The \code{detectChromPeaks,OnDiskMSnExp,CentWaveParam} method
    performs chromatographic peak detection using the \emph{centWave}
    algorithm on all samples from an \code{\link{OnDiskMSnExp}}
    object. \code{\link{OnDiskMSnExp}} objects encapsule all
    experiment specific data and load the spectra data (mz and intensity
    values) on the fly from the original files applying also all eventual
    data manipulations.

\code{ppm},\code{ppm<-}: getter and setter for the \code{ppm}
    slot of the object.

\code{peakwidth},\code{peakwidth<-}: getter and setter for the
    \code{peakwidth} slot of the object.

\code{snthresh},\code{snthresh<-}: getter and setter for the
    \code{snthresh} slot of the object.

\code{prefilter},\code{prefilter<-}: getter and setter for the
    \code{prefilter} slot of the object.

\code{mzCenterFun},\code{mzCenterFun<-}: getter and setter for the
    \code{mzCenterFun} slot of the object.

\code{integrate},\code{integrate<-}: getter and setter for the
    \code{integrate} slot of the object.

\code{mzdiff},\code{mzdiff<-}: getter and setter for the
    \code{mzdiff} slot of the object.

\code{fitgauss},\code{fitgauss<-}: getter and setter for the
    \code{fitgauss} slot of the object.

\code{noise},\code{noise<-}: getter and setter for the
    \code{noise} slot of the object.

\code{verboseColumns},\code{verboseColumns<-}: getter and
    setter for the \code{verboseColumns} slot of the object.

\code{roiList},\code{roiList<-}: getter and setter for the
    \code{roiList} slot of the object.

\code{fistBaselineCheck},\code{firstBaselineCheck<-}: getter
    and setter for the \code{firstBaselineCheck} slot of the object.

\code{roiScales},\code{roiScales<-}: getter and setter for the
    \code{roiScales} slot of the object.
}
\details{
The centWave algorithm is most suitable for high resolution
LC/\{TOF,OrbiTrap,FTICR\}-MS data in centroid mode. In the first phase
the method identifies \emph{regions of interest} (ROIs) representing
mass traces that are characterized as regions with less than \code{ppm}
m/z deviation in consecutive scans in the LC/MS map. In detail, starting
with a single m/z, a ROI is extended if a m/z can be found in the next scan
(spectrum) for which the difference to the mean m/z of the ROI is smaller
than the user defined \code{ppm} of the m/z. The mean m/z of the ROI is then
updated considering also the newly included m/z value.

These ROIs are then, after some cleanup, analyzed using continuous wavelet
transform (CWT) to locate chromatographic peaks on different scales.
The first analysis step is skipped, if regions of interest are passed
\emph{via} the \code{param} parameter.

Parallel processing (one process per sample) is supported and can
    be configured either by the \code{BPPARAM} parameter or by globally
    defining the parallel processing mode using the
    \code{\link{register}} method from the \code{BiocParallel}
    package.
}
\section{Slots}{

\describe{
\item{\code{.__classVersion__,ppm,peakwidth,snthresh,prefilter,mzCenterFun,integrate,mzdiff,fitgauss,noise,verboseColumns,roiList,firstBaselineCheck,roiScales}}{See corresponding parameter above. \code{.__classVersion__} stores
the version from the class. Slots values should exclusively be accessed
\emph{via} the corresponding getter and setter methods listed above.}
}}

\note{
These methods and classes are part of the updated and modernized
    \code{xcms} user interface which will eventually replace the
    \code{\link{findPeaks}} methods. It supports peak detection on
    \code{\link{OnDiskMSnExp}} objects (defined in the \code{MSnbase}
    package). All of the settings to the centWave algorithm can be passed
    with a \code{CentWaveParam} object.
}
\examples{

## Create a CentWaveParam object. Note that the noise is set to 10000 to
## speed up the execution of the example - in a real use case the default
## value should be used, or it should be set to a reasonable value.
cwp <- CentWaveParam(ppm = 20, noise = 10000)
## Change snthresh parameter
snthresh(cwp) <- 25
cwp

## Perform the peak detection using centWave on some of the files from the
## faahKO package. Files are read using the readMSData from the MSnbase
## package
library(faahKO)
library(xcms)
fls <- dir(system.file("cdf/KO", package = "faahKO"), recursive = TRUE,
           full.names = TRUE)
raw_data <- readMSData(fls[1:2], mode = "onDisk")

## Perform the peak detection using the settings defined above.
res <- findChromPeaks(raw_data, param = cwp)
head(chromPeaks(res))
}
\references{
Ralf Tautenhahn, Christoph B\"{o}ttcher, and Steffen Neumann "Highly
sensitive feature detection for high resolution LC/MS" \emph{BMC Bioinformatics}
2008, 9:504
}
\seealso{
The \code{\link{do_findChromPeaks_centWave}} core API function and
\code{\link{findPeaks.centWave}} for the old user interface.

\code{\link{peaksWithCentWave}} for functions to perform centWave peak
detection in purely chromatographic data.

\code{\link{XCMSnExp}} for the object containing the results of
    the peak detection.

Other peak detection methods: \code{\link{chromatographic-peak-detection}},
  \code{\link{findChromPeaks-centWaveWithPredIsoROIs}},
  \code{\link{findChromPeaks-massifquant}},
  \code{\link{findChromPeaks-matchedFilter}},
  \code{\link{findPeaks-MSW}}
}
\author{
Ralf Tautenhahn, Johannes Rainer
}
\concept{peak detection methods}
