\HeaderA{import.expr.scheme}{Import CDF, probe and annotation files into a SchemeTreeSet}{import.expr.scheme}
\keyword{manip}{import.expr.scheme}
\begin{Description}\relax
Import the Affymetrix CDF, probe and annotation files into a ROOT file and create S4 class SchemeTreeSet
\end{Description}
\begin{Usage}
\begin{verbatim}
import.expr.scheme(filename   = character(0),
                   filedir    = getwd(),
                   schemefile = character(0),
                   probefile  = character(0),
                   annotfile  = character(0),
                   chipname   = NULL,
                   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{schemefile}] name of CDF-file, including full path.
\item[\code{probefile}] name of probe-file, including full path.
\item[\code{annotfile}] name of annotation-file, including full path.
\item[\code{chipname}] optional chip name when using an alternative CDF-file.
\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.expr.scheme} is used to import all information for an Affymetrix 
expression array into a \code{\LinkA{ROOT}{ROOT}} scheme file, including CDF-file, the corresponding
probe file, and the current Afymetrix annotation file. 

Usually, \code{chipname} is extracted from the name of the CDF-file, however, when using
an alternative CDF-file, e.g. from BrainArray or AffyProbeMiner, a \code{chipname} must be
supplied which starts with (or contains) the exact Affymetrix chip name.

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 a new annotation file
is 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{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.Test3.na27"} but use \code{filename="Scheme\_Test3\_na27"} or simply
\code{filename="SchemeTest3na27"} instead. Extension \dQuote{root} is added automatically,
so that ROOT is able to recognize the file as ROOT file.

For a few probesets, parsing the Affymetrix annotation files will provide ambiguous results.
Setting \code{verbose=11} will list these probesets.
\end{Note}
\begin{Author}\relax
Christian Stratowa
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{import.exon.scheme}{import.exon.scheme}}, \code{\LinkA{import.genome.scheme}{import.genome.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 Test3 GeneChip
scheme.test3.na27 <- import.expr.scheme("Scheme_Test3_na27",filedir=scmdir,
                     schemefile=paste(libdir,"Test3.CDF",sep="/"),
                     probefile=paste(libdir,"Test3_probe.tab",sep="/"),
                     annotfile=paste(anndir,"Test3.na27.annot.csv",sep="/"))

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

## create scheme for HG-U133_Plus_2 GeneChip
scheme.hgu133p2.na27 <- import.expr.scheme("Scheme_HGU133p2_na27",filedir=scmdir,
                        schemefile=paste(libdir,"HG-U133_Plus_2.cdf",sep="/"),
                        probefile=paste(libdir,"HG-U133-PLUS_probe.tab",sep="/"),
                        annotfile=paste(anndir,"HG-U133_Plus_2.na27.annot.csv",sep="/"))
## access ROOT scheme file from new R session
scheme.hgu133p2 <- root.scheme(paste(scmdir,"Scheme_HGU133p2_na27.root",sep="/"))
## End(Not run)
\end{ExampleCode}
\end{Examples}

