\HeaderA{getLayout}{Extract the Print Layout of an Array from the GAL File}{getLayout}
\aliasA{getDupSpacing}{getLayout}{getDupSpacing}
\aliasA{getLayout2}{getLayout}{getLayout2}
\keyword{IO}{getLayout}
\begin{Description}\relax
From the Block, Row and Column information in a genelist, determine the number of grid rows and columns on the array and the number of spot rows and columns within each grid.
\end{Description}
\begin{Usage}
\begin{verbatim}
getLayout(gal, guessdups=FALSE)
getLayout2(galfile)
getDupSpacing(ID)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{gal}] data.frame containing the GAL, i.e., giving the position and gene identifier of each spot
\item[\code{galfile}] name or path of GAL file
\item[\code{guessdups}] logical, if \code{TRUE} then try to determine number and spacing of duplicate spots, i.e., within-array replicates
\item[\code{ID}] vector or factor of gene IDs
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
A GenePix Array List (GAL) file is a list of genes and associated information produced by an Axon microarray scanner.
The function \code{getLayout} determines the print layout from a data frame created from a GAL file or gene list.
The data.frame must contain columns \code{Block}, \code{Column} and \code{Row}.
(The number of tip columns is assumed to be either one or four.)

On some arrays, each probe may be duplicated a number of times (\code{ndups}) at regular intervals (\code{spacing}) in the GAL file.
\code{getDupSpacing} determines valid values for \code{ndups} and \code{spacing} from a vector of IDs.
If \code{guessdups=TRUE}, then \code{getLayout} calls \code{getDupSpacing}.

The function \code{getLayout2} attempts to determine the print layout from the header information of an actual GAL file.
\end{Details}
\begin{Value}
A \code{printlayout} object, which is a list with the following components.
The last two components are present only if \code{guessdups=TRUE}.
\begin{ldescription}
\item[\code{ngrid.r}] integer, number of grid rows on the arrays
\item[\code{ngrid.c}] integer, number of grid columns on the arrays
\item[\code{nspot.r}] integer, number of rows of spots in each grid
\item[\code{nspot.c}] integer, number of columns of spots in each grid
\item[\code{ndups}] integer, number of times each probe is printed on the array
\item[\code{spacing}] integer, spacing between multiple printings of each probe
\end{ldescription}
\end{Value}
\begin{Author}\relax
Gordon Smyth and James Wettenhall
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{gpTools}{gpTools}}.

An overview of LIMMA functions for reading data is given in \LinkA{03.ReadingData}{03.ReadingData}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
# gal <- readGAL()
# layout <- getLayout(gal)
\end{ExampleCode}
\end{Examples}

