\HeaderA{pairs-methods}{Pairs Plot for DEDS Objects}{pairs.Rdash.methods}
\aliasA{pairs}{pairs-methods}{pairs}
\aliasA{pairs.DEDS}{pairs-methods}{pairs.DEDS}
\keyword{hplot}{pairs-methods}
\begin{Description}\relax
The function \code{pairs-DEDS} produces pairs plots of statistics or p
values for \code{\LinkA{DEDS-class}{DEDS.Rdash.class}} objects.
\end{Description}
\begin{Usage}
\begin{verbatim}
## S3 method for class 'DEDS':
pairs(x, subset=c(1:nrow(x$stats)), labels =
colnames(x$stats[,-1]), logit = FALSE,
diagonal = c("qqnorm", "boxplot", "density", "histogram", "none"),
lower = c("cor", "none"), groups.by.deds = TRUE, thresh = 0.05, reg.line
= NULL, smooth = FALSE, line.by.group = FALSE, diag.by.group = TRUE, lower.by.group =
FALSE, col = palette(), pch = 1:n.groups, lwd = 1, legend.plot =
length(levels(groups)) > 1, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] An object of \code{\LinkA{DEDS}{DEDS}}.
\item[\code{subset}] A numeric vector indicating the subset of points to be plotted.
\item[\code{labels}] A character vector specifying the names of the variables.
\item[\code{logit}] A logical variable, if \code{TRUE} the variables are
logged, useful when plotting p values.
\item[\code{diagonal}] A character string specifying the type of plot to be
applied in the diagonal panels. \\
\Tabular{ll}{
\code{diagonal="qqnorm"}: &  \code{\LinkA{qqnorm}{qqnorm}} on the diagonal\\
\code{diagonal="boxplot"}: & \code{\LinkA{boxplot}{boxplot}} on the diagonal\\
\code{diagonal="density"}: & \code{\LinkA{density}{density}} on the diagonal\\
\code{diagonal="histogram"}: & \code{\LinkA{hist}{hist}} on the diagonal\\
\code{diagonal="none"}: & no special plot will be applied on
the diagonal
}

\item[\code{lower}] A character string specifying the function to be
applied in the lower panels. \\
\Tabular{ll}{
\code{lower="cor"}: &  absolute correlation will be put on the
lower panel\\
\code{none="cor"}; & no special function will be applied
}

\item[\code{groups.by.deds}] A logcial variable, if \code{TRUE}, points will
be separated into groups according to their magnitude of q- or p-values
by DEDS. 
\item[\code{thresh}] A numeric variable, if \code{thresh}<1, it specifies
the threshold of significance in differential expression (DE) for q- or 
p-values of the DEDS object; default is set at 0.05. If 
\code{thresh}>1, it specifies the number of top DE genes to be
highlighted. 
\item[\code{reg.line}] A function name specifying the type of regressio line
to be plotted in the scatter plots. If \code{reg.line=lm},
linear regression line will be plotted; If \code{reg.line=NULL}, no
regression line will be plotted in the scatter plot.
\item[\code{smooth}] A logical variable specifying if smooth regression lines
will be plotted in the scatter plots. If \code{smooth=TRUE}, a
\code{\LinkA{lowess}{lowess}} line will be applied.
\item[\code{line.by.group}] A logical variable specifying if the regression
lines should be applied within groups.
\item[\code{diag.by.group}] A logical variable specifying if the plot in the diagonal
panels whould be applied groupwise.
\item[\code{lower.by.group}] A logical variable, if
\code{lower.by.group=TRUE} and \code{lower="cor"}, correlation
coefficients will be calculated and printed separated according to
groups in the lower panels.
\item[\code{col}] A specification for the colors to be used for plotting
different groups, see \code{\LinkA{par}{par}}.
\item[\code{pch}] A specification for the type of points to be used for
plotting different groups, see \code{\LinkA{par}{par}}.
\item[\code{lwd}] A specification for the width of lines to be used if lines
are plotted; see \code{\LinkA{par}{par}}.
\item[\code{legend.plot}] A logical variable specifying if the legend will be
plotted.
\item[\code{...}] Extra parameters for plotting.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The function \code{pairs.DEDS} implements a S3 method of
\code{\LinkA{pairs}{pairs}} for \code{\LinkA{DEDS}{DEDS}}. The \code{\LinkA{DEDS}{DEDS}}
class is a simple list-based class to store DEDS results and it is
usually created  by functions \code{\LinkA{deds.pval}{deds.pval}},
\code{\LinkA{deds.stat}{deds.stat}}, \code{\LinkA{deds.stat.linkC}{deds.stat.linkC}}. The list
contains a "stat" component, which stores statistics or p values from
various statistical tests. The function \code{pairs.DEDS} extracts the
"stat" component and produces a matrix of scatterplot.

\code{pairs.DEDS} as a default highlights points (corresponding to
genes) with adjusted p- or q-values less than a user defined
threshold. The user can select among a series of options a plot for
the diagonal panel; as a default, it produces a \code{\LinkA{qqnorm}{qqnorm}}
for each column in the "stat" matrix. Both the diagonal and lower
panels can be stratified by specifying the \code{diag.by.group} or
\code{lower.by.group} arguments.
\end{Details}
\begin{Author}\relax
Yuanyuan Xiao, \email{yxiao@itsa.ucsf.edu}, \\
Jean Yee Hwa Yang, \email{jean@biostat.ucsf.edu}.
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{deds.stat}{deds.stat}}, \code{\LinkA{deds.pval}{deds.pval}},
\code{\LinkA{deds.stat.linkC}{deds.stat.linkC}}, \code{\LinkA{hist.DEDS}{hist.DEDS}},
\code{\LinkA{qqnorm.DEDS}{qqnorm.DEDS}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
X <- matrix(rnorm(1000,0,0.5), nc=10)
L <- rep(0:1,c(5,5))

# genes 1-10 are differentially expressed
X[1:10,6:10]<-X[1:10,6:10]+1
# DEDS
d <- deds.stat.linkC(X, L, B=200)

# pairs plot
pairs(d)
# plot regression line
pairs(d, reg.line=lm, lwd=2)
# histogram in the diagonal panel
pairs(d, diagonal="hist")
# boxplot on the diagonal panel and stratified
pairs(d, diagonal="boxplot", diag.by.group=TRUE)
\end{ExampleCode}
\end{Examples}

