Skip to contents

Get spatial coordinates from either SpatialExperiment or Seurat object

Usage

getSpatialCoords(x, image_id = NULL)

Arguments

x

SpatialExperiment or Seurat object

image_id

For Seurat objects, which image to use (default: first image)

Value

Matrix of spatial coordinates with rows as spots and columns as x,y coordinates

Examples

library(STexampleData)
spe <- Visium_humanDLPFC()
#> see ?STexampleData and browseVignettes('STexampleData') for documentation
#> loading from cache
coords <- getSpatialCoords(spe)
head(coords)
#>                    pxl_col_in_fullres pxl_row_in_fullres
#> AAACAACGAATAGTTC-1               3913               2435
#> AAACAAGTATCTCCCA-1               9791               8468
#> AAACAATCTACTAGCA-1               5769               2807
#> AAACACCAATAACTGC-1               4068               9505
#> AAACAGAGCGACTCCT-1               9271               4151
#> AAACAGCTTTCAGAAG-1               3393               7583