This function initiates a SPATA2 object with data generated using the 10x Genomics VisiumHD platform.

initiateSpataObjectVisiumHD(
  sample_name,
  directory_visium,
  square_res = "16um",
  mtr = "filtered",
  img_active = "lowres",
  img_ref = "lowres",
  verbose = TRUE
)

Arguments

sample_name

Character. The name of the sample.

directory_visium

Character. The directory containing the Visium output files.

square_res

Character. The square resolution from which to load the data. One of *c('16um', '8um', '2um'). See details for more.

mtr

Character. Specifies which matrix to use, either "filtered" or "raw". Default is "filtered".

img_active

Character. The active image to use, either "lowres" or "hires". Default is "lowres".

img_ref

Character. The reference image to use, either "lowres" or "hires". Default is "lowres".

verbose

Logical. If TRUE, progress messages are printed. Default is TRUE.

Value

A SPATA2 object the VisiumHD platform.

Details

The function requires a directory containing the output files from a 10x Genomics VisiumHD experiment specified with the argument directory_visium. This directory (below denoted as ~) must include the following sub-directories:

  • ~/binned_outputs: A folder with the following subdirectories.

    • ~/binned_outputs/square_002um: The folder containing the data for square_res = '2um'.

    • ~/binned_outputs/square_008um: The folder containing the data for square_res = '8um'.

    • ~/binned_outputs/square_016um: The folder containing the data for square_res = '16um'.

Depending on your input for square_res only the corresponding subfolder is required. This subfolder should contain the following files and sub-directories:

  • ~/binned_outputs/<square_res>/filtered_feature_bc_matrix.h5 or ~/raw_feature_bc_matrix.h5: The HDF5 file containing the filtered or raw feature-barcode matrix, respectively.

  • ~/binned_outputs/<square_res>/spatial/tissue_lowres_image.png or ~/spatial/tissue_hires_image.png: The low-resolution or high-resolution tissue image.

  • ~/binned_outputs/<square_res>/spatial/scalefactors_json.json: A JSON file containing the scale factors for the images.

  • ~/binned_outputs/<square_res>/spatial/tissue_position.parquet A .parguet file containing the tissue positions and spatial coordinates.

The function will check for these files and process them to create a SPATA2 object. It reads the count matrix, loads the spatial data, and initializes the SPATA2 object with the necessary metadata and settings.

Note

It is crucial to install the package arrow in a way that arrow::read_parquet() works. There are several ways. Installing the package with install.packages('arrow', repos = 'https://apache.r-universe.dev') worked reliably for us.