\HeaderA{segChrom}{Fit a piecewise constant curve to along chromosome data (wrapper function)}{segChrom}
\keyword{manip}{segChrom}
\begin{Description}\relax
Wrapper around the \code{segment} function for each strand of one or
more chromosomes specified by the user. It does some typical
preprocessing and I/O.
\end{Description}
\begin{Usage}
\begin{verbatim}
segChrom(y, probeAnno, chr=1:17, strands=c("+", "-"), 
  nrBasesPerSegment = 1500, maxk = 3000, step = 7, confint = FALSE,
  confintLevel = 0.95, useLocks=TRUE, verbose=TRUE, savedir)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{y}] ExpressionSet or matrix containing the data to be segmented.
\item[\code{probeAnno}] environment with probe annotations. See
package \code{davidTiling} for an example (?probeAnno).
\item[\code{chr}] integer scalar or vector specifying which chromosome(s) to segment.
\item[\code{strands}] character scalar or vector specifying which strands to segment.
\item[\code{nrBasesPerSegment}] integer (length 1): the parameter
\code{maxseg} of the \code{\LinkA{segment}{segment}} function is calculated as the length of the chromosome divided
by \code{nrBasesPerSegment}. Thus, it determines the average segment
length in the finest segmentation.
\item[\code{maxk}] passed on to  the function \code{\LinkA{segment}{segment}}.
\item[\code{step}] integer scalar, indicating the minimum distance between
consecutive probes. In cases when probes are offset by less than
\code{step} bases, the probes are sampled to achieve the desired spacing.
\item[\code{confint}] logical scalar.  If \code{TRUE}, confidence intervals
for each change-point are calculated.
\item[\code{confintLevel}] numeric scalar between 0 and 1 indicating the
probability level for the confidence intervals that are calculated
for each change-point.
\item[\code{useLocks}] logical scalar. Should a file locking mechanism be used
that allows for a simple-minded parallelization of this function.
\item[\code{verbose}] logical scalar. Should we be chatty about our progress?
\item[\code{savedir}] character scalar. If specified, resulting \code{segmentation}
objects are saved (with \code{\LinkA{save}{save}}) to this directory.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function is a wrapper for the \code{\LinkA{segment}{segment}} function.
Refer to its help page for further details.
\end{Details}
\begin{Value}
An environment containing S4 objects of class \code{"segmentation"}
called "1.+", "1.-", etc. (depending on the values in \code{chr} and
\code{strands}),
where "+" and "-" indicate the strand and the preceding number refers
to the chromosome.
If \code{savedir} is specified, there is also the side-effect that
a series of files "1.+.rda", "1.-.rda", etc. is saved in that directory.
\end{Value}
\begin{Author}\relax
Matt Ritchie \textless{}ritchie@ebi.ac.uk\textgreater{} and Wolfgang Huber \textless{}huber@ebi.ac.uk\textgreater{}
\end{Author}
\begin{Examples}
\begin{ExampleCode}
## Not run: 
  library("davidTiling")
  data("davidTiling")
  data("probeAnno")
  isDNA = seq(1:3)
  yn = normalizeByReference(davidTiling[,-isDNA],davidTiling[,isDNA], probeAnno=probeAnno)
  seg = segChrom(yn, probeAnno) ## this will take a while to run!
## End(Not run)
\end{ExampleCode}
\end{Examples}

