highlightChromPeaks {xcms} | R Documentation

## Add definition of chromatographic peaks to an extracted chromatogram plot

### Description

The `highlightChromPeaks` function adds chromatographic peak definitions to an existing plot, such as one created by the `plot` method on a `Chromatogram` or `Chromatograms` object.

### Usage

    highlightChromPeaks(x, rt, mz, border = rep("00000040", length(fileNames(x))),
      lwd = 1, col = NA, type = c("rect", "point"), ...)

### Arguments

`x` | For `highlightChromPeaks`: `XCMSnExp` object with the detected peaks.
`rt` | For `highlightChromPeaks`: `numeric(2)` with the retention time range from which peaks should be extracted and plotted.
`mz` | `numeric(2)` with the mz range from which the peaks should be extracted and plotted.
`border` | colors to be used to color the border of the rectangles. Has to be equal to the number of samples in `x`.
`lwd` | `numeric(1)` defining the width of the line/border.
`col` | For `highlightChromPeaks`: color to be used to fill the rectangle.
`type` | the plotting type. See `plot` in base grapics for more details. For `highlightChromPeaks`: `character(1)` defining how the peak should be highlighted: `type = "rect"` draws a rectangle representing the peak definition, `type = "point"` indicates a chromatographic peak with a single point at the position of the peak's `"rt"` and `"maxo"`.
`...` | additional parameters to the `matplot` or `plot` function.

### Author(s)

Johannes Rainer

### Examples

    ## Read some files from the faahKO package.
    library(xcms)
    library(faahKO)
    faahko_3_files <- c(system.file('cdf/KO/ko16.CDF', package = "faahKO"),
                        system.file('cdf/KO/ko18.CDF', package = "faahKO"))

    od <- readMSData(faahko_3_files, mode = "onDisk")

    ## Peak detection using the 'matchedFilter' method. Note that we are using a
    ## larger binSize to reduce the runtime of the example.
    xod <- findChromPeaks(od, param = MatchedFilterParam(binSize = 0.3, snthresh = 20))

    ## Extract the ion chromatogram for one chromatographic peak in the data.
    chrs <- chromatogram(xod, rt = c(2700, 2900), mz = 335)

    plot(chrs)

    ## Extract chromatographic peaks for the mz/rt range (if any).
    chromPeaks(xod, rt = c(2700, 2900), mz = 335)

    ## Highlight the chromatographic peaks in the area
    highlightChromPeaks(xod, rt = c(2700, 2900), mz = 335)

[Package xcms version 3.2.0 Index]