Learn R Programming

sctransform

R package for normalization and variance stabilization of single-cell RNA-seq data using regularized negative binomial regression

The sctransform package was developed by Christoph Hafemeister in Rahul Satija's lab at the New York Genome Center and described in Hafemeister and Satija, Genome Biology 2019. Recent updates are described in (Choudhary and Satija, Genome Biology, 2022). Core functionality of this package has been integrated into Seurat, an R package designed for QC, analysis, and exploration of single cell RNA-seq data.

Quick start

Installation:

# Install sctransform from CRAN
install.packages("sctransform")

# Or the development version from GitHub:
remotes::install_github("satijalab/sctransform", ref="develop")

Running sctransform:

# Runnning sctransform on a UMI matrix
normalized_data <- sctransform::vst(umi_count_matrix)$y
# v1 regularization
normalized_data <- sctransform::vst(umi_count_matrix, vst.flavor="v1")$y

# Runnning sctransform on a Seurat object
seurat_object <- Seurat::SCTransform(seurat_object)
# v1 regularization
seurat_object <- Seurat::SCTransform(seurat_object, vst.flavor="v1")

Help

For usage examples see vignettes in inst/doc or use the built-in help after installation
?sctransform::vst

Available vignettes:

Please use the issue tracker if you encounter a problem

References

Copy Link

Version

Install

install.packages('sctransform')

Monthly Downloads

27,694

Version

0.4.2

License

GPL-3 | file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Saket Choudhary

Last Published

April 30th, 2025

Functions in sctransform (0.4.2)

is_outlier

Identify outliers
make.sparse

Convert a given matrix to dgCMatrix
vst

Variance stabilizing transformation for UMI count data
umify

Quantile normalization of cell-level data to match typical UMI count data
smooth_via_pca

Smooth data by PCA
row_gmean

Geometric mean per row
row_var

Variance per row
robust_scale_binned

Robust scale using median and mad per bin
umify_data

Transformation functions for umify
compare_expression

Compare gene expression between two groups
get_model_var

Return average variance under negative binomial model
diff_mean_test

Non-parametric differential expression test for sparse non-negative data
correct

Correct data by setting all latent factors to their median values and reversing the regression model
get_residual_var

Return variance of residuals of regularized models
get_residuals

Return Pearson or deviance residuals of regularized models
get_nz_median2

Get median of non zero UMIs from a count matrix
diff_mean_test_conserved

Find differentially expressed genes that are conserved across samples
correct_counts

Correct data by setting all latent factors to their median values and reversing the regression model
generate

Generate data from regularized models.
plot_model_pars

Plot estimated and fitted model parameters
robust_scale

Robust scale using median and mad
pbmc

Peripheral Blood Mononuclear Cells (PBMCs)
plot_model

Plot observed UMI counts and model