Skip to contents

Container and metadata methods shared by every RangedTupleList subclass.

nrow() counts elements, ncol() counts metadata columns and colnames() names them, so the collections read exactly as the DFrame-shaped ones they replace. $ and $<- read and write mcols columns. [ selects elements and rejects a second argument, because the stock method would silently discard it. endoapply() maps over the elements and rebuilds the object with its collection-level slots intact.

Usage

# S4 method for class 'RangedTupleList'
nrow(x)

# S4 method for class 'RangedTupleList'
ncol(x)

# S4 method for class 'RangedTupleList'
colnames(x, do.NULL = TRUE, prefix = "col")

# S4 method for class 'RangedTupleList'
x$name

# S4 method for class 'RangedTupleList'
x$name <- value

# S4 method for class 'RangedTupleList,ANY,ANY,ANY'
x[i, j, ..., drop = TRUE]

# S4 method for class 'RangedTupleList,ANY,ANY'
x[[i, j, ...]] <- value

# S4 method for class 'RangedTupleList'
endoapply(X, FUN, ...)

# S4 method for class 'RangedTupleList'
bindROWS(
  x,
  objects = list(),
  use.names = TRUE,
  ignore.mcols = FALSE,
  check = TRUE
)

Arguments

x, X

A RangedTupleList collection.

do.NULL, prefix

Unused; present for generic compatibility.

name

An mcols column name.

value

Replacement value for that column.

i

Element selector.

j

Not supported; supplying it is an error.

...

Additional arguments passed on.

drop

Passed through to the inherited method.

FUN

A function applied to each element, returning a GRanges.

Value

nrow() and ncol() integers; colnames() a character vector; $ a metadata column; $<-, [ and endoapply() a collection of the same class.

Examples

data(qtlSumStatsMulticontextExample)
mc <- qtlSumStatsMulticontextExample
# A collection reads as a table of tuples: one row per element, with the
# identity in mcols and the variants in the element itself.
nrow(mc)
#> [1] 3
ncol(mc)
#> [1] 4
colnames(mc)
#> [1] "study"   "context" "trait"   "varY"   
mc$context
#> [1] "brain"  "blood"  "muscle"
length(mc[[1]])
#> [1] 200
# Row subsetting and endoapply() both return the same class, carrying the
# collection-level slots with them.
class(mc[1:2])
#> [1] "QtlSumStats"
#> attr(,"package")
#> [1] "pecotmr"
lengths(endoapply(mc, head, n = 5L))
#> [1] 5 5 5