findPeaks-MSW {xcms} | R Documentation

## Single-spectrum non-chromatography MS data peak detection

### Description

Perform peak detection in mass spectrometry direct injection spectrum using a wavelet based algorithm.

The `MSWParam` class allows to specify all settings for a peak detection using the MSW method. Instances should be created with the `MSWParam` constructor.

The `findChromPeaks,OnDiskMSnExp,MSWParam` method performs peak detection in single-spectrum non-chromatography MS data using functionality from the `MassSpecWavelet` package on all samples from an `OnDiskMSnExp` object. `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.

`snthresh`,`snthresh<-`: getter and setter for the `snthresh` slot of the object.

`verboseColumns`,`verboseColumns<-`: getter and setter for the `verboseColumns` slot of the object.

`scales`,`scales<-`: getter and setter for the `scales` slot of the object.

`nearbyPeak`,`nearbyPeak<-`: getter and setter for the `nearbyPeak` slot of the object.

`peakScaleRange`,`peakScaleRange<-`: getter and setter for the `peakScaleRange` slot of the object.

`ampTh`,`ampTh<-`: getter and setter for the `ampTh` slot of the object.

`minNoiseLevel`,`minNoiseLevel<-`: getter and setter for the `minNoiseLevel` slot of the object.

`ridgeLength`,`ridgeLength<-`: getter and setter for the `ridgeLength` slot of the object.

`peakThr`,`peakThr<-`: getter and setter for the `peakThr` slot of the object.

`tuneIn`,`tuneIn<-`: getter and setter for the `tuneIn` slot of the object.

`addParams`,`addParams<-`: getter and setter for the `addParams` slot of the object. This slot stores optional additional parameters to be passed to the `identifyMajorPeaks` and `sav.gol` functions from the `MassSpecWavelet` package.

### Usage

    MSWParam(snthresh = 3, verboseColumns = FALSE, scales = c(1, seq(2,
      30, 2), seq(32, 64, 4)), nearbyPeak = TRUE, peakScaleRange = 5,
      ampTh = 0.01, minNoiseLevel = ampTh/snthresh, ridgeLength = 24,
      peakThr = NULL, tuneIn = FALSE, ...)

    ## S4 method for signature 'OnDiskMSnExp,MSWParam'
    findChromPeaks(object, param,
      BPPARAM = bpparam(), return.type = "XCMSnExp", msLevel = 1L)

    ## S4 method for signature 'MSWParam'
    show(object)

    ## S4 method for signature 'MSWParam'
    snthresh(object)

    ## S4 replacement method for signature 'MSWParam'
    snthresh(object) <- value

    ## S4 method for signature 'MSWParam'
    verboseColumns(object)

    ## S4 replacement method for signature 'MSWParam'
    verboseColumns(object) <- value

    ## S4 method for signature 'MSWParam'
    scales(object)

    ## S4 replacement method for signature 'MSWParam'
    scales(object) <- value

    ## S4 method for signature 'MSWParam'
    nearbyPeak(object)

    ## S4 replacement method for signature 'MSWParam'
    nearbyPeak(object) <- value

    ## S4 method for signature 'MSWParam'
    peakScaleRange(object)

    ## S4 replacement method for signature 'MSWParam'
    peakScaleRange(object) <- value

    ## S4 method for signature 'MSWParam'
    ampTh(object)

    ## S4 replacement method for signature 'MSWParam'
    ampTh(object) <- value

    ## S4 method for signature 'MSWParam'
    minNoiseLevel(object)

    ## S4 replacement method for signature 'MSWParam'
    minNoiseLevel(object) <- value

    ## S4 method for signature 'MSWParam'
    ridgeLength(object)

    ## S4 replacement method for signature 'MSWParam'
    ridgeLength(object) <- value

    ## S4 method for signature 'MSWParam'
    peakThr(object)

    ## S4 replacement method for signature 'MSWParam'
    peakThr(object) <- value

    ## S4 method for signature 'MSWParam'
    tuneIn(object)

    ## S4 replacement method for signature 'MSWParam'
    tuneIn(object) <- value

    ## S4 method for signature 'MSWParam'
    addParams(object)

    ## S4 replacement method for signature 'MSWParam'
    addParams(object) <- value

### Arguments

`snthresh` | `numeric(1)` defining the signal to noise ratio cutoff.
`verboseColumns` | `logical(1)` whether additional peak meta data columns should be returned.
`scales` | Numeric defining the scales of the continuous wavelet transform (CWT).
`nearbyPeak` | logical(1) whether to include nearby peaks of major peaks.
`peakScaleRange` | numeric(1) defining the scale range of the peak (larger than 5 by default).
`ampTh` | numeric(1) defining the minimum required relative amplitude of the peak (ratio of the maximum of CWT coefficients).
`minNoiseLevel` | numeric(1) defining the minimum noise level used in computing the SNR.
`ridgeLength` | numeric(1) defining the minimum highest scale of the peak in 2-D CWT coefficient matrix.
`peakThr` | numeric(1) with the minimum absolute intensity (above baseline) of peaks to be picked. If provided, the smoothing function `sav.gol` function (in the `MassSpecWavelet`) package is called to estimate the local intensity.
`tuneIn` | logical(1) whther to tune in the parameter estimation of the detected peaks.
`...` | Additional parameters to be passed to the `identifyMajorPeaks` and `sav.gol` functions from the `MassSpecWavelet` package.
`object` | For `findChromPeaks`: an `OnDiskMSnExp` object containing the MS- and all other experiment-relevant data. For all other methods: a parameter object.
`param` | An `MSWParam` object containing all settings for the algorithm.
`BPPARAM` | A parameter class specifying if and how parallel processing should be performed. It defaults to `bpparam`. See documentation of the `BiocParallel` for more details. If parallel processing is enabled, peak detection is performed in parallel on several of the input samples.
`return.type` | Character specifying what type of object the method should return. Can be either `"XCMSnExp"` (default), `"list"` or `"xcmsSet"`.
`msLevel` | `integer(1)` defining the MS level on which the peak detection should be performed. Defaults to `msLevel = 1`.
`value` | The value for the slot.

### Details

This is a wrapper for the peak picker in Bioconductor's `MassSpecWavelet` package calling `peakDetectionCWT` and `tuneInPeakInfo` functions. See the xcmsDirect vignette for more information.

Parallel processing (one process per sample) is supported and can be configured either by the `BPPARAM` parameter or by globally defining the parallel processing mode using the `register` method from the `BiocParallel` package.

### Value

The `MSWParam` function returns a `MSWParam` class instance with all of the settings specified for peak detection by the MSW method.

For `findChromPeaks`: if `return.type = "XCMSnExp"` an `XCMSnExp` object with the results of the peak detection. If `return.type = "list"` a list of length equal to the number of samples with matrices specifying the identified peaks. If `return.type = "xcmsSet"` an `xcmsSet` object with the results of the detection.

### Slots

`.__classVersion__,snthresh,verboseColumns,scales,nearbyPeak,peakScaleRange,ampTh,minNoiseLevel,ridgeLength,peakThr,tuneIn,addParams`

  See corresponding parameter above. `.__classVersion__` stores the version from the class. Slots values should exclusively be accessed via the corresponding getter and setter methods listed above.

### Note

These methods and classes are part of the updated and modernized `xcms` user interface which will eventually replace the `findPeaks` methods. It supports peak detection on `OnDiskMSnExp` objects (defined in the `MSnbase` package). All of the settings to the algorithm can be passed with a `MSWParam` object.

### Author(s)

Joachim Kutzera, Steffen Neumann, Johannes Rainer

### See Also

The `do_findPeaks_MSW` core API function and `findPeaks.MSW` for the old user interface.

`XCMSnExp` for the object containing the results of the peak detection.

Other peak detection methods: `chromatographic-peak-detection`, `findChromPeaks-centWaveWithPredIsoROIs`, `findChromPeaks-centWave`, `findChromPeaks-massifquant`, `findChromPeaks-matchedFilter`

### Examples

    ## Create a MSWParam object
    mp <- MSWParam()
    ## Change snthresh parameter
    snthresh(mp) <- 15
    mp

    ## Loading a small subset of direct injection, single spectrum files
    library(msdata)
    fticrf <- list.files(system.file("fticr", package = "msdata"),
                        recursive = TRUE, full.names = TRUE)
    fticr <- readMSData(fticrf[1:2], msLevel. = 1, mode = "onDisk")

    ## Perform the MSW peak detection on these:
    p <- MSWParam(scales = c(1, 7), peakThr = 80000, ampTh = 0.005,
                 SNR.method = "data.mean", winSize.noise = 500)
    fticr <- findChromPeaks(fticr, param = p)

    head(chromPeaks(fticr))

[Package xcms version 3.9.1 Index]