Skip to contents

Create a lightweight SpatialExperiment from a spatial Seurat object using one assay layer, metadata, and resolved spatial coordinates.

Usage

srt_to_spe(
  object,
  assay = NULL,
  layer = "counts",
  coord.cols = c("col", "row"),
  image = NULL,
  include_meta = TRUE,
  coordinate_space = c("raw", "legacy_display"),
  srt = NULL
)

Arguments

object

A Seurat object.

assay

Assay to export. If NULL, use the selected image's assay, or the object's default assay when coordinates come from metadata.

layer

Assay layer to export.

coord.cols

Metadata coordinate columns. By default, SCOP resolves x/y first and then col/row.

image

Optional Seurat image name. When present, image-derived coordinates are used.

include_meta

Whether to include Seurat metadata as colData.

coordinate_space

Coordinate space exported to spatialCoords. "legacy_display" preserves the historical scaled/y-flipped behavior; "raw" (the default) preserves analysis distances. The source and transform are stored in metadata(spe)$scop_spatial_coordinates so that an explicit display export can be inverted by spe_to_srt().

srt

Deprecated alias for object; supply exactly one of the two. It will be removed in scop 1.0.0.

Value

A SpatialExperiment.