\HeaderA{targetsA2C}{Convert Two-Color Targets Dataframe from One-Row-Per-Array to One-Row-Per-Channel}{targetsA2C}
\aliasA{array2channel}{targetsA2C}{array2channel}
\keyword{htest}{targetsA2C}
\begin{Description}\relax
Convert a two-color targets dataframe with one row per array to one with one row per channel.
\end{Description}
\begin{Usage}
\begin{verbatim}
targetsA2C(targets, channel.codes=c(1,2), channel.columns=list(Target=c("Cy3","Cy5")), grep=FALSE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{targets}] data.frame with one row per array giving information about target samples associated covariates.
\item[\code{channel.codes}] numeric or character vector of length 2 giving codes for the channels
\item[\code{channel.columns}] named list of character vectors of length 2.
Each entry gives a pair of names of columns in \code{targets} which contain channel-specific information.
This pair of columns should be assembled into one column in the output.
\item[\code{grep}] logical, if \code{TRUE} then the channel column names are found by \code{grep}ing, i.e., the actual column names need only contain the names given by \code{channel.columns} as substrings
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The \code{targets} dataframe holds information about the RNA samples used as targets in the microarray experiment.
It is often read from a file using \code{\LinkA{readTargets}{readTargets}}.
This function is used to convert the dataframe from an array-orientated format with one row for each array and two columns for the two channels into a channel-orientated format with one row for each individual channel observations.
In statistical terms, the first format treats the arrays as cases and treats the channels as repeated measurements.
The second format treats the individual channel observations as cases.
The second format may be more appropriate if the data is to be analyzed in terms of individual log-intensities.
\end{Details}
\begin{Value}
data.frame with twice as many rows as \code{targets}.
Any pair of columns named by \code{channel.columns} will now be one column.
\end{Value}
\begin{Author}\relax
Gordon Smyth
\end{Author}
\begin{SeeAlso}\relax
\code{targetsA2C} is used by the \code{\LinkA{coerce}{coerce}} method from \code{RGList} for \code{ExpressionSet} in the convert package.

An overview of methods for single channel analysis in limma is given by \LinkA{07.SingleChannel}{07.SingleChannel}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
targets <- data.frame(FileName=c("file1.gpr","file2.gpr"),Cy3=c("WT","KO"),Cy5=c("KO","WT"))
targetsA2C(targets)
\end{ExampleCode}
\end{Examples}

