if (is(x, "NormalIRanges") && !isSingleNumber(shift))
stop("'shift' must be a single number when shifting ",
shift <- recycleIntegerArg(shift, "shift", length(x))
errorIfWarning(new_start <- start(x) + shift)
errorIfWarning(new_end <- new_start + width(x) - 1L)
x <- update(x, start=new_start, width=width(x), check=FALSE)
x@ranges <- shift(ranges(x), shift=shift, use.names=use.names)
shift <- normargAtomicList1(shift, IntegerList, lx)
mendoapply("shift", x = x, shift = shift,
shift <- normargAtomicList2(shift, IntegerList, lx, eln)
shift(x@unlistData, shift = shift, use.names = use.names)
function(x, start=NA, end=NA, width=NA, use.names=TRUE)
stop("narrowing a NormalIRanges object is not supported")
solved_SEW <- solveUserSEW(width(x), start=start, end=end, width=width)
ans_start <- start(x) + start(solved_SEW) - 1L
x <- update(x, start=ans_start, width=ans_width, check=FALSE)
x@ranges <- narrow(ranges(x), start=start, end=end, width=width,
function(x, start = NA, end = NA, width = NA, use.names = TRUE)
start <- normargAtomicList1(start, IntegerList, lx)
end <- normargAtomicList1(end, IntegerList, lx)
width <- normargAtomicList1(width, IntegerList, lx)
mendoapply(narrow, x = x, start = start, end = end, width = width,
start <- normargAtomicList2(start, IntegerList, lx, eln)
end <- normargAtomicList2(end, IntegerList, lx, eln)
width <- normargAtomicList2(width, IntegerList, lx, eln)
narrow(x@unlistData, start = start, end = end, width = width,
start = start, end = end, width = width,
solved_SEW <- solveUserSEWForSingleSeq(width(x), start, end, width)
function(x, width, start=TRUE, both=FALSE, use.names=TRUE, ...)
function(x, width, start=TRUE, both=FALSE, use.names=TRUE)
stop("flanking a NormalIRanges object is not supported")
width <- recycleIntegerArg(width, "width", length(x))
stop("'start' must be logical without NA's")
ifelse(start, start(x) - abs(width), end(x) - abs(width) + 1L)
ifelse(start, ifelse(width < 0L, start(x), start(x) - width),
ifelse(width < 0L, end(x) + width + 1L, end(x) + 1L))
function(x, width, start = TRUE, both = FALSE, use.names = TRUE)
start <- normargAtomicList1(start, LogicalList, lx)
mendoapply(flank, x = x, width = width, start = start,
MoreArgs = list(both = both, use.names = use.names))
start <- normargAtomicList2(start, LogicalList, lx, eln)
flank(x@unlistData, width = width, start = start, both = both,
width = width, start = start, both = both,
stop("promoters on a NormalIRanges object is not supported")
stop("'upstream' must be a single integer")
stop("'downstream' must be a single integer")
stop("'upstream' and 'downstream' must be integers >= 0")
x@ranges <- promoters(ranges(x), upstream, downstream)
endoapply(x, promoters, upstream = upstream,
upstream = upstream, downstream = downstream),
stop("reflecting a NormalIRanges object is not supported")
stop("'bounds' must be a Ranges object")
if (length(x) > 1 && length(bounds) == 0)
stop("'bounds' is an empty Ranges object")
ans_start <- (2L * start(bounds) + width(bounds) - 1L) - end(x)
x <- update(x, start=ans_start, width=width(x), check=FALSE)
function(x, width, fix="start", use.names=TRUE, ...)
stop("resizing a NormalIRanges object is not supported")
stop("'width' must be a numeric vector without NA's")
stop("'width' values must be non-negative")
(is(fix, "Rle") && is.character(runValue(fix)))) ||
(length(fix) == 0L && length(x) > 0L) ||
stop("'fix' must be a character vector or character Rle ",
"with values in \"start\", \"end\", and \"center\"")
value <- extractROWS(ans_start, fixEnd) +
ans_start <- replaceROWS(ans_start, fixEnd, value)
fixCenter <- as(fix == "center", "IRanges")
value <- extractROWS(ans_start, fixCenter) +
ans_start <- replaceROWS(ans_start, fixCenter, value)
function(x, width, fix = "start", use.names = TRUE)
fix <- normargAtomicList1(fix, CharacterList, lx)
mendoapply(resize, x = x, width = width, fix = fix,
fix <- normargAtomicList2(fix, CharacterList, lx, eln)
resize(x@unlistData, width = width, fix = fix,
width = width, fix = fix, use.names = use.names),
function(x, start=NA, end=NA, keep.all.ranges=FALSE, use.names=TRUE)
Ranges.restrict <- function(x, start, end, drop.ranges.mode, use.names)
stop("'start' must be a vector of integers")
stop("'end' must be a vector of integers")
if (length(start) == 0L || length(start) > length(x))
if (length(end) == 0L || length(end) > length(x))
if (use.names) ans_names <- names(x) else ans_names <- NULL
far_too_left <- !is.na(start) & (ans_end < start)
far_too_left <- !is.na(start) & (ans_end < start - 1L)
ans_end[far_too_left] <- start[far_too_left] - 1L
too_left <- !is.na(start) & (ans_start < start)
far_too_right <- !is.na(end) & (ans_start > end)
far_too_right <- !is.na(end) & (ans_start > end + 1L)
ans_start[far_too_right] <- end[far_too_right] + 1L
too_right <- !is.na(end) & (ans_end > end)
stop("'keep.all.ranges' must be TRUE or FALSE")
stop("'keep.all.ranges=TRUE' is not supported ",
Ranges.restrict(x, start, end, drop.ranges.mode, use.names)
function(x, start = NA, end = NA, keep.all.ranges = FALSE,
mendoapply(restrict, x, start = start, end = end,
MoreArgs = list(keep.all.ranges = keep.all.ranges,
restrict(x@unlistData, start = start, end = end,
stop("'keep.all.ranges' must be FALSE in ",
middle <- narrow(x, start=start, end=end, width=width, use.names=FALSE)
if ((length(e1) < length(e2) && length(e1)) ||
stop("zoom factor length not a multiple of number of ranges")
update(r, start = ceiling(mid - w/2), width = floor(w), check = FALSE)
stop("adjustment would result in ranges with negative widths")
update(e1, start = start(e1) - e2, end = end(e1) + e2, check = FALSE)
relist(callGeneric(unlist(e1, use.names = FALSE), e2), e1)