\HeaderA{result.output}{Output significant genes for package Envisage}{result.output}
\keyword{models}{result.output}
\begin{Description}\relax
This function takes the adjusted p-values for the model
terms for each gene and outputs those genes that are significant to
the user.
\end{Description}
\begin{Usage}
\begin{verbatim}
  result.output(adjp, pCutoff, pData, exprData, errorGenes,
    fileResults, MEorINT, param4INT, failedAnova)    
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{adjp}] An object of class \code{data.frame} containing the
adjusted p-values for each model term for each gene.
\item[\code{pCutoff}] A number defining the p value cutoff to be used in 
significance analysis.  Must be between 0 and 1 (default 0.05.)
\item[\code{pData}] An object of class
\code{\LinkA{phenoData}{phenoData}} containing the
phenotypic information for the experiment.
\item[\code{exprData}] A matrix of expression values for each gene for each
sample. Usually calculated using \code{\LinkA{exprs}{exprs}} on an
object of class
\code{\LinkA{ExpressionSet}{ExpressionSet}}.
\item[\code{errorGenes}] A list of the genes that failed and the model terms
for which aliasing was detected.
\item[\code{fileResults}] The folder in which to save the results of the
modelling procedure. Defaults to the current working directory.
\item[\code{MEorINT}] Character string defining whether to look at first
order interactions ("INT") or only main effect terms ("ME") in the
model.
\item[\code{param4INT}] A character vector that defines the model variables
for which interactions should be calculated.
\item[\code{failedAnova}] A vector of genes for which the Anova Type II sum
of squares failed, indicating model aliasing.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The \pkg{Envisage} package contains methods allowing the use of linear
models (LMs) for analysing significantly changing genes in experiments
with a variety of sources of variation, be they experimentally
controlled variables such as drug treatment or time, or non-controlled
sources of confounding variation such as phenotypic or environmental  
differences. This allows all sources of variation to be considered when 
analysing for significant differential expression, ensuring resulting
genes are biologically relevent to the experimental question.

The function \code{\LinkA{result.output}{result.output}} outputs significant
gene lists for each of the terms within the model. For each model
term, a vector is created containing any genes for which
the adjusted p-value for that terms is below \code{pCutoff} (along
with the corresponding adjusted p-value). A list, \code{results}, is
created containing all such data frames for all model terms.

The resulting p-values for each model term are output in a tab
delimitted text file within the directory \file{EnvisageResults/}
which is created within the directory specified by
\code{fileResults} (defaults to the working directory). If this 
directory already exists, existing files
are appended with the suffix \file{OLD} to distingiush them from the
most recent files. This avoids overwriting data, but please be aware
that continually writing to the same file will result in an increase
in the directory size.

Also created are two output files pertaining to aliasing
information. \file{AliasGenes.txt} gives the names of the genes that
show problems due to model aliasing, and \file{AliasReport.txt} gives
a more in depth report on the variable levels for which aliasing was
detected. For more information, please see the package vignette.

\code{\LinkA{result.output}{result.output}} is an internal function and is
not designed to be accessed by users.
\end{Details}
\begin{Value}
A list \code{results} is returned containing the following slots:

\begin{ldescription}
\item[\code{model term}] For each model term, significnat genes and their
p-values are comntained within individual slots.
\item[\code{AliasGenes}] A vector of genes which showed problems through the
modelling procedure due to aliasing in the model.
\end{ldescription}
\end{Value}
\begin{Author}\relax
Sam Robson \email{S.C.Robson@warwick.ac.uk}
\end{Author}
\begin{References}\relax
Robson, S. C., Hunter, E., Bird, H., Turner, H. (2008) 
\emph{Envisage: model-based significance analysis of microarray gene
expression data}, manuscript in preparation
\end{References}
\begin{SeeAlso}\relax
For the main \pkg{Envisage} method, see
\code{\LinkA{envisage}{envisage}}.
\end{SeeAlso}

