\Header{toptable}{Table of Top Genes from Linear Model Fit}
\alias{topTable}{toptable}
\keyword{htest}{toptable}
\begin{Description}\relax
Extract a table of the top-ranked genes from a linear model fit.
\end{Description}
\begin{Usage}
\begin{verbatim}
toptable(fit,coef=1,number=10,genelist=NULL,A=NULL,eb=NULL,adjust.method="holm",sort.by="B",...)
topTable(fit,coef=1,number=10,genelist=NULL,adjust.method="holm",sort.by="B")
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{fit}] for \code{toptable}, this is an output list from \code{lm.series}, \code{gls.series} or \code{rlm.series}.
For \code{topTable} is an object of class \code{MArrayLM}.
\item[\code{coef}] column number of the effect or contrast to rank the genes on
\item[\code{number}] how many genes to pick out
\item[\code{genelist}] a data frame containing the gene allocation list or a vector containing the gene names
\item[\code{A}] matrix of A-values or vector of average A-values.
\item[\code{eb}] output list from \code{ebayes(fit)}
\item[\code{adjust.method}] method to use to adjust the P-values for multiple testing, e.g., "holm" or "fdr". See \code{\Link{p.adjust}} for the available options. If \code{NULL} or \code{"none"} then the P-values are not adjusted.
\item[\code{sort.by}] statistic to rank genes by.  Possibilities are \code{"M"}, \code{"A"}, \code{"T"}, \code{"P"} or \code{"B"}.
\item[\code{...}] any other arguments are passed to \code{ebayes} if \code{eb} is \code{NULL}
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function summarizes a fit object produced by \code{lm.series}, \code{gls.series} or \code{rlm.series} by selecting the top-ranked genes for any given contrast.
\end{Details}
\begin{Value}
A dataframe with a row for the \code{number} top genes and the following columns:
\begin{ldescription}
\item[\code{genelist}] if genelist was included as input
\item[\code{M}] estimate of the effect or the contrast, on the log2 scale
\item[\code{t}] moderated t-statistic
\item[\code{P.Value}] nominal P-value
\item[\code{B}] log odds that the gene is differentially expressed
\end{ldescription}
\end{Value}
\begin{Author}\relax
Gordon Smyth
\end{Author}
\begin{SeeAlso}\relax
\code{\Link{ebayes}}, \code{\Link{p.adjust}}, \code{\Link{lm.series}}, \code{\Link{gls.series}}, \code{\Link{rlm.series}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
#  Simulate gene expression data,
#  6 microarrays and 100 genes with first gene differentially expressed
M <- matrix(rnorm(100*6,sd=0.3),100,6)
M[1,1:3] <- M[1,1:3] + 2
#  Design matrix includes two treatments, one for first 3 and one for last 3 arrays
design <- cbind(First3Arrays=c(1,1,1,0,0,0),Last3Arrays=c(0,0,0,1,1,1))
fit <- lm.series(M,design=design)
toptable(fit)
\end{ExampleCode}
\end{Examples}

