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
srSoma reader pointer.
shapeShape of the full matrix.
zero_basedLogical, if
TRUEwill 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/RtmpzG0UPS/matrix-iter29d22186bd9c/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()
}