IntegerRangesList-class {IRanges} | R Documentation

## IntegerRangesList objects

### Description

The IntegerRangesList virtual class is a general container for storing a list of IntegerRanges objects.

Most users are probably more interested in the IRangesList container, an IntegerRangesList derivative for storing a list of IRanges objects.

### Details

The place of IntegerRangesList in the Vector class hierarchy:

                                   Vector
                                     ^
                                     |
                                    List
                                     ^
                                     |
                                 RangesList
                                  ^     ^
                                 /       \
                                /         \
                               /           \
                              /             \
                             /               \
                            /                 \
             IntegerRangesList               GenomicRangesList
                    ^                                 ^
                    |                                 |
               IRangesList                       GRangesList
                 ^     ^                           ^     ^
                /       \                         /       \
               /         \                       /         \
              /           \                     /           \
       SimpleIRangesList   \             SimpleGRangesList   \
                CompressedIRangesList             CompressedGRangesList

Note that the Vector class hierarchy has many more classes. In particular Vector, List, RangesList, and IntegerRangesList have other subclasses not shown here.

### Accessors

In the code snippets below, `x` is a `IntegerRangesList` object.

All of these accessors collapse over the spaces:

  `start(x), start(x) <- value`: Get or set the starts of the ranges. When setting the starts, `value` can be an integer vector of length `sum(elementNROWS(x))` or an IntegerList object of length `length(x)` and names `names(x)`.

  `end(x), end(x) <- value`: Get or set the ends of the ranges. When setting the ends, `value` can be an integer vector of length `sum(elementNROWS(x))` or an IntegerList object of length `length(x)` and names `names(x)`.

  `width(x), width(x) <- value`: Get or set the widths of the ranges. When setting the widths, `value` can be an integer vector of length `sum(elementNROWS(x))` or an IntegerList object of length `length(x)` and names `names(x)`.

  `space(x)`: Gets the spaces of the ranges as a character vector. This is equivalent to `names(x)`, except each name is repeated according to the length of its element.

### Coercion

In the code snippet below, `x` is an `IntegerRangesList` object.

  `as.data.frame(x, row.names = NULL, optional = FALSE, ..., value.name = "value", use.outer.mcols = FALSE, group_name.as.factor = FALSE)`: Coerces `x` to a `data.frame`. See as.data.frame on the `List` man page for details (?`List`).

In the following code snippet, `from` is something other than a `IntegerRangesList`:

  `as(from, "IntegerRangesList")`: When `from` is a `IntegerRanges`, analogous to `as.list` on a vector.

### Arithmetic Operations

Any arithmetic operation, such as `x + y`, `x * y`, etc, where `x` is a `IntegerRangesList`, is performed identically on each element. Currently, `IntegerRanges` supports only the `*` operator, which zooms the ranges by a numeric factor.

### Author(s)

M. Lawrence & H. Pagès

### See Also

- IRangesList objects.

- IntegerRanges and IRanges objects.

### Examples

    ## ---------------------------------------------------------------------
    ## Basic manipulation
    ## ---------------------------------------------------------------------

    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 <- IRangesList(one = range1, two = range2)
    length(named) # 2
    start(named) # same as start(c(range1, range2))
    names(named) # "one" and "two"
    named[[1]] # range1
    unnamed <- IRangesList(range1, range2)
    names(unnamed) # NULL

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

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

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

    IRangesList(range1, range2)

    ## zoom in 2X
    collection <- IRangesList(one = range1, range2)
    collection * 2

[Package IRanges version 2.22.2 Index]