PicklerickMatrix() returns a DelayedMatrix (features x cells) whose
blocks are read on demand through scx. Column (cell) selections read only
the selected cells from disk on h5ad and Zarr stores; other formats read
the whole matrix per block and keep the selection.
Usage
PicklerickMatrix(path, layer = NULL, chunk_size = 5000L)
PicklerickMatrixSeed(path, layer = NULL, chunk_size = 5000L)
# S4 method for class 'PicklerickMatrixSeed'
dim(x)
# S4 method for class 'PicklerickMatrixSeed'
dimnames(x)
# S4 method for class 'PicklerickMatrixSeed'
show(object)
# S4 method for class 'PicklerickMatrixSeed'
is_sparse(x)
# S4 method for class 'PicklerickMatrixSeed'
chunkdim(x)
# S4 method for class 'PicklerickMatrixSeed'
extract_sparse_array(x, index)
# S4 method for class 'PicklerickMatrixSeed'
extract_array(x, index)Arguments
- path
Path to an
.h5adfile,.zarrdirectory, or any other format scx reads.- layer
Name of a layer to expose instead of
X(h5ad and Zarr).NULL(default) exposesX.- chunk_size
Cells per internal read chunk. For formats other than h5ad and Zarr, also the block width in cells (the seed's
chunkdim()).- x
A
PicklerickMatrixSeed.- object
A
PicklerickMatrixSeed.- index
A list of two subscripts (features, cells), each an integer vector or
NULLfor all, asS4Arrays::extract_array()passes it.
Details
Block-wise operations (rowSums(), colSums(), blockApply(), ...) take
every feature for a range of cells per block. On h5ad and Zarr the number
of cells per block follows DelayedArray's block size, so
DelayedArray::setAutoBlockSize() sets the peak memory, as for HDF5Array
seeds. Other formats read the whole matrix per block, so their blocks are
chunk_size cells wide, to keep the number of passes down.
Examples
if (FALSE) { # \dontrun{
m <- PicklerickMatrix("pbmc.zarr")
dim(m)
m[1:10, 1:5] # reads 5 cells
DelayedArray::colSums(m) # block-wise
DelayedArray::setAutoBlockSize(50e6) # smaller blocks, lower peak memory
} # }