Description Constructing a TileDBArray Available operations Author(s) Examples
The TileDBArray class provides a DelayedArray backend for TileDB arrays (sparse and dense).
TileDBArray(x, attr)
returns a TileDBArray object given:
x
, a string containing a URI to a TileDB backend, most typically a path to a directory.
attr
, a string specifying the attribute to represent in the array.
Defaults to the first attribute.
Alternatively, x
can be a TileDBArraySeed object, in which case attr
is ignored.
TileDBArraySeed(x, attr)
returns a TileDBArraySeed
with the same arguments as described for TileDBArray
.
If x
is already a TileDBArraySeed, it is returned
directly without further modification.
DelayedArray(x)
returns a TileDBArray object
given x
, a TileDBArraySeed.
In all cases, two-dimensional arrays will automatically generate a TileDBMatrix, a subclass of the TileDBArray.
extract_array(x, index)
will return an ordinary array containing values from the TileDBArraySeed x
,
subsetted to the indices specified in index
.
The latter should be a list of length equal to the number of dimensions in x
,
where each entry is an integer vector or NULL
(in which case the entirety of the dimension is used).
extract_sparse_array(x, index)
will return a SparseArraySeed
containing the indices of non-zero entries in x
, subsetted to the indices in index
.
The latter should be a list of the same structure as described for extract_array
.
type(x)
will return a string containing the type of the TileDBArraySeed object x
.
Currently, only "integer"
, "logical"
and "double"
-precision is supported.
is_sparse(x)
will return a logical scalar indicating
whether the TileDBArraySeed x
uses a sparse format in the TileDB backend.
path(x)
will return a string containing the path to the TileDB backend directory.
chunkdim(x)
will return an integer vector containing the tile extent in each dimension.
This will be used as the chunk dimensions in methods like chunkGrid
.
All of the operations described above are also equally applicable to TileDBArray objects, as their methods simply delegate to those of the TileDBArraySeed.
All operations supported by DelayedArray objects are also available for TileDBArray objects.
Aaron Lun
1 2 3 4 5 6 7 8 9 10 11 12 | data <- matrix(rpois(10000, 5), nrow=100, ncol=100)
B <- as(data, "TileDBArray")
B
# Apply typical DelayedArray operations:
as.matrix(B[1:10,1:10])
B %*% runif(ncol(B))
# This also works for sparse arrays:
sdata <- Matrix::rsparsematrix(nrow=100, ncol=100, density=0.1)
C <- as(sdata, "TileDBArray")
C
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.