readVisium: Load a Visium spatial dataset as a SingleCellExperiment.

View source: R/readVisium.R

readVisiumR Documentation

Load a Visium spatial dataset as a SingleCellExperiment.

Description

Load a Visium spatial dataset as a SingleCellExperiment.

Usage

readVisium(
  dirname,
  rm.feats.pat = c("^NegControl.*", "^BLANK.*", "^DEPRECATED.*")
)

read10Xh5(
  dirname,
  fname = "filtered_feature_bc_matrix.h5",
  rm.feats.pat = c("^NegControl.*", "^BLANK.*", "^DEPRECATED.*")
)

counts2h5(dirname)

Arguments

dirname

Path to spaceranger output directory (e.g. "sampleID/outs/"). This directory must contain the counts matrix and feature/barcode TSVs in filtered_feature_bc_matrix/ for readVisium, or in filtered_feature_bc_matrix.h5 for read10Xh5. Besides, it must also contain a file for spot positions named spatial/tissue_positions_list.csv (before Space Ranger V2.0) or spatial/tissue_positions.csv (since Space Ranger V2.0), as well as a file containing scale factors named spatial/scalefactors_json.json. (To understand the output directory, refer to the corresponding 10X Genomics help page.)

rm.feats.pat

Patterns for features (genes) to remove.

fname

File name of the h5 file. It should be inside dirname. (By default "filtered_feature_bc_matrix.h5")

Details

We store two variables associated with downstream BayesSpace functions in a list called BayesSpace.data in the SingleCellExperiment's metadata.

  • platform is set to "Visium", and is used to determine spot layout and neighborhood structure.

  • is.enhanced is set to FALSE to denote the object contains spot-level data.

Value

SingleCellExperiment containing the counts matrix in counts and spatial data in colData. Array coordinates for each spot are stored in columns array_row and array_col, while image coordinates are stored in columns pxl_row_in_fullres and pxl_col_in_fullres.

Examples

## Not run: 
sce <- readVisium("path/to/outs/")

## End(Not run)


edward130603/BayesSpace documentation built on Oct. 23, 2024, 7:04 a.m.