SCTransform | R Documentation |
Perform a variance‐stabilizing transformation on UMI counts using
sctransform::vst
(https://github.com/satijalab/sctransform). This
replaces the NormalizeData
→ FindVariableFeatures
→
ScaleData
workflow by fitting a regularized negative binomial model
per gene and returning:
SCTransform(object, ...)
## Default S3 method:
SCTransform(
object,
cell.attr,
reference.SCT.model = NULL,
do.correct.umi = TRUE,
ncells = 5000,
residual.features = NULL,
variable.features.n = 3000,
variable.features.rv.th = 1.3,
vars.to.regress = NULL,
latent.data = NULL,
do.scale = FALSE,
do.center = TRUE,
clip.range = c(-sqrt(x = ncol(x = umi)/30), sqrt(x = ncol(x = umi)/30)),
vst.flavor = "v2",
conserve.memory = FALSE,
return.only.var.genes = TRUE,
seed.use = 1448145,
verbose = TRUE,
...
)
## S3 method for class 'Assay'
SCTransform(
object,
cell.attr,
reference.SCT.model = NULL,
do.correct.umi = TRUE,
ncells = 5000,
residual.features = NULL,
variable.features.n = 3000,
variable.features.rv.th = 1.3,
vars.to.regress = NULL,
latent.data = NULL,
do.scale = FALSE,
do.center = TRUE,
clip.range = c(-sqrt(x = ncol(x = object)/30), sqrt(x = ncol(x = object)/30)),
vst.flavor = "v2",
conserve.memory = FALSE,
return.only.var.genes = TRUE,
seed.use = 1448145,
verbose = TRUE,
...
)
## S3 method for class 'Seurat'
SCTransform(
object,
assay = "RNA",
new.assay.name = "SCT",
reference.SCT.model = NULL,
do.correct.umi = TRUE,
ncells = 5000,
residual.features = NULL,
variable.features.n = 3000,
variable.features.rv.th = 1.3,
vars.to.regress = NULL,
do.scale = FALSE,
do.center = TRUE,
clip.range = c(-sqrt(x = ncol(x = object[[assay]])/30), sqrt(x = ncol(x =
object[[assay]])/30)),
vst.flavor = "v2",
conserve.memory = FALSE,
return.only.var.genes = TRUE,
seed.use = 1448145,
verbose = TRUE,
...
)
## S3 method for class 'IterableMatrix'
SCTransform(
object,
cell.attr,
reference.SCT.model = NULL,
do.correct.umi = TRUE,
ncells = 5000,
residual.features = NULL,
variable.features.n = 3000,
variable.features.rv.th = 1.3,
vars.to.regress = NULL,
latent.data = NULL,
do.scale = FALSE,
do.center = TRUE,
clip.range = c(-sqrt(x = ncol(x = object)/30), sqrt(x = ncol(x = object)/30)),
vst.flavor = "v2",
conserve.memory = FALSE,
return.only.var.genes = TRUE,
seed.use = 1448145,
verbose = TRUE,
...
)
object |
A Seurat object or UMI count matrix. |
... |
Additional arguments passed to |
cell.attr |
Optional metadata frame (cells × attributes). |
reference.SCT.model |
Pre‐fitted SCT model (supports only |
do.correct.umi |
Logical; if TRUE (default), stores corrected UMIs in
|
ncells |
Integer; number of cells to subsample when fitting NB regression (default: 5000). |
residual.features |
Character vector of genes to compute residuals for. Default NULL (all genes). If set, these become the assay’s variable features. |
variable.features.n |
Integer; when |
variable.features.rv.th |
Numeric; if |
vars.to.regress |
Character vector of metadata columns (e.g.
|
latent.data |
Numeric matrix (cells × latent covariates) to regress out. |
do.scale |
Logical; if TRUE, scale residuals to unit variance (default: FALSE). |
do.center |
Logical; if TRUE, center residuals to mean zero (default: TRUE). |
clip.range |
Numeric vector of length 2; range to clip residuals
(default |
vst.flavor |
Character; if |
conserve.memory |
Logical; if TRUE, never builds the full residual
matrix (slower but memory‐efficient; forces |
return.only.var.genes |
Logical; if TRUE (default), |
seed.use |
Integer; random seed for reproducibility (default: 1448145). Set to NULL to skip setting a seed. |
verbose |
Logical; whether to print progress messages (default: TRUE). |
assay |
Name of assay to pull the count data from; default is 'RNA' |
new.assay.name |
Name for the new assay containing the normalized data; default is 'SCT' |
- A new assay (default name “SCT”), in which:
- counts
: depth‐corrected UMI counts (as if each cell had uniform
sequencing depth; controlled by do.correct.umi
).
- data
: log1p
of corrected counts.
- scale.data
: Pearson residuals from the fitted NB model (optionally
centered and/or scaled).
- misc
: intermediate outputs from sctransform::vst
.
When multiple counts
layers exist (e.g. after split()
),
each layer is modeled independently. A consensus variable‐feature set is
then defined by ranking features by how often they’re called “variable”
across different layers (ties broken by median rank).
By default, sctransform::vst
will drop features expressed in fewer
than five cells. In the multi-layer case, this can lead to consenus
variable-features being excluded from the output's scale.data
when
a feature is "variable" across many layers but sparsely expressed in at
least one.
A Seurat object with a new SCT
assay containing:
counts
(corrected UMIs), data
(log1p counts), and
scale.data
(Pearson residuals), plus misc
for intermediate
vst
outputs.
vst
,
get_residuals
,
correct_counts
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.