ir1 <- successiveIRanges(c(19, 5, 0, 8, 5))
flank(ir3, 2, start=c(FALSE, TRUE, FALSE))
promoters(ir4, upstream=0, downstream=0) ## no change
promoters(ir4, upstream=0, downstream=1) ## start value only
promoters(ir4, upstream=1, downstream=0) ## single upstream nucleotide
ir2b <- punion(z$left, z$right, fill.gap=TRUE)

### Title: IRanges and NormalIRanges objects
### Aliases: class:IRanges IRanges-class start,IRanges-method
## All the methods defined for Ranges objects work on IRanges objects.
## Also see ?`IRanges-utils` and ?`setops-methods` for additional
## all.iranges <- c(ir1, ir2, ir3) ## This will raise an error
## Using an IRanges object for storing a big set of ranges is more
## efficient than using a standard R data frame:
## Internal representation is more compact

showClass("IRanges")  # shows (some of) the known subclasses
all.iranges <- c(ir1, ir2, ir3, ignore.mcols=TRUE)
system.time(x16 <- x[c(TRUE, rep.int(FALSE, 15))])
system.time(y16 <- y[c(TRUE, rep.int(FALSE, 15)), ])

### Title: The IRanges constructor and supporting functions
### Aliases: IRanges-constructor IRanges solveUserSEW0 solveUserSEW
## The start/end/width arguments are recycled:

IRanges(start=c(2, 0, NA), end=c(NA, NA, 14), width=11:0)
IRanges()  # IRanges instance of length zero
x <- IRanges(c(FALSE, TRUE, TRUE, FALSE, TRUE))  # logical vector input
x <- IRanges(Rle(1:30) %% 5 <= 2)  # logical Rle input
solveUserSEW(refwidths, start=c(3, -4, NA), end=c(-2, NA))

### Aliases: IRanges-utils successiveIRanges breakInChunks whichAsIRanges
# 13 chunks of size 50000 (last chunk is
# 3 non-empty ranges ordered from left to right and

breakInChunks(600999, 50000)  # 13 chunks of size 50000 (last chunk is
asNormalIRanges(x)  # 3 non-empty ranges ordered from left to right and
x16 <- asNormalIRanges(x16)      # Error!

### Title: List of IRanges and NormalIRanges

named <- IRangesList(one = range1, two = range2)

### Title: Test if an atomic vector or array is constant
### Aliases: isConstant isConstant,integer-method isConstant,numeric-method
## This method does its best to handle rounding errors and special
## values NA, NaN, Inf and -Inf in a way that "makes sense".
## Below we only illustrate handling of rounding errors.
## Here values in 'x' are "conceptually" the same:
## However, due to machine rounding errors, they are not *strictly*
## 'isConstant(x)' uses 'all.equal()' internally to decide whether
## the values in 'x' are all the same or not:
# (but this is highly machine dependent!)