\HeaderA{RangesList-class}{List of Ranges}{RangesList.Rdash.class}
\aliasA{as.data.frame,RangesList-method}{RangesList-class}{as.data.frame,RangesList.Rdash.method}
\aliasA{class:RangesList-class}{RangesList-class}{class:RangesList.Rdash.class}
\aliasA{class:SimpleRangesList-class}{RangesList-class}{class:SimpleRangesList.Rdash.class}
\aliasA{coerce,RangesList,CompressedIRangesList-method}{RangesList-class}{coerce,RangesList,CompressedIRangesList.Rdash.method}
\aliasA{coerce,RangesList,CompressedNormalIRangesList-method}{RangesList-class}{coerce,RangesList,CompressedNormalIRangesList.Rdash.method}
\aliasA{coerce,RangesList,IRangesList-method}{RangesList-class}{coerce,RangesList,IRangesList.Rdash.method}
\aliasA{coerce,RangesList,NormalIRangesList-method}{RangesList-class}{coerce,RangesList,NormalIRangesList.Rdash.method}
\aliasA{coerce,RangesList,RangedData-method}{RangesList-class}{coerce,RangesList,RangedData.Rdash.method}
\aliasA{coerce,RangesList,SimpleIRangesList-method}{RangesList-class}{coerce,RangesList,SimpleIRangesList.Rdash.method}
\aliasA{coerce,RangesList,SimpleNormalIRangesList-method}{RangesList-class}{coerce,RangesList,SimpleNormalIRangesList.Rdash.method}
\aliasA{end,RangesList-method}{RangesList-class}{end,RangesList.Rdash.method}
\aliasA{end<-,RangesList-method}{RangesList-class}{end<.Rdash.,RangesList.Rdash.method}
\aliasA{Ops,RangesList,ANY-method}{RangesList-class}{Ops,RangesList,ANY.Rdash.method}
\aliasA{RangesList}{RangesList-class}{RangesList}
\aliasA{show,RangesList-method}{RangesList-class}{show,RangesList.Rdash.method}
\aliasA{SimpleRangesList}{RangesList-class}{SimpleRangesList}
\aliasA{SimpleRangesList-class}{RangesList-class}{SimpleRangesList.Rdash.class}
\aliasA{space}{RangesList-class}{space}
\aliasA{space,RangesList-method}{RangesList-class}{space,RangesList.Rdash.method}
\aliasA{split,Ranges-method}{RangesList-class}{split,Ranges.Rdash.method}
\aliasA{start,RangesList-method}{RangesList-class}{start,RangesList.Rdash.method}
\aliasA{start<-,RangesList-method}{RangesList-class}{start<.Rdash.,RangesList.Rdash.method}
\aliasA{universe}{RangesList-class}{universe}
\aliasA{universe,RangesList-method}{RangesList-class}{universe,RangesList.Rdash.method}
\aliasA{universe<\Rdash}{RangesList-class}{universe<.Rdash.}
\aliasA{universe<-,RangesList-method}{RangesList-class}{universe<.Rdash.,RangesList.Rdash.method}
\aliasA{width,RangesList-method}{RangesList-class}{width,RangesList.Rdash.method}
\aliasA{width<-,RangesList-method}{RangesList-class}{width<.Rdash.,RangesList.Rdash.method}
\aliasA{[,RangesList-method}{RangesList-class}{[,RangesList.Rdash.method}
\aliasA{[,SimpleRangesList-method}{RangesList-class}{[,SimpleRangesList.Rdash.method}
\keyword{methods}{RangesList-class}
\keyword{classes}{RangesList-class}
\begin{Description}\relax
An extension of \code{\LinkA{Sequence}{Sequence.Rdash.class}} that holds only
\code{\LinkA{Ranges}{Ranges.Rdash.class}} objects. Useful for storing ranges over a set
of spaces (e.g. chromosomes), each of which requires a separate
\code{Ranges} object. As a \code{Sequence}, \code{RangesList} may be
annotated with its universe identifier (e.g. a genome) in which all of its
spaces exist.
\end{Description}
\begin{Section}{Accessors}
In the code snippets below, \code{x} is a \code{RangesList}
object. 

All of these accessors collapse over the spaces:
\describe{
\item[] \code{start(x), start(x) <- value}: Get or set the starts of the
ranges. When setting the starts, \code{value} can be an integer vector
of \code{length(sum(elementLengths(x)))} or an IntegerList object of
length \code{length(x)} and names \code{names(x)}.
\item[] \code{end(x), end(x) <- value}: Get or set the ends of the
ranges. When setting the starts, \code{value} can be an integer vector
of \code{length(sum(elementLengths(x)))} or an IntegerList object of
length \code{length(x)} and names \code{names(x)}.
\item[] \code{width(x), width(x) <- value}: Get or set the widths of the
ranges. When setting the starts, \code{value} can be an integer vector
of \code{length(sum(elementLengths(x)))} or an IntegerList object of
length \code{length(x)} and names \code{names(x)}.
\item[] \code{space(x)}: Gets the spaces of the ranges as a
character vector. This is equivalent to \code{names(x)}, except each
name is repeated according to the length of its element.

}

These accessors are for the \code{universe} identifier:
\describe{
\item[] \code{universe(x)}: gets the name of the universe as a
single string, if one has been specified, \code{NULL} otherwise.

\item[] \code{universe(x) <- value}: sets the name of the universe
to \code{value}, a single string or \code{NULL}.

}
\end{Section}
\begin{Section}{Constructor}
\describe{
\item[] \code{RangesList(..., universe = NULL)}:
Each \code{Ranges} in \code{...}
becomes an element in the new \code{RangesList}, in the same
order. This is analogous to the \code{\LinkA{list}{list}} constructor,
except every argument in \code{...} must be derived from
\code{Ranges}. The universe is specified by the \code{universe}
parameter, which should be a single string or NULL, to leave unspecified. 

}
\end{Section}
\begin{Section}{Subsetting}
In the code snippets below, \code{x} is a \code{RangesList} object.

\describe{
\item[] \code{x[i]}: Subset \code{x} by index \code{i}, with the
same semantics as a basic \code{\LinkA{Sequence}{Sequence.Rdash.class}},
except \code{i} may itself be a \code{RangesList}, in which case
only the ranges in \code{x} that overlap with those in \code{i}
are kept. See the
\code{\LinkA{findOverlaps}{findOverlaps,RangesList,RangesList.Rdash.method}}
method for more details.

}
\end{Section}
\begin{Section}{Coercion}
In the code snippets below, \code{x} and \code{from} are a
\code{RangesList} object.

\describe{
\item[] \code{as.data.frame(x, row.names = NULL, optional = FALSE)}:
Coerces \code{x} to a \code{data.frame}. Essentially the same as
calling
\code{data.frame(space=rep(names(x), elementLengths(x)),
                       as.data.frame(unlist(x, use.names=FALSE)))}.

\item[] \code{as(from, "RangedData")}: Coerces \code{from} to a
\code{\LinkA{RangedData}{RangedData.Rdash.class}} with zero columns and the same
ranges as in \code{from}.

\item[] \code{as(from, "SimpleIRangesList")}: Coerces \code{from},
to a \code{\LinkA{SimpleIRangesList}{SimpleIRangesList.Rdash.class}}, requiring
that all \code{Ranges} elements are coerced to internal
\code{IRanges} elements. This is a convenient way to ensure that all
\code{Ranges} have been imported into R (and that there is no
unwanted overhead when accessing them).

\item[] \code{as(from, "CompressedIRangesList")}: Coerces \code{from},
to a \code{\LinkA{CompressedIRangesList}{CompressedIRangesList.Rdash.class}}, requiring
that all \code{Ranges} elements are coerced to internal
\code{IRanges} elements. This is a convenient way to ensure that all
\code{Ranges} have been imported into R (and that there is no
unwanted overhead when accessing them).

\item[] \code{as(from, "SimpleNormalIRangesList")}: Coerces \code{from},
to a \code{\LinkA{SimpleNormalIRangesList}{SimpleNormalIRangesList.Rdash.class}}, requiring
that all \code{Ranges} elements are coerced to internal
\code{NormalIRanges} elements.

\item[] \code{as(from, "CompressedNormalIRangesList")}: Coerces
\code{from}, to a \code{\LinkA{CompressedNormalIRangesList}{CompressedNormalIRangesList.Rdash.class}},
requiring that all \code{Ranges} elements are coerced to internal
\code{NormalIRanges} elements.

}
\end{Section}
\begin{Section}{Arithmetic Operations}
Any arithmetic operation, such as \code{x + y}, \code{x * y}, etc,
where \code{x} is a \code{RangesList}, is performed identically on each
element. Currently, \code{Ranges} supports only the \code{*} operator,
which zooms the ranges by a numeric factor.
\end{Section}
\begin{Author}\relax
Michael Lawrence
\end{Author}
\begin{Examples}
\begin{ExampleCode}
  range1 <- IRanges(start=c(1,2,3), end=c(5,2,8))
  range2 <- IRanges(start=c(15,45,20,1), end=c(15,100,80,5))
  named <- RangesList(one = range1, two = range2)
  length(named) # 2
  start(named) # same as start(c(range1, range2))
  names(named) # "one" and "two"
  named[[1]] # range1
  unnamed <- RangesList(range1, range2)
  names(unnamed) # NULL

  # edit the width of the ranges in the list
  edited <- named
  width(edited) <- rep(c(3,2), elementLengths(named))
  edited

  # subset by RangesList
  range1 <- IRanges(start=c(1,2,3), end=c(5,2,8))
  range2 <- IRanges(start=c(1,15,20,45), end=c(5,15,100,80))
  collection <- RangesList(one = range1, range2)
  collection[RangesList()] # empty elements
  collection[RangesList(IRanges(4, 6), IRanges(50, 70))]
  collection[RangesList(IRanges(50, 70), one=IRanges(4, 6))]

  # same as list(range1, range2)
  as.list(RangesList(range1, range2))

  # coerce to data.frame
  as.data.frame(named)

  # set the universe
  universe(named) <- "hg18"
  universe(named)
  RangesList(range1, range2, universe = "hg18")

  ## zoom in 2X
  collection * 2
\end{ExampleCode}
\end{Examples}

