Reads only the genes in genes from path, for per-gene work (model
fitting, tests) on a gene subset.
Value
A dgCMatrix, cells x genes: one column per element of genes,
in that order, so each gene's counts are contiguous. Use t() for genes
x cells.
Details
Gene-major .h5ad / Zarr stores (written with
convert(..., gene_major = TRUE)) read just those genes. A Seurat,
SingleCellExperiment or SpatialExperiment .rds is inflated once to
index it, and the selected genes are then read in parallel; memory is
about 12 bytes per kept nonzero plus 4 bytes per nonzero of the whole
matrix. Cell-major .h5ad and other formats are refused; convert them
with gene_major = TRUE first. To read many blocks of one file, use
gene_blocks(), which opens it once.