SparseReadIter
is a class that allows for iteration over
a reads on SOMASparseNDArray.
Super class
tiledbsoma::ReadIter
-> SparseReadIter
Methods
Inherited methods
Method new()
Create (lifecycle: maturing).
Usage
SparseReadIter$new(sr, shape, zero_based = FALSE)
Arguments
sr
Soma reader pointer.
shape
Shape of the full matrix.
zero_based
Logical, if
TRUE
will make iterator for Matrix::dgTMatrix-class otherwise matrixZeroBasedView.
Method concat()
Concatenate remainder of iterator.
Returns
matrixZeroBasedView of Matrix::sparseMatrix.
Examples
dir <- withr::local_tempfile(pattern = "matrix-iter")
dir.create(dir, recursive = TRUE)
(exp <- load_dataset("soma-exp-pbmc-small", dir))
#> <SOMAExperiment>
#> uri: /tmp/RtmpjD0Pq2/matrix-iter270924e7c8c4/soma-exp-pbmc-small
qry <- exp$axis_query("RNA")
xqry <- qry$X("data")
iter <- xqry$sparse_matrix()
stopifnot(inherits(iter, "SparseReadIter"))
while (!iter$read_complete()) {
block <- iter$read_next()
}