"replacement 'metadata' value must be a list"

setClass("Annotated", representation("VIRTUAL", metadata = "list"))
stop("replacement 'metadata' value must be a list")
names(value) <- NULL # instead of character()

prototype = prototype(elementType = "logical"),
prototype = prototype(elementType = "integer"),
prototype = prototype(elementType = "numeric"),
prototype = prototype(elementType = "complex"),
prototype = prototype(elementType = "character"),
prototype = prototype(elementType = "raw"),
prototype = prototype(elementType = "Rle"),

## Possible optimizations for compressed lists:
## - order/sort: unlist, order by split factor first
## - sum/mean: unlist, rowsum() with split factor
## - cumsum: unlist, cumsum and subtract offsets
### FIXME: these seem very similar to .asList().
"cannot create a SimpleAtomicList with non-atomic elements"
"cannot create a CompressedAtomicList with non-atomic elements"
### Equivalent to 'as.vector(as.list(x), mode=mode)' but faster on
### CompressedAtomicList objects (10x, 75x, or more, depending on 'length(x)').
"coercing an AtomicList object to an atomic vector "
"  objects with top-level elements of length <= 1"
"shorter object is not a multiple of longer object length"
"Only a single argument in '...' is supported for now"
### S3/S4 combo for unique.CompressedRleList
### S3/S4 combo for unique.SimpleRleList
## 'rlePart' cannot contain empty ranges so using
## Using 'hit.empty.query.ranges=TRUE' won't affect the result
## (because 'rlePart' cannot contain empty ranges) but it makes
## findOverlaps_Ranges_Partitioning() just a little bit faster.
"elementLengths() of 'x' and 'value' must match"
## 'x' cannot contain empty ranges so using
## 'hit.empty.query.ranges=TRUE' won't affect the result but
## it makes findOverlaps_Ranges_Partitioning() just a little

.ATOMIC_TYPES <- c("logical", "integer", "numeric", "complex",
prototype = prototype(elementType = "logical",
prototype = prototype(elementType = "integer",
prototype = prototype(elementType = "numeric",
prototype = prototype(elementType = "complex",
prototype = prototype(elementType = "character",
prototype = prototype(elementType = "raw",
prototype = prototype(elementType = "Rle",
else if (type == "integer" && class(arg1) == "character")
listData <- strsplitAsListOfIntegerVectors(arg1) # weird special case
AtomicListConstructor <- function(type, compress.default = TRUE) {
constructor <- eval(substitute(function(..., compress = compress.default) {
stop("'compress' must be TRUE or FALSE")
CompressedOrSimple <- if (compress) "Compressed" else "Simple"
stop("cannot create a SimpleAtomicList with non-atomic elements")
do.call(baseClass, c(listData, compress = FALSE))
CompressedAtomicList <- function(unlistData, partitioning) {
stop("cannot create a CompressedAtomicList with non-atomic elements")
new2(paste("Compressed", baseClass, sep = ""), unlistData = unlistData,
partitioning = partitioning, check = FALSE)
do.call(baseClass, c(listData, compress = TRUE))
valid_modes <- c("any", .ATOMIC_TYPES, "double", "list")
stop("coercing an AtomicList object to an atomic vector ",
"  objects with top-level elements of length <= 1")
ans <- base::rep.int(as.vector(NA, mode=mode), length(x))
ans[elt_lens == 1L] <- as.vector(unlist(x, use.names=FALSE), mode=mode)
stop("All element lengths must be <= 1")
x_dropped[lens > 0] <- unlist(x, use.names = FALSE)
CoercerToAtomicList <- function(type, compress) {
.coerceToList <- if (compress) coerceToCompressedList else coerceToSimpleList
setAs("ANY", CompressedClass, CoercerToAtomicList(type, compress = TRUE))
setAs("ANY", SimpleClass, CoercerToAtomicList(type, compress = FALSE))
setAs("ANY", Class, CoercerToAtomicList(type, compress = TRUE))
emptyOpsReturnValue <- function(.Generic, e1, e2, compress) {
recycleList <- function(x, length.out) {
warning("shorter object is not a multiple of longer object length")
signature(e1 = "SimpleAtomicList", e2 = "SimpleAtomicList"),
if (length(e1) == 0L || length(e2) == 0L) {
return(emptyOpsReturnValue(.Generic, e1, e2, compress = FALSE))
repLengthOneElements <- function(x, times) {
signature(e1 = "CompressedAtomicList", e2 = "CompressedAtomicList"),
return(emptyOpsReturnValue(.Generic, e1, e2, compress = TRUE))
zeroLength <- which((n1 == 0L) | (n2 == 0L))
signature(e1 = "SimpleAtomicList", e2 = "CompressedAtomicList"),
c("character" = "CharacterList", "complex" = "ComplexList",
"numeric" = "NumericList", "integer" = "IntegerList",
"logical" = "LogicalList", "raw" = "RawList",
signature(e1 = "CompressedAtomicList", e2 = "SimpleAtomicList"),
signature(e1 = "AtomicList", e2 = "atomic"),
signature(e1 = "atomic", e2 = "AtomicList"),
signature(e1 = "SimpleAtomicList", e2 = "atomic"),
signature(e1 = "atomic", e2 = "SimpleAtomicList"),
signature(e1 = "CompressedAtomicList", e2 = "atomic"),
signature(e1 = "atomic", e2 = "CompressedAtomicList"),
ans <- xcumsum - rep(xcumsum[start(partition)] -
digits <- ifelse(.Generic == "round", 0, 6)
SimpleAtomicList(lapply(x@listData, .Generic, digits = digits))
rowsumCompressedList <- function(x, ..., na.rm = FALSE) {
ans[non_empty] <- rowsum(x_flat, togroup(x), reorder = FALSE,
toViewFun <- list(max = viewMaxs, min = viewMins, sum = viewSums)
if (!is.null(viewFun <- toViewFun[[.Generic]])) {
ans <- viewFun(as(x, "RleViews"), na.rm = na.rm)
setMethod("all", "CompressedRleList", function(x, ..., na.rm = FALSE) {
stop("Only a single argument in '...' is supported for now")
ans[singletons] <- unlist(rv, use.names = FALSE)[singletons[togroup(rv)]]
names(args) <- sub("...", "", names(args), fixed = TRUE)
call2 <- as.call(c(as.name("@"), args[[whichArg]], "partitioning"))
unlistData = call1, partitioning = call2, check = FALSE))
args <- c(args[[whichArg]], as.name(f), args[-whichArg])
call <- as.call(c(as.name("sapply"), args, list(simplify = TRUE)))
as.call(c(as.name(outputBaseClass), call, compress = TRUE))
setMethod(f, c(rep("ANY", whichArg - 1L), inputClass, remainingSignature),
setListMethod(f, i, whichArg = whichArg,
setListMethod(f, "AtomicList", whichArg = whichArg,
remainingSignature = remainingSignature, endoapply = TRUE,
setListMethod(f, paste("Simple", inputBaseClass, sep = ""),
outputBaseClass = outputBaseClass, whichArg = whichArg,
remainingSignature = remainingSignature, mapply = mapply,
setListMethod(f, paste("Compressed", inputBaseClass, sep = ""),
applyToUnlist = applyToUnlist, where = where)
mapply = mapply, applyToUnlist = applyToUnlist,
unique.CompressedRleList <- function(x, incomparables=FALSE, ...)
unique.SimpleRleList <- function(x, incomparables=FALSE, ...)
unique(y, incomparables = incomparables, ...)
stop("Only one argument in '...' supported")
zeros <- structure(rep.int(0L, length(values)), names = values)
nms <- factor(rep.int(nms, elementLengths(x)), levels = nms)
ans <- table(nms, as.vector(unlist(x, use.names = FALSE)))
which.local <- which.global - start(part)[group] + 1L
ans <- seqsplit(which.local, factor(group, seq_len(length(x))))
for (i in c("IntegerList", "NumericList", "RleList")) {
setAtomicListMethod("diff", inputBaseClass = i, endoapply = TRUE)
setMethod("pmax", i, function(..., na.rm = FALSE)
mendoapply(pmax, ..., MoreArgs = list(na.rm = na.rm)))
setMethod("pmin", i, function(..., na.rm = FALSE)
mendoapply(pmin, ..., MoreArgs = list(na.rm = na.rm)))
setMethod("pmax.int", i, function(..., na.rm = FALSE)
mendoapply(pmax.int, ..., MoreArgs = list(na.rm = na.rm)))
setMethod("pmin.int", i, function(..., na.rm = FALSE)
mendoapply(pmin.int, ..., MoreArgs = list(na.rm = na.rm)))
use <- ifelse(na.rm, "na.or.complete", "everything")
mapply(var, x, y, MoreArgs=list(na.rm=na.rm, use=use))
mapply(cov, x, y, MoreArgs=list(use=use, method=match.arg(method)))
mapply(cor, x, y, MoreArgs=list(use=use, method=match.arg(method)))
function(x, na.rm=FALSE) sapply(x, sd, na.rm=na.rm)
function(x, na.rm=FALSE) sapply(x, median, na.rm=na.rm)
function(x, ...) sapply(x, quantile, ...)
stop("'center' argument is not supported")
sapply(x, mad, constant=constant, na.rm=na.rm, low=low, high=high)
function(x, na.rm=FALSE, type=7) sapply(x, IQR, na.rm=na.rm, type=type)
function(x, k, endrule = c("median", "keep", "constant"),
NumericList(lapply(x, runmed, k = k, endrule = match.arg(endrule),
print.level = print.level), compress = FALSE))
endoapply(x, runmed, k = k, endrule = match.arg(endrule),
algorithm = algorithm, print.level = print.level))
endoapply(x, runmed, k = k, endrule = match.arg(endrule)))
function(x, k, endrule = c("drop", "constant"), na.rm = FALSE)
endoapply(x, runmean, k = k, endrule = match.arg(endrule),
endoapply(x, runsum, k = k, endrule = match.arg(endrule),
function(x, k, wt, endrule = c("drop", "constant"), na.rm = FALSE)
endrule = match.arg(endrule), na.rm = na.rm))
function(x, k, i, endrule = c("drop", "constant"), na.rm = FALSE)
endoapply(x, runq, k = k, i = i, endrule = match.arg(endrule),
outputBaseClass = "IntegerList", applyToUnlist = TRUE)
outputBaseClass = "CharacterList", whichArg = 3L,
outputBaseClass = "CharacterList",  applyToUnlist = TRUE)
outputBaseClass = "CharacterList", applyToUnlist = TRUE)
stop("elementLengths() of 'x' and 'value' must match")
ans_unlistData <- shift(ranges(hits, x, listPart),
.showAtomicList <- function(object, minLines, ...)
cat(BiocGenerics:::labeledLine(label, object[[i]], labelSep = "",
" more element>\n", " more elements>\n"), sep="")
cat(classNameForDisplay(object), " of length ",
cat(classNameForDisplay(object), " of length ", lo,
" more element>\n", " more elements>\n"),
str <- paste(as.vector(head(x, 3)), collapse = ",")