Official constructor function of the S4 class SpatialData. Functions suffixed by the platform name are wrappers written for their standardized output folder.

createSpatialData(
  sample,
  hist_img_ref = NULL,
  hist_imgs = list(),
  active = NULL,
  coordinates = tibble::tibble(),
  meta = list(),
  method = SpatialMethod(),
  scale_factors = list(),
  resize_images = NULL,
  unload = TRUE,
  misc = list(),
  verbose = TRUE,
  ...
)

createSpatialDataMERFISH(
  dir,
  sample,
  file_coords = NULL,
  meta = list(),
  misc = list(),
  verbose = TRUE
)

createSpatialDataSlideSeqV1(
  dir,
  sample,
  file_coords = NULL,
  meta = list(),
  misc = list()
)

createSpatialDataVisium(
  dir,
  sample,
  img_ref = "lowres",
  img_active = "lowres",
  resize_images = NULL,
  unload = TRUE,
  meta = list(),
  misc = list(),
  verbose = TRUE
)

createSpatialDataVisiumHD(
  dir,
  sample,
  square_res,
  img_ref = "lowres",
  img_active = "lowres",
  resize_images = NULL,
  unload = FALSE,
  meta = list(),
  misc = list(),
  verbose = TRUE
)

createSpatialDataXenium(dir, sample, meta = list(), misc = list())

Arguments

sample

Character value. The sample name of the tissue.

hist_img_ref

The SpatialData serving as the reference image. Should be created with createHistoImage().

hist_imgs

List of additional HistoImage objects for slot @images.

active

Character value. Name of the HistoImage that is set to the active image. Defaults to the reference image.

coordinates

Data.frame of at least three variables:

  • barcodes: Character variable with unique IDs for each observation.

  • x_orig: Numeric variable representing x-coordinates in a cartesian coordinate system.

  • y_orig: Numeric variable representing y-coordinates in a cartesian coordinate system.

Coordinates should align with the tissue outline of the reference HistoImage after being multiplied withe its coordinate scale factor in slot @scale_factors$coords.

meta

List of meta data regarding the tissue.

resize_images

A named list of numeric values between 0-1 used to resize the respective image as indicated by the slot name. E.g resize_images = list(hires = 0.5) resizes the hires image to 50% of its original scale.

unload

Logical value. If TRUE, every image except for the active image is unloaded.

misc

List of miscellaneous information.

verbose

Logical. If TRUE, informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

...

Used to absorb deprecated arguments or functions.

dir

The directory to the output folder of the platform.

file_coords

Character value or NULL. If character, specifies the filename within the directory dir that leads to the coordinates .csv file. If NULL the expected filename is tried:

  • MERFISH: File that contains 'cell_metadata' and ends with '.csv'

  • SlideSeqV1: File that ends with 'MatchedBeadLocation.csv'

  • VisiumSmall/VisiumLarge: File named 'tissue_positions_list.csv' or 'tissue_positions.csv'

  • VisiumHD: File named 'tissue_positions.parquet'

  • Xenium: File named 'cells.csv.gz'.

img_ref, img_active

Character values specifying which of the images to register and how to register them. Click here for more information about the definitions of the reference image and the active image. Setting both arguments to the same value results in the function to register the specified image as the active as well as the reference image. Valid input options depend on the platform used:

  • Visium: Either 'lowres' or 'hires'.

square_res

Character. The square resolution from which to load the data. While c('16um', '8um', '2um') are the default resolutions, reduceResolutionVisiumHD() is applied if the input deviates from these three input options. See section Visium HD Resolution for more information.

Value

An object of class SpatialData

See also

registerImage() to register images afterwards.