\HeaderA{import.data}{Import CEL files into a DataTreeSet}{import.data}
\keyword{manip}{import.data}
\begin{Description}\relax
Import the Affymetrix CEL files into a ROOT file and create S4 class DataTreeSet
\end{Description}
\begin{Usage}
\begin{verbatim}
import.data(xps.scheme,
            filename = character(0),
            filedir  = getwd(),
            celdir   = NULL,
            celfiles = "*",
            celnames = NULL,
            project  = NULL,
            verbose  = TRUE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{xps.scheme}] a \code{\LinkA{SchemeTreeSet}{SchemeTreeSet}} containing the correct scheme for the CEL-files
\item[\code{filename}] file name of ROOT data file.
\item[\code{filedir}] system directory where ROOT data file should be stored.
\item[\code{celdir}] system directory containing the CEL-files for corresponding scheme.
\item[\code{celfiles}] optional vector of CEL-files to be imported.
\item[\code{celnames}] optional vector of names which should replace the CEL-file names.
\item[\code{project}] optional class \code{\LinkA{ProjectInfo}{ProjectInfo}}.
\item[\code{verbose}] logical, if \code{TRUE} print status information.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{import.data} is used to import CEL-files from directory \code{celdir} into 
a \code{\LinkA{ROOT}{ROOT}} data file. To import only a subset of CEL-files, list these CEL-files 
as vector \code{celfiles}.

To import CEL-files from different directories, vector \code{celfiles} must contain the
full path for each CEL-file and \code{celdir} must be \code{celdir=NULL}. 

Currently, the following types of Affymetrix CEL-files can be imported: 
text (version 3), xml, binary (xda), generic (agcc,calvin)

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

Use function \code{\LinkA{root.data}{root.data}} to access the \code{\LinkA{ROOT}{ROOT}} data file from new
R sessions to avoid creating a new \code{\LinkA{ROOT}{ROOT}} data file for every session.
\end{Details}
\begin{Value}
A \code{DataTreeSet} object.
\end{Value}
\begin{Note}\relax
As mentioned above, use function \code{\LinkA{root.data}{root.data}} to access the 
ROOT data file from new R sessions to avoid creating a new \code{\LinkA{ROOT}{ROOT}} data file 
for every R session.

Do not separate \code{filename} of ROOT files with dots, use underscores, e.g. do not use 
\code{filename="Data.Test3"} but use \code{filename="Data\_Test3"} or \code{filename="DataTest3"}
instead.

To every ROOT data file the extension \dQuote{\_cel} is attached to \code{filename} to easily
recognize ROOT data files containing the raw CEL data, e.g. for \code{filename="Data\_Test3"}
the final name is \dQuote{Data\_Test3\_cel.root}. Extension \dQuote{root} is added automatically,
so that ROOT is able to recognize the file as ROOT file.

Once a \code{\LinkA{ROOT}{ROOT}} file is created it can not be overwritten, it must be deleted
manually first. Only \code{\LinkA{ROOT}{ROOT}} files called \dQuote{tmp} or with \code{filename} 
starting with \dQuote{tmp\_} will be re-created automatically.

If CEL-file names contain dots and/or colons as characters, these characters will be replaced
by underscores. It is recommended to use parameter \code{celnames} to create shorter CEL names
and to replace special characters.
\end{Note}
\begin{Author}\relax
Christian Stratowa
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{root.data}{root.data}}, \code{\LinkA{DataTreeSet}{DataTreeSet}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## get scheme and import CEL-files from package
scheme.test3 <- root.scheme(paste(.path.package("xps"),"schemes/SchemeTest3.root",sep="/"))
data.test3 <- import.data(scheme.test3,"tmp_data_test3",celdir=paste(.path.package("xps"),"raw",sep="/"))
unlist(treeNames(data.test3))

## import only subset of CEL-files
subdata.test3 <- import.data(scheme.test3,"tmpdt_data_test3",celdir=paste(.path.package("xps"),"raw",sep="/"),
                 celfiles=c("TestA1.CEL","TestB2.CEL"),verbose=FALSE)
unlist(treeNames(subdata.test3))
\end{ExampleCode}
\end{Examples}

