\HeaderA{import.exon.scheme}{Import CLF, PGF and annotation files into a SchemeTreeSet}{import.exon.scheme}
\keyword{manip}{import.exon.scheme}
\begin{Description}\relax
Import the Affymetrix CLF, PGF, and probeset and transcript annotation files into a ROOT file and create S4 class SchemeTreeSet
\end{Description}
\begin{Usage}
\begin{verbatim}
import.exon.scheme(filename   = character(0),
                   filedir    = getwd(),
                   layoutfile = character(0),
                   schemefile = character(0),
                   probeset   = character(0),
                   transcript = character(0),
                   control    = "",
                   add.mask   = FALSE,
                   verbose    = TRUE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{filename}] file name of ROOT scheme file.
\item[\code{filedir}] system directory where ROOT scheme file should be stored.
\item[\code{layoutfile}] name of CLF-file, including full path.
\item[\code{schemefile}] name of PGF-file, including full path.
\item[\code{probeset}] name of probeset annotation-file, including full path.
\item[\code{transcript}] name of transcript annotation-file, including full path.
\item[\code{control}] optional name of controls.ps-file, including full path.
\item[\code{add.mask}] logical. If \code{TRUE} mask information will be included as slot \code{mask}.
\item[\code{verbose}] logical, if \code{TRUE} print status information.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{import.exon.scheme} is used to import all information for an Affymetrix 
exon array into a \code{\LinkA{ROOT}{ROOT}} scheme file, including CLF and PGF-files, and the current 
Afymetrix probeset and transcript annotation files. 

An S4 class \code{\LinkA{SchemeTreeSet}{SchemeTreeSet}} will be created, serving as R wrapper to the 
\code{\LinkA{ROOT}{ROOT}} scheme file \code{filename}.

Since a new \code{\LinkA{ROOT}{ROOT}} scheme file needs only to be created when new annotation files
are available from the Affymetrix website, it is recommended to store all \code{\LinkA{ROOT}{ROOT}}
scheme files in a commonly accessible system directory \code{filedir}.

Use function \code{\LinkA{root.scheme}{root.scheme}} to access the \code{\LinkA{ROOT}{ROOT}} scheme file from new
R sessions to avoid creating a new \code{\LinkA{ROOT}{ROOT}} scheme file for every session.
\end{Details}
\begin{Value}
A \code{SchemeTreeSet} object.
\end{Value}
\begin{Section}{Warning}
The current version of \sQuote{xps} should be able to import all Affymetrix exon array
annotation files up to November 2008. However, since Affymetrix is still changing the headers
and/or columns of the annotation files, future annotation files may require adaptation
of the source code, thus the current version of \sQuote{xps} may not be able to read
these files.
\end{Section}
\begin{Note}\relax
As mentioned above, use function \code{\LinkA{root.scheme}{root.scheme}} to access the 
\code{\LinkA{ROOT}{ROOT}} scheme file from new R sessions to avoid creating a new \code{\LinkA{ROOT}{ROOT}} 
scheme file for every R session.

Do not separate \code{filename} of ROOT files with dots, use underscores, e.g. do not use 
\code{filename="Scheme.HuEx10stv2r2.na27"} but use \code{filename="Scheme\_HuEx10stv2r2\_na27"}
instead. Extension \dQuote{root} is added automatically, so that ROOT is able to recognize
the file as ROOT file.

Do not set \code{add.mask=TRUE} unless you know that your computer has sufficient RAM.

Do not add item \code{control} unless you want to use one of the old annotation
files where the probeset annotation file does not contain the AFFX controls.
\end{Note}
\begin{Author}\relax
Christian Stratowa
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{import.expr.scheme}{import.expr.scheme}}, \code{\LinkA{root.scheme}{root.scheme}}, \code{\LinkA{SchemeTreeSet}{SchemeTreeSet}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## Not run: 
## define paths
scmdir <- "/common/path/schemes"
libdir <- "/my/path/Affy/libraryfiles"
anndir <- "/my/path/Affy/Annotation"

## create scheme for HuEx-1_0-st-v2.r2 Exon array
scheme.huex10stv2r2.na27 <- import.exon.scheme("Scheme_HuEx10stv2r2_na27",filedir=scmdir,
                            layoutfile=paste(libdir,"HuEx-1_0-st-v2_libraryfile/HuEx-1_0-st-r2/HuEx-1_0-st-v2.r2.clf",sep="/"),
                            schemefile=paste(libdir,"HuEx-1_0-st-v2_libraryfile/HuEx-1_0-st-r2/HuEx-1_0-st-v2.r2.pgf",sep="/"),
                            probeset=paste(anndir,"HuEx-1_0-st-v2.na27.hg18.probeset.csv",sep="/"),
                            transcript=paste(anndir,"HuEx-1_0-st-v2.na27.hg18.transcript.csv",sep="/"))

## access ROOT scheme file from new R session
scheme.huex10stv2r2 <- root.scheme(paste(scmdir,"Scheme_HuEx10stv2r2_na27.root",sep="/"))

## create scheme for HuGene-1_0-st-v1.r4 as exon array
scheme.hugene10stv1r4.na27 <- import.exon.scheme("Scheme_HuGene10stv1r4_na27_2",filedir=scmdir,
                              layoutfile=paste(libdir,"HuGene-1_0-st-v1.r4.analysis-lib-files/HuGene-1_0-st-v1.r4.clf",sep="/"),
                              schemefile=paste(libdir,"HuGene-1_0-st-v1.r4.analysis-lib-files/HuGene-1_0-st-v1.r4.pgf",sep="/"),
                              probeset=paste(anndir,"HuGene-1_0-st-v1.na27.2.hg18.probeset.csv",sep="/"),
                              transcript=paste(anndir,"HuGene-1_0-st-v1.na27.hg18.transcript.csv",sep="/"))

## access ROOT scheme file from new R session
scheme.hugene10stv1r4 <- root.scheme(paste(scmdir,"Scheme_HuGene10stv1r4_na27_2.root",sep="/"))

## create scheme for HuEx-1_0-st-v2.r2 Exon array with the old annotation file
scheme.huex10stv2r2.old <- import.exon.scheme("Scheme_HuEx10stv2r2_old",filedir=scmdir,
                           layoutfile=paste(libdir,"HuEx-1_0-st-v2_libraryfile/HuEx-1_0-st-r2/HuEx-1_0-st-v2.r2.clf",sep="/"),
                           schemefile=paste(libdir,"HuEx-1_0-st-v2_libraryfile/HuEx-1_0-st-r2/HuEx-1_0-st-v2.r2.pgf",sep="/"),
                           probeset=paste(anndir,"HuEx-1_0-st-probeset-annot.csv",sep="/"),
                           transcript=paste(anndir,"HuEx-1_0-st-transcript-annot.csv",sep="/"),
                           control=paste(libdir,"HuEx-1_0-st-v2_libraryfile/HuEx-1_0-st-r2/HuEx-1_0-st-v2.r2.controls.ps",sep="/"))
## End(Not run)
\end{ExampleCode}
\end{Examples}

