Skip to contents

The flagVisiumoutliers function identifies and flags Visium systematic outlier spots in a SpatialExperiment object based on barcodes. These outliers are marked in the colData of the SpatialExperiment object, allowing users to exclude them from downstream analyses to enhance data quality and reliability.

Usage

flagVisiumOutliers(spe)

Arguments

spe

A SpatialExperiment object containing spatial transcriptomics data. The object must include array_row and array_col columns in its colData that specify the spatial coordinates of each spot.

Value

A SpatialExperiment object identical to the input spe but with an additional logical column systematic_outliers in its colData. This column indicates whether each spot is flagged as a technical outlier (TRUE) or not (FALSE).

Examples

library(SpotSweeper)
library(SpatialExperiment)

# load example data
spe <- STexampleData::Visium_humanDLPFC()
#> see ?STexampleData and browseVignettes('STexampleData') for documentation
#> downloading 1 resources
#> retrieving 1 resource
#> loading from cache

# Flag outlier spots
spe <- flagVisiumOutliers(spe)

# drop outlier spots
spe <- spe[, !colData(spe)$systematic_outliers]