FetchResidualSCTModel: Calculate pearson residuals of features not in the scale.data...

View source: R/preprocessing5.R

FetchResidualSCTModelR Documentation

Calculate pearson residuals of features not in the scale.data This function is the secondary function under FetchResiduals

Description

Calculate pearson residuals of features not in the scale.data This function is the secondary function under FetchResiduals

Usage

FetchResidualSCTModel(
  object,
  umi.object,
  layer = "counts",
  chunk_size = 2000,
  layer.cells = NULL,
  SCTModel = NULL,
  reference.SCT.model = NULL,
  new_features = NULL,
  clip.range = NULL,
  replace.value = FALSE,
  verbose = FALSE
)

Arguments

object

An SCTAssay object

umi.object

The assay to use when recalculating any missing residuals.

layer

The name of the layer(s) in 'umi.object' to use when recalculating any missing residuals.

chunk_size

Number of cells to load in memory for calculating residuals

layer.cells

Vector of cells to calculate the residual for. Default is NULL which uses all cells in the layer

SCTModel

Which SCTmodel to use from the object for calculating the residual. Will be ignored if reference.SCT.model is set

reference.SCT.model

If a reference SCT model should be used for calculating the residuals. When set to not NULL, ignores the 'SCTModel' paramater.

new_features

A vector of features to calculate the residuals for

clip.range

Numeric of length two specifying the min and max values the Pearson residual will be clipped to. Useful if you want to change the clip.range.

replace.value

Whether to replace the value of residuals if it already exists

verbose

Whether to print messages and progress bars

Value

Returns a matrix containing centered pearson residuals of added features


Seurat documentation built on June 8, 2025, 12:24 p.m.