Apply Chi-squared normalization to a Seurat object
Source:R/scslide_sample_level.R
NormalizeChiSquared.RdThis function applies Chi-squared normalization to a (sample-level) Seurat object. It calculates the expected density (count of cells) for each landmark-sample pair assuming random distribution, then normalizes observed counts using: (observed - expected) / sqrt(expected). The resulting values show how much each landmark's density deviates from the expected baseline density values. Positive values indicate higher-than-expected density, negative values indicate lower-than-expected density.
Usage
NormalizeChiSquared(object, ...)
# Default S3 method
NormalizeChiSquared(object = NULL, verbose = TRUE, ...)
# S3 method for class 'Assay'
NormalizeChiSquared(object, verbose = TRUE, ...)
# S3 method for class 'StdAssay'
NormalizeChiSquared(
object,
layer = "counts",
save = "data",
verbose = TRUE,
...
)
# S3 method for class 'Seurat'
NormalizeChiSquared(object, assay = NULL, verbose = TRUE, ...)Arguments
- object
a count matrix (a landmark-sample density matrix), Assay, StdAssay, or Seurat object. Values must be raw counts (non-negative whole numbers)
- ...
Additional arguments
- verbose
display progress bar for normalization procedure
- layer
Layer to use (for StdAssay objects, and passed on by the Seurat method). It must resolve to a single layer whose name starts with "counts"; for split layers, run
JoinLayersfirst or name one layer- save
Layer to save results to (for StdAssay objects, and passed on by the Seurat method). Its name cannot start with "counts"
- assay
Name of assay to use (for Seurat objects)