"'elementType(x)' must be of class 'IRanges'"
## not for exporting, just a debugging utility

stop("'x' must be an 'IRangesList' object")
stop("'elementType(x)' must be of class 'IRanges'")
ptr <- .Call2("IntegerIntervalForest_new", from@unlistData, partitionLengths,
unlistData = .IntervalForestCall(x, "end") -
if (!missing(j) || length(list(...)) > 0L)
rl <- split(callGeneric(as(x, "IRanges"), i = i, ...),
cat("IntervalForest of length ", length(newobj), "\n", sep="")
.IntervalForestCall <- function(object, fun, ...) {
fun <- paste("IntervalForest", fun, sep = "_")
} else stop("unknown interval forest mode: ", object@mode)
cat("IntervalForest, levels: ", levels(object), "\n")

#validObject(object)  # causes an infinite recursion, because calls
# .valid.Vector.length(), which calls length(),
# which calls IntervalTreeCall(), which calls

representation(ptr = "externalptr", mode = "character"),
setMethod("length", "IntervalTree", function(x) IntervalTreeCall(x, "length"))
setMethod("start", "IntervalTree", function(x) IntervalTreeCall(x, "start"))
setMethod("end", "IntervalTree", function(x) IntervalTreeCall(x, "end"))
ptr <- .Call2("IntegerIntervalTree_new", from, PACKAGE="IRanges")
new2("IntervalTree", ptr = ptr, mode = "integer", check=FALSE)
IntervalTreeCall <- function(object, fun, ...) {
fun <- paste("IntervalTree", fun, sep = "_")
} else stop("unknown interval tree mode: ", object@mode)

function(x, select = c("all", "first", "last", "arbitrary"),
mat <- mat[mat[,1L] != mat[,2L],,drop=FALSE]
if (select != "all") { # relies on 'mat' sorted by subject
ans <- lapply(x, processSelfMatching, select, ignoreSelf,
newList("HitsList", ans, subjectOffsets = x@subjectOffsets)
ans <- processSelfMatching(x@unlistData, select = select,
ignoreSelf = ignoreSelf, ignoreRedundant = ignoreRedundant)

"'shift' must be a single number when shifting "
## Note that we won't do anything with 'new_end', we just want to
"narrowing a NormalIRanges object is not supported"
### FIXME: This is a quick and dirty implementation that is TOTALLY
### inefficient. It needs to be improved a lot!
### FIXME: It's also broken because it can return a GappedRanges object with
#    function(x, start=NA, end=NA, width=NA, use.names=TRUE)
#        solved_SEW <- solveUserSEW(width(x), start=start, end=end, width=width)
#        start2 <- start(x) + start(solved_SEW) - 1L
#        end2 <- start2 + width(solved_SEW) - 1L
#        for (i in seq_len(length(x))) {
#            x@cnirl[[i]] <- restrict(x[[i]], start=start2[i], end=end2[i])
"flanking a NormalIRanges object is not supported"
"promoters on a NormalIRanges object is not supported"
"'upstream' and 'downstream' must be integers >= 0"
"reflecting a NormalIRanges object is not supported"
"resizing a NormalIRanges object is not supported"
"'width' must be a numeric vector without NA's"
"'fix' must be a character vector or character Rle "
"with values in \"start\", \"end\", and \"center\""
### We distinguish 4 exclusive types of relationship between a range in 'x'
### and its corresponding restriction interval (specified by 'start' and
###   - Type 1: They have a non-empty intersection.
###   - Type 2: The restriction interval is empty but its bounds are within
###   - Type 3: The restriction interval is not empty and is adjacent to the
###             range in 'x' i.e. the range in 'x' ends at start - 1 or starts
###   0L: Ranges in 'x' that are empty after restriction are dropped.
###   1L: Ranges in 'x' that are not overlapping and not even adjacent
###       with the region of restriction are dropped.
###       "Not overlapping and not adjacent" means that they end strictly
###       before start - 1 or start strictly after end + 1.
###       Those that are not overlapping but are however adjacent are kept
###       (and are empty after restriction).
###   2L: All ranges in 'x' are kept after restriction.
### Note that the only mode compatible with a NormalIRanges object is 0L.
## Drop the ranges that are far too left with respect to the
## Drop the ranges that are far too right with respect to the
"'keep.all.ranges' must be TRUE or FALSE"
"'keep.all.ranges=TRUE' is not supported "
### Zooming (symmetrically scales the width).
### TODO: Implement a zoom() generic and methods and make the "Ops" method
### below a simple convenience wrapper for zoom(). Recommend the use of zoom()
### over "Ops" methods in packages and scripts. Reserve "Ops" methods as a
### convenience when working interactively.
"zoom factor length not a multiple of number of ranges"
"adjustment would result in ranges with negative widths"