chromPeakSpectra: Extract (MS2) spectra associated with chromatographic peaks

Description Usage Arguments Value Author(s) Examples

View source: R/functions-XCMSnExp.R

Description

Extract (MS2) spectra from an XCMSnExp object that represent ions within the rt and m/z range of each chromatographic peak (in the same file /sample in which the peak was detected). All MS2 spectra are returned for chromatographic peak i for which the precursor m/z is >= chromPeaks(x)[i, "mzmin"] and <= chromPeaks(x)[i, "mzmax"] and the retention time is >= chromPeaks(x)[i, "rtmin"] and <= chromPeaks(x)[i, "rtmax"].

See also the LC-MS/MS data analysis vignette for more details and examples.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
chromPeakSpectra(
  x,
  msLevel = 2L,
  expandRt = 0,
  expandMz = 0,
  ppm = 0,
  method = c("all", "closest_rt", "closest_mz", "signal"),
  skipFilled = FALSE,
  return.type = c("Spectra", "list")
)

Arguments

x

XCMSnExp object with identified chromatographic peaks.

msLevel

integer(1) defining whether MS1 or MS2 spectra should be returned. Currently only msLevel = 2 is supported.

expandRt

numeric(1) to expand the retention time range of each peak by a constant value on each side.

expandMz

numeric(1) to expand the m/z range of each peak by a constant value on each side.

ppm

numeric(1) to expand the m/z range of each peak (on each side) by a value dependent on the peak's m/z.

method

character(1) specifying which MS2 spectra should be included. Defaults to "all" in which all MS2 spectra within the rt and m/z range of a chromatographic peak are returned. "closest_rt" returns the one MS2 spectrum with the retention time closest to the chromatographic peak's apex rt. "closest_mz" returns the MS2 spectrum with the precursor m/z closest to the chromatographic peak's m/z. "signal" returns the MS2 spectrum which total signal is closest to the chromatographic peak's maximal signal ("maxo").

skipFilled

logical(1) whether no spectra for filled-in peaks should be reported.

return.type

character(1) defining whether the result should be a Spectra object or a simple list. See below for more information.

Value

Which object is returned depends on the value of return.type:

Author(s)

Johannes Rainer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Read a file with DDA LC-MS/MS data
fl <- system.file("TripleTOF-SWATH/PestMix1_DDA.mzML", package = "msdata")
dda <- readMSData(fl, mode = "onDisk")

## Perform MS1 peak detection
dda <- findChromPeaks(dda, CentWaveParam(peakwidth = c(5, 15)))
ms2_sps <- chromPeakSpectra(dda)
ms2_sps

## Metadata column `peak_id` contains the ID of the chromatographic peak
## of the MS2 spectrum

yclement/xcms documentation built on April 10, 2020, 12:08 a.m.