Skip to contents

Builds a Seurat object with raw counts, normalised data, cell metadata, and the spatial coordinates stored both in metadata (x, y) and as a "spatial" dimensional reduction. Cell IDs repeated across samples are made unique with make.unique() for the Seurat cell names; the metadata keep the original cell_id. Export refuses marker identifiers that Seurat would rewrite (such as underscores); use as_SpatialExperiment() for unchanged identifiers, or rename markers explicitly before export. The reduction uses named x/y only. Extra coordinate columns are retained in misc$phenoscapR_coordinates, keyed by unique Seurat cell names, and restored by as_SpatialCellData() after cell subsetting or reordering. Saved columns never override current x/y. Conflicting x/y metadata are refused rather than overwritten; rename such metadata explicitly before export.

Usage

as_Seurat(object)

Arguments

object

A SpatialCellData-class object.

Value

A Seurat object.

Examples

# \donttest{
if (requireNamespace("Seurat", quietly = TRUE)) {
  data(phenoscapR_example)
  se <- as_Seurat(phenoscapR_example)
}
# }