Skip to contents

This is a utility function used to export data required for FeatureViewer.

Usage

ExportDataForViewer(
  object,
  sampleIDs = NULL,
  outdir,
  nCores = detectCores() - 1,
  overwrite = FALSE,
  verbose = TRUE
)

Arguments

object

A Seurat object created with semla

sampleIDs

An integer vector specifying the sampleIDs for the datasets to export. By default, all samples are exported.

outdir

A character vector specifying the path to an existing directory with permission to read and write files.

nCores

Number of cores to use parallel image tiling

overwrite

Overwrite files if they already exists

verbose

Print messages

Value

A path to the directory where the data is saved

Details

FeatureViewer will automatically attempt to export these files every time it's run. With ExportDataForViewer, you only have to export the files once and you can provide the output data path for FeatureViewer to look for the required files in that directory.

See also

Other feature-viewer-methods: FeatureViewer()

Examples


library(semla)

se_mbrain <- readRDS(system.file("extdata/mousebrain",
                                 "se_mbrain",
                                 package = "semla"))
se_mbrain <- LoadImages(se_mbrain)
#> 
#> ── Loading H&E images ──
#> 
#>  Loading image from /private/var/folders/8r/bfm2m_q17znfk0m_8dt330tm0000gp/T/RtmpLHpYU7/temp_libpath305b1609463d/semla/extdata/mousebrain/spatial/tissue_lowres_image.jpg
#>  Scaled image from 600x565 to 400x377 pixels
#>  Saving loaded H&E images as 'rasters' in Seurat object

# Export viewer files to a temporary directory
outpath <- ExportDataForViewer(se_mbrain, outdir = tempdir(), nCores = 1, overwrite = TRUE)
#>  Attempting to tile H&E image(s)
#>  Got an image of dimensions 600x565 for sample 1
#> →   Tiling image into 2 zoom levels
#> →   Creating tiles
#> →   Exporting tiles
#> →   Exporting meta data
#> →   Exporting Visium coordinates
outpath
#> [1] "/private/var/folders/8r/bfm2m_q17znfk0m_8dt330tm0000gp/T/RtmpRVvGCP/viewer_data"