% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/functions-XCMSnExp.R
\name{plotAdjustedRtime}
\alias{plotAdjustedRtime}
\title{Visualization of alignment results}
\usage{
plotAdjustedRtime(object, col = "#00000080", lty = 1, lwd = 1,
  type = "l", adjustedRtime = TRUE, xlab = ifelse(adjustedRtime, yes
  = expression(rt[adj]), no = expression(rt[raw])),
  ylab = expression(rt[adj] - rt[raw]), peakGroupsCol = "#00000060",
  peakGroupsPch = 16, peakGroupsLty = 3, ylim, ...)
}
\arguments{
\item{object}{A \code{\link{XCMSnExp}} object with the alignment results.}

\item{col}{colors to be used for the lines corresponding to the individual
samples.}

\item{lty}{line type to be used for the lines of the individual samples.}

\item{lwd}{line width to be used for the lines of the individual samples.}

\item{type}{plot type to be used. See help on the \code{par} function for
supported values.}

\item{adjustedRtime}{logical(1) whether adjusted or raw retention times
should be shown on the x-axis.}

\item{xlab}{the label for the x-axis.}

\item{ylab}{the label for the y-axis.}

\item{peakGroupsCol}{color to be used for the peak groups (only used if
alignment was performed using the \code{\link{adjustRtime-peakGroups}}
method.}

\item{peakGroupsPch}{point character (\code{pch}) to be used for the peak
groups (only used if alignment was performed using the
\code{\link{adjustRtime-peakGroups}} method.}

\item{peakGroupsLty}{line type (\code{lty}) to be used to connect points for
each peak groups (only used if alignment was performed using the
\code{\link{adjustRtime-peakGroups}} method.}

\item{ylim}{optional \code{numeric(2)} with the upper and lower limits on
the y-axis.}

\item{...}{Additional arguments to be passed down to the \code{plot}
function.}
}
\description{
Plot the difference between the adjusted and the raw retention
time (y-axis) for each file along the (adjusted or raw) retention time
(x-axis). If alignment was performed using the
\code{\link{adjustRtime-peakGroups}} method, also the features (peak
groups) used for the alignment are shown.
}
\examples{
## Below we perform first a peak detection (using the matchedFilter
## method) on some of the test files from the faahKO package followed by
## a peak grouping and retention time adjustment using the "peak groups"
## method
library(faahKO)
library(xcms)
fls <- dir(system.file("cdf/KO", package = "faahKO"), recursive = TRUE,
           full.names = TRUE)

## Reading 2 of the KO samples
raw_data <- readMSData(fls[1:2], mode = "onDisk")

## Perform the peak detection using the matchedFilter method.
mfp <- MatchedFilterParam(snthresh = 20, binSize = 1)
res <- findChromPeaks(raw_data, param = mfp)

## Performing the peak grouping using the "peak density" method.
p <- PeakDensityParam(sampleGroups = c(1, 1))
res <- groupChromPeaks(res, param = p)

## Perform the retention time adjustment using peak groups found in both
## files.
fgp <- PeakGroupsParam(minFraction = 1)
res <- adjustRtime(res, param = fgp)

## Visualize the impact of the alignment. We show both versions of the plot,
## with the raw retention times on the x-axis (top) and with the adjusted
## retention times (bottom).
par(mfrow = c(2, 1))
plotAdjustedRtime(res, adjusted = FALSE)
grid()
plotAdjustedRtime(res)
grid()
}
\seealso{
\code{\link{adjustRtime}} for all retention time correction/
    alignment methods.
}
\author{
Johannes Rainer
}
