Skip to contents

Adds externally computed cell-type estimates to an existing SpatialExperiment. Rows are aligned by spot ID. Values are preserved without normalization; expression data, spatial coordinates, and images are unchanged.

Usage

import_deconvolution_results(spe, results, result_name)

Arguments

spe

A SpatialExperiment with unique, non-empty spot IDs.

results

A numeric matrix or data frame with spots as rows and cell types as columns. Row names must match all colnames(spe) exactly, in any order. Values must be finite and non-negative; they need not sum to one.

result_name

A prefix identifying the external result, for example "omnideconv_bayesprism". Use a syntactically valid R name starting with a letter. The names "expression" and "cluster" are reserved.

Value

The updated SpatialExperiment. Results are stored in colData as <result_name>_<cell_type>, with cell-type names converted using make.names(). Ambiguous names and collisions with existing columns are rejected. Use result_name with available_results(), plot_spatial(), and cluster() to select the imported result group.