Skip to contents

Use the neighbor properties of cells or graph partition methods to evaluate the "spatial quality" of cells. The goal is to identify cells which are not properly part of the main tissue area.

Usage

spatialQC(
  object,
  representation = "spatial",
  k = 20,
  n = 10,
  partition_resolution = 1
)

Arguments

object

SpatialMap object

representation

Probably "spatial" - the default embedding for spatial coordinates

k

The number of nearest neighbors used to smooth the distances

n

The nearest neighbor index used to evaluate distance. Must be less than k.

partition_resolution

The resolution for leiden graph partitioning

Value

A SpatialMap object with some new data added:

  1. A new NN for each region with the name {representation}_knn_{k}

  2. New columns in cellMetadata reflecting newly computed QC metrics: "cellqc_dist.n", "cellqc_dist.smooth", and "cellqc_partition".

Details

This algorithm computes each cell's k nearest neighbors on the spatial graph and measures the distance to the nth cell. Additionally, it computes a 'smoothed' nth distance, which is the average of nth distances for each cell's k neighbors. Finally, it provides the results of a spatial-only graph partition algorithm, which may additionally help users identify groups of cells that aren't part of the main tissue.

See our published notebook demonstrating how to use this functionality.

Scroll to top