Create a sf data frame object (package `sf`) using CosMx cell coordinates

smi2sf(seurat = NULL, poly_file = NULL, id = "cell_ID", return.seurat = F)

Arguments

seurat

a Seurat object containing CosMx data

poly_file

character string indicating the path for the polygon coordinates file. This parameter is ignored if Seurat object has been created using the function `prepare_cosmx_seurat()`

id

name of the variable to use as single cell identifier

return.seurat

boolean, whether returning the input Seurat file with the sf object stored in the Kandinsky `sf` slot or Seurat `misc` slot (`TRUE`) or the nb object alone (`FALSE`). Default value is `TRUE`

Value

Seurat object with the new sf object stored in the `misc` slot, or in the Kandinsky `sf` slot, or the sf object alone, depending on the `return.seurat` parameter

Details

This function will use CosMx cell boundary coordinates to create cell polygon geometries using the R package `sf`