ggml_inject: Inject a single-cell result back into its container

View source: R/sc_inject.R

ggml_injectR Documentation

Inject a single-cell result back into its container

Description

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.

Usage

ggml_inject(
  x,
  result,
  reduction_name = "ggml",
  key = "GGML_",
  assay = NULL,
  ...
)

## S3 method for class 'Seurat'
ggml_inject(
  x,
  result,
  reduction_name = "ggml",
  key = "GGML_",
  assay = NULL,
  ...
)

## S3 method for class 'SingleCellExperiment'
ggml_inject(
  x,
  result,
  reduction_name = "ggml",
  key = "GGML_",
  assay = NULL,
  ...
)

Arguments

x

A Seurat object (the one the data was extracted from).

result

A ggml_result.

reduction_name

Name of the reduction slot to create, e.g. "ggml" (default). For Seurat this becomes x[["ggml"]].

key

Column-name prefix for the embedding, e.g. "GGML_".

assay

Assay to associate the reduction with (Seurat). Defaults to the object's default assay.

...

Passed to methods.

Value

The updated container.


ggmlR documentation built on July 14, 2026, 1:08 a.m.