Skip to contents

SpatialArtifacts provides a robust, data-driven two-step workflow to identify, classify, and handle spatial artifacts in spatial transcriptomics data across multiple platforms including 10x Genomics Visium (Standard and HD). It combines median absolute deviation (MAD)-based outlier detection with morphological image processing to flag problematic regions such as edge dryspots and interior artifacts caused by incomplete reagent coverage.

Main Functions

  • detectEdgeArtifacts: The primary wrapper function to detect potential artifact spots. Automatically routes to platform-specific methods based on the platform argument. Outputs three columns to colData: *_edge, *_problem_id, and *_problem_size.

  • classifyEdgeArtifacts: Hierarchically classifies detected artifacts by location (edge vs. interior) and size (large vs. small). Outputs a single *_classification column.

Typical Workflow


# Step 1: Detect artifacts
spe <- detectEdgeArtifacts(spe, platform = "visium", qc_metric = "sum_gene")

# Step 2: Classify artifacts
spe <- classifyEdgeArtifacts(spe, min_spots = 20)

Platform-Specific Usage

detectEdgeArtifacts requires users to specify their platform:

  • Standard Visium (platform = "visium"): Uses hexagonal grid layout. The default shifted = FALSE is correct for standard Space Ranger array_row/array_col outputs.

  • Visium HD (platform = "visiumhd"): Uses square grid layout. Requires the resolution parameter ("16um" or "8um"). Parameters are specified in physical units (micrometers).

Input Data

All functions accept a SpatialExperiment object. QC metrics (e.g., library size, detected genes) should be precomputed, for example using addPerCellQCMetrics.

Author

Maintainer: Harriet Jiali He jhe46@jh.edu (ORCID)

Authors: