Normalizes the count matrix of a molecular assay.

normalizeCounts(
  object,
  method = "LogNormalize",
  mtr_name_new = method,
  sct_clip_range = c(-sqrt(x = ncol(x = umi)/30), sqrt(x = ncol(x = umi)/30)),
  activate = TRUE,
  assay_name = activeAssay(object),
  overwrite = FALSE,
  verbose = NULL,
  ...
)

Arguments

object

An object of class SPATA2 or, in case of S4 generics, objects of classes for which a method has been defined.

method

Character value. The normalization method. One of c('LogNormalize', 'CLR', 'RC', 'SCT'). 'SCT' normalization is used for MERFISH and Xenium datasets, as suggested in the Seurat documentation.

mtr_name_new

Character value. The name under which the new processed matrix is stored in the SPATA2 object.

activate

Logical. If TRUE, the created matrix is activated via activateMatrix().

assay_name

Only relevant if the SPATA2 object contains more than one assay: Denotes the assay of interest and thus the molecular modality to use. Defaults to the active assay as set by activateAssay().

overwrite

Logical value. Must be TRUE to allow overwriting.

verbose

Logical. If TRUE, informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

...

Additional arguments given to Seurat::NormalizeData().

Value

The updated input object, containing the added, removed or computed results.

Details

The function creates a temporary Seurat object and calls Seurat::NormalizeData() with the corresponding method. Afterwards, the normalized matrix is extracted and stored in the SPATA2 object with the name specified in mtr_name_new. This name, in turn, default to the character value of method.

Examples


library(SPATA2)
library(tidyverse)

data("example_data")

object <- example_data$object_UKF275T_diet

object <- normalizeCounts(object, method = "LogNormalize")

# default name for processed matrix is the input for `method`
mtr <- getMatrix(object, mtr_name = "LogNormalize")