setMethod("start", "IRanges", function(x, ...) x@start)
setMethod("isEmpty", "NormalIRanges", function(x) length(x) == 0L)
warning("empty ", class(x), " object; returning -Inf")
warning("empty ", class(x), " object; returning Inf")
if (!is.integer(x_start) || !is.null(names(x_start)) || anyMissing(x_start))
return("'start(x)' must be an unnamed integer vector with no NAs")
return("'start(x)' and 'width(x)' must have the same length")
if (!is.integer(x_width) || !is.null(names(x_width)) || anyMissing(x_width))
return("'width(x)' must be an unnamed integer vector with no NAs")
if (length(x_width) != 0L && min(x_width) < 0L)
return("'widths(x)' cannot contain negative values")
new2("NormalIRanges", start=x@start, width=x@width, NAMES=x@NAMES, check=FALSE)
setAs("numeric", "IRanges", function(from) as(as.integer(from), "IRanges"))
x@width <- width(x) - start(x) + old_start
x@width[] <- width(x) + numeric2integer(value) - end(x)
value <- c(value, rep.int(NA, length(x) - length(value)))
valid_argnames <- c("start", "end", "width", "names")
do_atomic_update <- narg_in_sew == 2L &&
(is.null(names(object)) || ("names" %in% argnames))
ans_start <- replaceROWS(start(x), i, start(value))
ans_width <- replaceROWS(width(x), i, width(value))
ans <- initialize(x, start=ans_start, width=ans_width)
stop("\"c\" method for IRanges objects ",
stop("'ignore.mcols' must be TRUE or FALSE")
new_start <- unlist(lapply(args, start), use.names=FALSE)
new_width <- unlist(lapply(args, width), use.names=FALSE)
ans <- update(x, start=new_start, width=new_width, names=new_names, check=FALSE)

### The SEW0 interface: start=NULL/end=NULL/width=NULL
### Some of the functions that support the SEW0 interface: IRanges(), Views(),
## We want IRanges(start=integer(0), width=5) and
## IRanges(end=integer(0), width=5) to work and return an empty IRanges
### The safe and user-friendly "IRanges" constructor.
"'start' is an Rle, but not a logical Rle object"
"'end' and 'width' must be NULLs when 'start' is a logical "
## The returned IRanges instance is guaranteed to be normal.
### The SEW interface: start=NA/end=NA/width=NA
### Some of the functions that support the SEW interface: narrow(),
### XVector::subseq(), XVector::xvcopy(), Biostrings::BStringSet() (and
### Use of 'rep.refwidths=TRUE' is supported only when 'refwidths' is of
### If 'rep.refwidths=FALSE' (the default) then 'start', 'end' and 'width'
### are recycled to 'length(refwidths)' (it's an error if one of them is
### longer than 'refwidths'). Otherwise, 'refwidths' is replicated L times
### where L is the length of the longest of 'start', 'end' and 'width'.
### The returned value is an IRanges object of the same length as 'refwidths'
### (after replication if 'rep.refwidths=TRUE').
"'refwidths' must be a vector of integers"
## From here, 'refwidths', 'start', 'end' and 'width' are guaranteed to be
## integer vectors. NAs in 'start', 'end' and 'width' are OK but not in
## 'refwidths' so this should be checked at the C level.
"'translate.negative.coord' must be TRUE or FALSE"
"'allow.nonnarrowing' must be TRUE or FALSE"
"'start', 'end' and 'width' cannot mix zero-length "
## Check 'start', 'end', and 'width' *without* recycling them. Recycling
"'rep.refwidths=TRUE' can be used only when 'refwidths' "
## 'ans_len' is the length of the longest of 'start', 'end'
"'start', 'end' or 'width' is longer than 'refwidths'"
"cannot recycle empty 'start', 'end' or 'width'"
### Returns an IRanges instance of length 1. Not exported.
"  Please make sure the supplied 'start', 'end' and 'width' arguments\n"
"  are defining a region that is within the limits of the sequence."