\HeaderA{export}{Export data as text files}{export}
\aliasA{export-methods}{export}{export.Rdash.methods}
\aliasA{export.call}{export}{export.call}
\aliasA{export.data}{export}{export.data}
\aliasA{export.expr}{export}{export.expr}
\aliasA{export.scheme}{export}{export.scheme}
\keyword{manip}{export}
\begin{Description}\relax
Export data from classes \code{\LinkA{SchemeTreeSet}{SchemeTreeSet}}, \code{\LinkA{DataTreeSet}{DataTreeSet}},
\code{\LinkA{ExprTreeSet}{ExprTreeSet}}, or \code{\LinkA{CallTreeSet}{CallTreeSet}} to \code{outfile}.
\end{Description}
\begin{Usage}
\begin{verbatim}
export.scheme(xps.scheme, treetype = character(0), varlist = "*", outfile = character(0), sep = "\t", as.dataframe = FALSE, verbose = TRUE)

export.data(xps.data, treename = "*", treetype = "cel", varlist = "*", outfile = character(0), sep = "\t", as.dataframe = FALSE, verbose = TRUE)

export.expr(xps.expr, treename = "*", treetype = character(0), varlist = "*", outfile = character(0), sep = "\t", as.dataframe = FALSE, verbose = TRUE)

export.call(xps.call, treename = "*", treetype = character(0), varlist = "*", outfile = character(0), sep = "\t", as.dataframe = FALSE, verbose = TRUE)

export(object, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{xps.scheme}] an object of type \code{\LinkA{SchemeTreeSet}{SchemeTreeSet}}.
\item[\code{xps.data}] an object of type \code{\LinkA{DataTreeSet}{DataTreeSet}}.
\item[\code{xps.expr}] an object of type \code{\LinkA{ExprTreeSet}{ExprTreeSet}}.
\item[\code{xps.call}] an object of type \code{\LinkA{CallTreeSet}{CallTreeSet}}.
\item[\code{treename}] vector of tree names to export.
\item[\code{treetype}] type of tree(s) to export, see \code{\LinkA{validTreetype}{validTreetype}}
\item[\code{varlist}] names of tree leaves to export
\item[\code{outfile}] name of output file.
\item[\code{sep}] column separator
\item[\code{as.dataframe}] if \code{TRUE} a data.frame will be returned.
\item[\code{verbose}] logical, if \code{TRUE} print status information.
\item[\code{object}] object of class \code{DataTreeSet}.
\item[\code{...}] arguments \code{treenames},\code{treetype},\code{varlist},\code{outfile},\code{sep},\code{as.dataframe}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Export data from classes \code{\LinkA{SchemeTreeSet}{SchemeTreeSet}}, \code{\LinkA{DataTreeSet}{DataTreeSet}},
\code{\LinkA{ExprTreeSet}{ExprTreeSet}}, or \code{\LinkA{CallTreeSet}{CallTreeSet}} to \code{outfile}.

Parameter \code{varlist} lists the parameters to export: \\
- parameters are separated by ":", e.g. \code{varlist="fInten:fStdev"}. \\
- for \code{varlist="*"} all valid parameters will be exported.

For class \code{DataTreeSet} the following \code{varlist} parameters are valid:
\Tabular{lll}{
& \code{fInten}:& intensities from e.g. tree.cel. \\
& \code{fStdev}:& standard deviation from e.g. tree.cel. \\
& \code{fNPixels}:& number of pixels from e.g. tree.cel. \\
& \code{fBg}:& background values (background trees only).
}
For classes \code{ExprTreeSet} and \code{CallTreeSet} \code{varlist} can contain annotation
parameters and parameters of the resulting data. \\
Following \code{varlist} annotation parameters are valid:
\Tabular{lll}{
& \code{fUnitName}:& unit name (probeset ID). \\
& \code{fTranscriptID}:& transcript\_id (probeset ID). \\
& \code{fName}:& gene name. \\
& \code{fSymbol}:& gene symbol. \\
& \code{fAccession}:& mRNA accession such as Refseq ID. \\
& \code{fEntrezID}:& entrez ID. \\
& \code{fChromosome}:& chromosome. \\
& \code{fStart}:& start position. \\
& \code{fStop}:& stop position. \\
& \code{fStrand}:& strand on chromosome. \\
& \code{fCytoBand}:& cytoband.
}
Following \code{varlist} parameters are valid for \code{ExprTreeSet}:
\Tabular{lll}{
& \code{fLevel}:& expression level. \\
& \code{fStdev}:& standard deviation. \\
& \code{fNPairs}:& number of pairs.
}
Following \code{varlist} parameters are valid for \code{CallTreeSet}:
\Tabular{lll}{
& \code{fCall}:& detection call. \\
& \code{fPValue}:& detection p-value.
}
An example: \code{varlist="fUnitName:fName:fSymbol:fLevel:fStdev:fEntrezID"}

\code{export} is a generic method to export data from \code{\LinkA{ROOT}{ROOT}} trees as text file.
\end{Details}
\begin{Value}
If \code{as.dataframe} is \code{TRUE}, the data will be imported into the
current R session as \code{data.frame}. Otherwise, \code{NULL} will be returned.
\end{Value}
\begin{Author}\relax
Christian Stratowa
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{export-methods}{export.Rdash.methods}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## load existing ROOT scheme file and ROOT data file
scheme.test3 <- root.scheme(paste(.path.package("xps"),"schemes/SchemeTest3.root",sep="/"))
data.test3 <- root.data(scheme.test3, paste(.path.package("xps"),"rootdata/DataTest3_cel.root",sep="/"))

## export as table only
export(scheme.test3, treetype="idx", outfile="Test3_idx.txt",verbose=FALSE)

## export as table and import as data.frame
ann <- export.scheme(scheme.test3, treetype="ann", outfile="Test3_ann.txt",as.dataframe=TRUE,verbose=FALSE)
head(ann)
data <- export.data(data.test3, outfile="Test3_cel.txt",as.dataframe=TRUE,verbose=FALSE)
head(data)
\end{ExampleCode}
\end{Examples}

