| RangesList-utils {IRanges} | R Documentation |
Utility functions for manipulating RangesList
objects.
# Intra-interval operations
## S4 method for signature 'RangesList'
flank(x, width, start=TRUE, both=FALSE, use.names=TRUE)
## S4 method for signature 'RangesList'
narrow(x, start=NA, end=NA, width=NA, use.names=TRUE)
## S4 method for signature 'RangesList'
resize(x, width, fix="start", use.names=TRUE)
## S4 method for signature 'RangesList'
restrict(x, start=NA, end=NA, keep.all.ranges=FALSE, use.names=TRUE)
## S4 method for signature 'RangesList'
shift(x, shift, use.names=TRUE)
# Inter-interval operations
## S4 method for signature 'RangesList'
disjoin(x)
## S4 method for signature 'RangesList'
gaps(x, start=NA, end=NA)
## S4 method for signature 'RangesList'
range(x, ..., na.rm = FALSE)
## S4 method for signature 'RangesList'
reduce(x, drop.empty.ranges=FALSE, min.gapwidth=1L,
with.inframe.attrib=FALSE)
# Set operations
## S4 method for signature 'RangesList,RangesList'
union(x, y)
## S4 method for signature 'RangesList,RangesList'
intersect(x, y)
## S4 method for signature 'RangesList,RangesList'
setdiff(x, y)
x, y |
A |
start, end |
For For For For |
width |
For For |
both |
If |
use.names |
|
fix |
For |
keep.all.ranges |
|
shift |
Either an integer vector or a IntegerList object containing the shift
information. Recycled as necessary so that each element corresponds to
a range in |
drop.empty.ranges |
|
min.gapwidth |
Ranges separated by a gap of at least |
with.inframe.attrib |
|
... |
For |
na.rm |
Ignored |
The flank method generates flanking ranges for each range in
x.
The narrow method narrows the ranges in x i.e. each range
in the returned RangesList object is a subrange of the corresponding
range in x.
The resize method resizes the ranges to the specified width where
either the start or end is used as an anchor.
The restrict method restricts the ranges in x to the
interval specified by the start and end arguments.
The shift method shifts all the ranges in x.
The disjoin method returns disjoint ranges by finding the
within element union of the end points of x.
The gaps method takes the complement (via gaps)
of each element in the list and returns the result as a
RangesList.
range finds the range, i.e.
a Ranges with one range, from the minimum start to the maximum
end, on each element in x and returns the result as a
RangesList. If there are additional RangesList objects
in ..., they are merged into x by name, if all objects
have names, otherwise, if they are all of the same length, by
position. Else, an exception is thrown.
The reduce method merges (via reduce) each of the
elements in the list and returns the result as a RangesList.
The union method performs elementwise union operations
for two RangesList objects.
The intersect method performs elementwise intersect
operations for two RangesList objects.
The setdiff method performs elementwise setdiff operations
for two RangesList objects.
A RangesList object. For flank, narrow, resize,
restrict, and shift, the length is the same as that of
x.
Michael Lawrence, H. Pages, P. Aboyoun
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)) range3 <- IRanges(start=c(-2,6,7), width=c(8,0,0)) # with empty ranges collection <- RangesList(one = range1, range2, range3) shift(collection, shift=5) restrict(collection, start=2, end=8) resize(collection, width=200) flank(collection, width=10) disjoin(collection) # these three are the same reduce(collection) RangesList(one = reduce(range1), reduce(range2), reduce(range3)) do.call(RangesList, lapply(collection, reduce)) # drop empty ranges reduce(collection, drop.empty.ranges=TRUE) # these three are the same gaps(collection) RangesList(one = gaps(range1), gaps(range2), gaps(range3)) do.call(RangesList, lapply(collection, gaps)) # 'range' rl <- RangesList(a = IRanges(c(1,2),c(4,3)), b = IRanges(c(4,6),c(10,7))) rl2 <- RangesList(c = IRanges(c(0,2),c(4,5)), a = IRanges(c(4,5),c(6,7))) range(rl, rl2) # matched by names names(rl2) <- NULL range(rl, rl2) # now by position # set operations union(rl, rl2) intersect(rl, rl2) setdiff(rl, rl2)