Description Details Accessors Coercion Arithmetic Operations Author(s) See Also Examples
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.
The place of IntegerRangesList in the Vector class hierarchy:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 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.
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.
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.
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.
M. Lawrence & H. Pagès
IRangesList objects.
IntegerRanges and IRanges objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ## ---------------------------------------------------------------------
## 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
|
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, basename, cbind, colMeans, colSums, colnames,
dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
intersect, is.unsorted, lapply, lengths, mapply, match, mget,
order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply,
union, unique, unsplit, which, which.max, which.min
Loading required package: S4Vectors
Loading required package: stats4
Attaching package: 'S4Vectors'
The following object is masked from 'package:base':
expand.grid
[1] 2
IntegerList of length 2
[["one"]] 1 2 3
[["two"]] 15 45 20 1
[1] "one" "two"
IRanges object with 3 ranges and 0 metadata columns:
start end width
<integer> <integer> <integer>
[1] 1 5 5
[2] 2 2 1
[3] 3 8 6
NULL
IRangesList of length 2
$one
IRanges object with 3 ranges and 0 metadata columns:
start end width
<integer> <integer> <integer>
[1] 1 3 3
[2] 2 4 3
[3] 3 5 3
$two
IRanges object with 4 ranges and 0 metadata columns:
start end width
<integer> <integer> <integer>
[1] 15 16 2
[2] 45 46 2
[3] 20 21 2
[4] 1 2 2
[[1]]
IRanges object with 3 ranges and 0 metadata columns:
start end width
<integer> <integer> <integer>
[1] 1 5 5
[2] 2 2 1
[3] 3 8 6
[[2]]
IRanges object with 4 ranges and 0 metadata columns:
start end width
<integer> <integer> <integer>
[1] 15 15 1
[2] 45 100 56
[3] 20 80 61
[4] 1 5 5
group group_name start end width
1 1 one 1 5 5
2 1 one 2 2 1
3 1 one 3 8 6
4 2 two 15 15 1
5 2 two 45 100 56
6 2 two 20 80 61
7 2 two 1 5 5
IRangesList of length 2
[[1]]
IRanges object with 3 ranges and 0 metadata columns:
start end width
<integer> <integer> <integer>
[1] 1 5 5
[2] 2 2 1
[3] 3 8 6
[[2]]
IRanges object with 4 ranges and 0 metadata columns:
start end width
<integer> <integer> <integer>
[1] 15 15 1
[2] 45 100 56
[3] 20 80 61
[4] 1 5 5
IRangesList of length 2
$one
IRanges object with 3 ranges and 0 metadata columns:
start end width
<integer> <integer> <integer>
[1] 2 3 2
[2] 2 1 0
[3] 4 6 3
[[2]]
IRanges object with 4 ranges and 0 metadata columns:
start end width
<integer> <integer> <integer>
[1] 15 14 0
[2] 59 86 28
[3] 35 64 30
[4] 2 3 2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.