\HeaderA{read.rg}{Read RGList\_CALIB from Image Analysis Output Files}{read.rg}
\keyword{file}{read.rg}
\begin{Description}\relax
Reads an RGList\_CALIB from a series of microarray image analysis output files
\end{Description}
\begin{Usage}
\begin{verbatim}
read.rg(files = NULL, source = "generic", path = NULL, ext = NULL, 
        names = NULL, columns = NULL, other.columns = NULL,
        annotation = NULL,wt.fun = NULL, verbose = TRUE, sep = "\t",
        quote = NULL, DEBUG = FALSE, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{files}] character vector giving the names of the files containing
image analysis output or, for Imagene data, a character
matrix of names of files. If omitted, then all files with
extension \code{ext} in the specified directory will be read in
alphabetical order.
\item[\code{source}] character string specifying the image analysis program which
produced the output files.  Choices are \code{"generic"},
\code{"agilent"}, \code{"arrayvision"}, \code{"bluefuse"}, \code{"genepix"},
\code{"genepix.custom"}, \code{"genepix.median"},\\ \code{"imagene"},
\code{"quantarray"}, \code{"scanarrayexpress"}, \code{"smd.old"},
\code{"smd"},\\ \code{"spot"} or \code{"spot.close.open"}.
\item[\code{path}] character string giving the directory containing the files.
The default is the current working directory.
\item[\code{ext}] character string giving optional extension to be added to
each file name
\item[\code{names}] character vector of names to be associated with each array as
column name. Defaults to \code{removeExt(files)}.
\item[\code{columns}] list with fields \code{R}, \code{G}, \code{Rb}, \code{Gb},
\code{RArea} and \code{GArea} giving the column names to be used for
red foreground, green foreground, red background, green background,
red area and green area respectively. Or, in the case of Imagene data,
a list with fields \code{f} and \code{b}. This argument is optional
if \code{source} is specified, otherwise it is required.
\item[\code{other.columns}] character vector of names of other columns to be read
containing spot-specific information
\item[\code{annotation}] character vector of names of columns containing annotation
information about the probes
\item[\code{wt.fun}] function to calculate spot quality weights
\item[\code{verbose}] logical, \code{TRUE} to report each time a file is read 
\item[\code{sep}] the field separator character 
\item[\code{quote}] character string of characters to be treated as quote marks 
\item[\code{DEBUG}] a logical value, if \code{TRUE}, a series of echo statements 
will be printed for each file. Details on the file, skip, 
and selected columns in a colClasses format for read.table 
will be displayed.
\item[\code{...}] any other arguments are passed to \code{\LinkA{read.table}{read.table}}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This is the main data input function for CALIB package. It has the similar
usage as the read.maimages function in limma package. The output of the 
function is an \code{RGList\_CALIB} object. However,there
are two more fields - \code{\$RArea} and \code{\$GArea} than \code{RGList}
object in limma package. These two fields contain spot area of each color.
More details see \code{read.maimages} in limma package.
\end{Details}
\begin{Value}
An \code{\LinkA{RGList\_CALIB}{RGList.Rul.CALIB}} object containing the components

\begin{ldescription}
\item[\code{R}] matrix containing the red channel foreground intensities for
each spot for each array.
\item[\code{G}] matrix containing the green channel foreground intensities
for each spot for each array.
\item[\code{Rb}] matrix containing the red channel background intensities for
each spot for each array.
\item[\code{Gb}] matrix containing the green channel background intensities
for each spot for each array.
\item[\code{RArea}] matrix containing the red spot area for each spot for each array.
\item[\code{GArea}] matrix containing the green spot area for each spot for each array.
\item[\code{weights}] spot quality weights, if \code{wt.fun} is given
\item[\code{other}] list containing matrices corresponding to \code{other.columns} if given
\item[\code{genes}] data frame containing annotation information about the
probes, for example gene names and IDs and spatial positions
on the array, currently set only if \code{source} is \code{"agilent"},
\code{"genepix"} or \code{source="imagene"} or if the \code{annotation}
argument is set
\item[\code{targets}] data frame with column \code{FileName} giving the names of the
files read
\item[\code{source}] character string giving the image analysis program name
\item[\code{printer}] list of class \code{PrintLayout}, currently set only if
\code{source="imagene"}
\end{ldescription}
\end{Value}
\begin{Author}\relax
Hui Zhao
\end{Author}
\begin{References}\relax
\code{\LinkA{read.maimages}{read.maimages}} in limma package
\end{References}
\begin{SeeAlso}\relax
'read.rg' is based on \code{\LinkA{read.table}{read.table}} in the base package
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

 #  Read all .gpr files from current working directory.

 # files <- dir(pattern="*\.gpr$")
 # RG <- read.rg(files,"genepix")
\end{ExampleCode}
\end{Examples}

