Pulls an expression matrix out of a Seurat object, a
SingleCellExperiment, a sparse dgCMatrix or a plain
matrix, returning a dense numeric matrix with features in rows and
cells in columns — the layout the GPU engine expects. Optional
genes/cells subsetting happens before any sparse-to-dense
materialisation.
ggml_extract(x, assay = NULL, layer = "data", genes = NULL, cells = NULL, ...)# S3 method for matrix
ggml_extract(x, assay = NULL, layer = "data", genes = NULL, cells = NULL, ...)
# S3 method for dgCMatrix
ggml_extract(
x,
assay = NULL,
layer = "data",
genes = NULL,
cells = NULL,
keep_sparse = FALSE,
...
)
# S3 method for Seurat
ggml_extract(
x,
assay = NULL,
layer = "data",
genes = NULL,
cells = NULL,
keep_sparse = FALSE,
...
)
# S3 method for SingleCellExperiment
ggml_extract(
x,
assay = NULL,
layer = "logcounts",
genes = NULL,
cells = NULL,
keep_sparse = FALSE,
...
)
A dense numeric matrix, features x cells.
A Seurat, SingleCellExperiment, dgCMatrix or
matrix object.
Assay to read from. Seurat: defaults to the object's default assay. Ignored for bare matrices.
Layer / slot to read. Seurat v5: a layer name (default
"data"); Seurat v4: mapped to the slot argument of
GetAssayData. Ignored for bare matrices.
Optional character/integer vector selecting feature rows.
Optional character/integer vector selecting cell columns.
Passed to methods.
If TRUE, return the (subset) dgCMatrix without
densifying. Only the LogNormalize path (op = "normalize") sets this,
since it transforms the stored non-zeros in place; every other op leaves it
FALSE and gets a dense matrix as before.
For a SingleCellExperiment the layer argument names an
assay (default "logcounts", the log-normalised matrix); it is read
with SummarizedExperiment::assay().