Given a merged object with multiple SCT models, this function uses minimum of the median UMI (calculated using the raw UMI counts) of individual objects to reverse the individual SCT regression model using minimum of median UMI as the sequencing depth covariate. The counts slot of the SCT assay is replaced with recorrected counts and the data slot is replaced with log1p of recorrected counts.

PrepSCTFindMarkers(object, assay = "SCT", verbose = TRUE)

Arguments

object

Seurat object with SCT assays

assay

Assay name where for SCT objects are stored; Default is 'SCT'

verbose

Print messages and progress

Value

Returns a Seurat object with recorrected counts and data in the SCT assay.

Examples

data("pbmc_small") pbmc_small1 <- SCTransform(object = pbmc_small, variable.features.n = 20)
#> Calculating cell attributes from input UMI matrix: log_umi
#> Variance stabilizing transformation of count matrix of size 220 by 80
#> Model formula is y ~ log_umi
#> Get Negative Binomial regression parameters per gene
#> Using 220 genes, 80 cells
#> | | | 0%
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: NaNs produced
#> Warning: iteration limit reached
#> Warning: NaNs produced
#> Warning: iteration limit reached
#> Warning: NaNs produced
#> Warning: iteration limit reached
#> Warning: NaNs produced
#> Warning: iteration limit reached
#> Warning: NaNs produced
#> Warning: iteration limit reached
#> Warning: NaNs produced
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> | |======================================================================| 100%
#> Second step: Get residuals using fitted parameters for 220 genes
#> | | | 0% | |======================================================================| 100%
#> Computing corrected count matrix for 220 genes
#> | | | 0% | |======================================================================| 100%
#> Calculating gene attributes
#> Wall clock passed: Time difference of 0.7072282 secs
#> Determine variable features
#> Place corrected count matrix in counts slot
#> Centering data matrix
#> Set default assay to SCT
pbmc_small2 <- SCTransform(object = pbmc_small, variable.features.n = 20)
#> Calculating cell attributes from input UMI matrix: log_umi
#> Variance stabilizing transformation of count matrix of size 220 by 80
#> Model formula is y ~ log_umi
#> Get Negative Binomial regression parameters per gene
#> Using 220 genes, 80 cells
#> | | | 0%
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: NaNs produced
#> Warning: iteration limit reached
#> Warning: NaNs produced
#> Warning: iteration limit reached
#> Warning: NaNs produced
#> Warning: iteration limit reached
#> Warning: NaNs produced
#> Warning: iteration limit reached
#> Warning: NaNs produced
#> Warning: iteration limit reached
#> Warning: NaNs produced
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> | |======================================================================| 100%
#> Second step: Get residuals using fitted parameters for 220 genes
#> | | | 0% | |======================================================================| 100%
#> Computing corrected count matrix for 220 genes
#> | | | 0% | |======================================================================| 100%
#> Calculating gene attributes
#> Wall clock passed: Time difference of 0.5278788 secs
#> Determine variable features
#> Place corrected count matrix in counts slot
#> Centering data matrix
#> Set default assay to SCT
pbmc_merged <- merge(x = pbmc_small1, y = pbmc_small2)
#> Warning: Some cell names are duplicated across objects provided. Renaming to enforce unique cell names.
pbmc_merged <- PrepSCTFindMarkers(object = pbmc_merged)
#> Minimum UMI unchanged. Skipping re-correction.
markers <- FindMarkers(object = pbmc_merged, ident.1 = "0", ident.2 = "1", assay = "SCT") pbmc_subset <- subset(pbmc_merged, idents = c("0", "1")) markers_subset <- FindMarkers(object = pbmc_subset, ident.1 = "0", ident.2 = "1", assay = "SCT", recorrect_umi = FALSE)