Writes a ggml_result back into the appropriate slot of a Seurat
or SingleCellExperiment object, returning the updated object. The
destination depends on
result$metadata$kind: a dimensionality reduction (the default) goes into
a DimReduc; a "transform" (normalize / scale) overwrites an assay
layer; a "graph" (neighbors) writes <assay>_nn and
<assay>_snn Graph objects into @graphs, exactly where
Seurat's FindNeighbors puts them so FindClusters can consume them.
Component standard deviations and the backend used are recorded alongside so
downstream tools and the user can see how the result was produced.
ggml_inject(
x,
result,
reduction_name = "ggml",
key = "GGML_",
assay = NULL,
...
)# S3 method for Seurat
ggml_inject(
x,
result,
reduction_name = "ggml",
key = "GGML_",
assay = NULL,
...
)
# S3 method for SingleCellExperiment
ggml_inject(
x,
result,
reduction_name = "ggml",
key = "GGML_",
assay = NULL,
...
)
The updated container.
A Seurat object (the one the data was extracted from).
A ggml_result.
Name of the reduction slot to create, e.g.
"ggml" (default). For Seurat this becomes x[["ggml"]].
Column-name prefix for the embedding, e.g. "GGML_".
Assay to associate the reduction with (Seurat). Defaults to the object's default assay.
Passed to methods.