Skip to contents

Calculates QC metrics from a SpatialMap object. Stores QC in cellMetadata. Metrics are currently designed with a focus on spatial proteomics data. Thresholding and filtering can be subsequently performed by FilterCodex.

The main QC metrics calculated are:

cellqc_signal.sum: The sum of the signal for each cell, based on the channels specified in markers. Artifacts will usually have very high signal.

cellqc_DNA: Total signal in the DNA channel for each cell.

cellqc_cell.size: Area in pixels of the cell.

cellqc_signal.CV: The coefficient of variation (mean/std. deviation) of the vector of biomarker expression values for each cell, based on the channels specified in markers. Artifacts often stain brightly in many channels, and so have very low CV.

Usage

QCMetrics(
  object,
  analyze = NULL,
  slot = "Data",
  markers = NULL,
  DNA = "DAPI",
  summary.fun = "mean",
  cell.size = "size",
  spatial.qc = FALSE,
  k = 20,
  n = 10,
  partition_resolution = 1,
  ...
)

Arguments

object

A SpatialMap object.

analyze

The SpatialMap Analysis to use. Defaults to activeAnalysis.

slot

The data slot to pull data on markers from.

markers

Specific markers to run qc metrics on (character vector). Impacts the calculation of signal.sum and signal.CV. Must specify more than one marker. Default NULL will run all.

DNA

The feature name of the DNA channel. Must be found in the bgData slot.

summary.fun

If there are multiple channels that match the DNA argument (for example, multiple DAPI channels), choose how to summarize them. Defaults to "mean".

cell.size

The feature name of the cell size parameter. Must be found in the coords or cellMetadata slot.

spatial.qc

Whether to compute spatial QC parameters. See spatialQC for more detail. The following three parameters refer to this process.

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

...

Arguments passed to .smapply

Value

A SpatialMap object with new columns added to the cellMetadata slot corresponding to newly calculated metrics. Each metric's column name is prepended with the prefix "cellqc_". Quantiles of each marker's expression will also be added to the featureInfo for each region.

Details

See vignette(AnalysisGuide2_QC_with_SpatialMap) for a representative workflow that uses this function.

Scroll to top