if (!is.numeric(x) && !(is.atomic(x) && all(is.na(x))))
stop("'", argname, "' must be a numeric vector (or NULL)")
solveUserSEW0 <- function(start=NULL, end=NULL, width=NULL)
.Call2("solve_user_SEW0", start, end, width, PACKAGE="IRanges")
IRanges <- function(start=NULL, end=NULL, width=NULL, names=NULL)
stop("'end' and 'width' must be NULLs ",
ans <- new2("IRanges", start=start(start), width=width(start),
if ((is.logical(start) && !all(is.na(start))) || is(start, "Rle")) {
if (is(start, "Rle") && !is.logical(runValue(start)))
stop("'start' is an Rle, but not a logical Rle object")
stop("'end' and 'width' must be NULLs when 'start' is a logical ",
ans <- solveUserSEW0(start=start, end=end, width=width)
stop("'", argname, "' must be a vector of integers")
solveUserSEW <- function(refwidths, start=NA, end=NA, width=NA,
stop("'refwidths' must be a vector of integers")
stop("'rep.refwidths' must be TRUE or FALSE")
stop("'translate.negative.coord' must be TRUE or FALSE")
stop("'allow.nonnarrowing' must be TRUE or FALSE")
Lsew <- c(length(start), length(end), length(width))
stop("'start', 'end' and 'width' cannot mix zero-length ",
stop("'rep.refwidths=TRUE' can be used only when 'refwidths' ",
stop("'start', 'end' or 'width' is longer than 'refwidths'")
stop("cannot recycle empty 'start', 'end' or 'width'")
solveUserSEWForSingleSeq <- function(x_length, start=NA, end=NA, width=NA)
"  Please make sure the supplied 'start', 'end' and 'width' arguments\n",
"  are defining a region that is within the limits of the sequence.")

### Utility functions for creating or modifying IRanges objects
### Note that the returned IRanges object is guaranteed to be normal in the
###   (b) when length(width) == 1 and width > 0
###   (c) when length(width) >= 2 and all(width > 0) and all(gapwidth > 0)
### However, the function doesn't try to turn the result into a NormalIRanges
# unname() used to be broken on 0-length vectors
"'width' cannot contain NAs or negative values"
"'gapwidth' must a single integer or an integer vector "
"with one less element than the 'width' vector"
## 'ans_start' could contain NAs in case of an integer overflow in
## cumsum(), hence the use of 'check=TRUE' here:
"'totalsize' must be a non-negative integer"
"'chunksize' must be a positive integer"
### Note that unlike the standard which() function, whichAsIRanges() drops
### Coercing an IRanges object to a NormalIRanges object.