findChromPeaks-matchedFilter: Peak detection in the chromatographic time domain

findChromPeaks-matchedFilterR Documentation

Peak detection in the chromatographic time domain


The matchedFilter algorithm identifies peaks in the chromatographic time domain as described in [Smith 2006]. The intensity values are binned by cutting The LC/MS data into slices (bins) of a mass unit (binSize m/z) wide. Within each bin the maximal intensity is selected. The chromatographic peak detection is then performed in each bin by extending it based on the steps parameter to generate slices comprising bins current_bin - steps +1 to current_bin + steps - 1. Each of these slices is then filtered with matched filtration using a second-derative Gaussian as the model peak shape. After filtration peaks are detected using a signal-to-ratio cut-off. For more details and illustrations see [Smith 2006].

The MatchedFilterParam class allows to specify all settings for a chromatographic peak detection using the matchedFilter method. Instances should be created with the MatchedFilterParam constructor.

The findChromPeaks,OnDiskMSnExp,MatchedFilterParam method performs peak detection using the matchedFilter algorithm 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.

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

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

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

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

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

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

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

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

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

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

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


  binSize = 0.1,
  impute = "none",
  baseValue = numeric(),
  distance = numeric(),
  fwhm = 30,
  sigma = fwhm/2.3548,
  max = 5,
  snthresh = 10,
  steps = 2,
  mzdiff = 0.8 - binSize * steps,
  index = FALSE

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

## S4 method for signature 'MatchedFilterParam'

## S4 replacement method for signature 'MatchedFilterParam'
binSize(object) <- value

## S4 method for signature 'MatchedFilterParam'

## S4 replacement method for signature 'MatchedFilterParam'
impute(object) <- value

## S4 method for signature 'MatchedFilterParam'

## S4 replacement method for signature 'MatchedFilterParam'
baseValue(object) <- value

## S4 method for signature 'MatchedFilterParam'

## S4 replacement method for signature 'MatchedFilterParam'
distance(object) <- value

## S4 method for signature 'MatchedFilterParam'

## S4 replacement method for signature 'MatchedFilterParam'
fwhm(object) <- value

## S4 method for signature 'MatchedFilterParam'

## S4 replacement method for signature 'MatchedFilterParam'
sigma(object) <- value

## S4 method for signature 'MatchedFilterParam'

## S4 replacement method for signature 'MatchedFilterParam'
max(object) <- value

## S4 method for signature 'MatchedFilterParam'

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

## S4 method for signature 'MatchedFilterParam'

## S4 replacement method for signature 'MatchedFilterParam'
steps(object) <- value

## S4 method for signature 'MatchedFilterParam'

## S4 replacement method for signature 'MatchedFilterParam'
mzdiff(object) <- value

## S4 method for signature 'MatchedFilterParam'

## S4 replacement method for signature 'MatchedFilterParam'
index(object) <- value



numeric(1) specifying the width of the bins/slices in m/z dimension.


Character string specifying the method to be used for missing value imputation. Allowed values are "none" (no linear interpolation), "lin" (linear interpolation), "linbase" (linear interpolation within a certain bin-neighborhood) and "intlin". See imputeLinInterpol for more details.


The base value to which empty elements should be set. This is only considered for method = "linbase" and corresponds to the profBinLinBase's baselevel argument.


For method = "linbase": number of non-empty neighboring element of an empty element that should be considered for linear interpolation. See details section for more information.


numeric(1) specifying the full width at half maximum of matched filtration gaussian model peak. Only used to calculate the actual sigma, see below.


numeric(1) specifying the standard deviation (width) of the matched filtration model peak.


numeric(1) representing the maximum number of peaks that are expected/will be identified per slice.


numeric(1) defining the signal to noise cutoff to be used in the chromatographic peak detection step.


numeric(1) defining the number of bins to be merged before filtration (i.e. the number of neighboring bins that will be joined to the slice in which filtration and peak detection will be performed).


numeric(1) defining the minimum difference in m/z for peaks with overlapping retention times


logical(1) specifying whether indicies should be returned instead of values for m/z and retention times.


For findChromPeaks: an OnDiskMSnExp object containing the MS- and all other experiment-relevant data.

For all other methods: a parameter object.


An MatchedFilterParam object containing all settings for the matchedFilter algorithm.


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.


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


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




The value for the slot.


For max: a MatchedFilterParam object.


The intensities are binned by the provided m/z values within each spectrum (scan). Binning is performed such that the bins are centered around the m/z values (i.e. the first bin includes all m/z values between min(mz) - bin_size/2 and min(mz) + bin_size/2).

For more details on binning and missing value imputation see binYonX and imputeLinInterpol methods.

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.


The MatchedFilterParam function returns a MatchedFilterParam class instance with all of the settings specified for chromatographic detection by the matchedFilter 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 peak detection.



See corresponding parameter above. Slots values should exclusively be accessed via the corresponding getter and setter methods listed above.


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


Colin A Smith, Johannes Rainer


Colin A. Smith, Elizabeth J. Want, Grace O'Maille, Ruben Abagyan and Gary Siuzdak. "XCMS: Processing Mass Spectrometry Data for Metabolite Profiling Using Nonlinear Peak Alignment, Matching, and Identification" Anal. Chem. 2006, 78:779-787.

See Also

The do_findChromPeaks_matchedFilter core API function and findPeaks.matchedFilter for the old user interface.

peaksWithMatchedFilter for functions to perform matchedFilter peak detection in purely chromatographic data.

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

Other peak detection methods: findChromPeaks(), findChromPeaks-centWave, findChromPeaks-centWaveWithPredIsoROIs, findChromPeaks-massifquant, findPeaks-MSW


## Create a MatchedFilterParam object. Note that we use a unnecessarily large
## binSize parameter to reduce the run-time of the example.
mfp <- MatchedFilterParam(binSize = 5)
## Change snthresh parameter
snthresh(mfp) <- 15

## Perform the peak detection using matchecFilter on the files from the
## faahKO package. Files are read using the readMSData from the MSnbase
## package
fls <- dir(system.file("cdf/KO", package = "faahKO"), recursive = TRUE,
           full.names = TRUE)
raw_data <- readMSData(fls[1], mode = "onDisk")
## Perform the chromatographic peak detection using the settings defined
## above. Note that we are also disabling parallel processing in this
## example by registering a "SerialParam"
res <- findChromPeaks(raw_data, param = mfp)

sneumann/xcms documentation built on June 5, 2024, 4:28 p.m.