scRNA-seq Cheatsheet

July 15, 2025 ยท View on GitHub

The tables below consist of valuable functions or commands that will help you through this module.

Each table represents a different library/tool and its corresponding commands.

Please note that these tables are not intended to tell you all the information you need to know about each command.

The hyperlinks found in each piece of code will take you to the documentation for further information on the usage of each command. Please be aware that the documentation will generally provide information about the given function's most current version (or a recent version, depending on how often the documentation site is updated). This will usually (but not always!) match what you have installed on your machine. If you have a different version of R or other R packages, the documentation may differ from what you have installed.

Table of Contents

Base R

Read the Base R documentation.

Library/PackagePiece of CodeWhat it's calledWhat it does
Base RrowSums()Row sumsCalculates sums for each row
Base RcolSums()Column sumsCalculates sums for each column
Base Rt()TransposeReturns the transpose of a matrix or data frame
Base Rprcomp()Principal Components AnalysisExecutes a principal components analysis on specified matrix or data frame
Base R<-function(x) { <code> }FunctionCreates a function that would take the defined parameters as input and execute the commands within the curly braces

Salmon and alevinQC

Read the command-line tool Salmon documentation.

Read the R package alevinQC documentation.

Software/packagePiece of CodeWhat it's calledWhat it does
Salmonsalmon alevinSalmon AlevinRuns the Alevin quantification from the command line
alevinQCalevinQCReport()Alevin QC ReportProduces a QC (quality check) report from the salmon alevin output

SingleCellExperiment, txmimeta, and DropletUtils

Read the SingleCellExperiment package documentation (and e-book), and a vignette on its usage. Note that some of the SingleCellExperiment functions link to documentation from other packages like SummarizedExperiment or ExperimentSubset. In fact, SingleCellExperiment objects are based around existing Bioconductor functions in those packages, so the function usage is equivalent!

Read the tximeta package documentation, and a vignette on its usage.

Read the DropletUtils package documentation.

Library/PackagePiece of CodeWhat it's calledWhat it does
SingleCellExperimentSingleCellExperiment()Single Cell ExperimentCreates a SingleCellExperiment object
SingleCellExperimentcolData()Column DataExtracts and stores cell-level metadata that describes features of the SingleCellExperiment object
SingleCellExperimentrowData()Row DataExtracts and stores gene-level metadata that describes features of the SingleCellExperiment object
SingleCellExperimentassay()AssayExtracts and stores a given assay from a SingleCellExperiment object
SingleCellExperimentassayNames()Assay namesReturns a vector of the names of all assays in a SingleCellExperiment object
SingleCellExperimentlogcounts()Log countsExtracts and stores log-transformed single-cell experiment count data as an assay of the SingleCellExperiment object
SingleCellExperimentcounts()CountsExtracts and stores raw single-cell experiment count data as an assay of the SingleCellExperiment object
SingleCellExperimentreducedDim()Reduced dimExtracts or stores a given reduced dimension from a SingleCellExperiment object
SingleCellExperimentreducedDimNames()Reduced dim namesReturns a vector of the names of all reduced dimensions in a SingleCellExperiment object
S4VectorsDataFrame()Data frameNot to be confused with data.frame() from Base R. This is a slightly different data frame-like object needed for storing information in SingleCellExperiment object's colData slot.
tximetatximeta()Transcript Quantification Import with Automatic MetadataLoad a directory of results produced by Salmon/or alevin output, including the associated metadata
DropletUtilsread10xCounts()Read 10x countsLoad data from a 10x Genomics experiment into R
DropletUtilsemptyDrops()Empty dropsUse the overall gene expression patterns in the sample to identify empty droplets
DropletUtilsemptyDropsCellRanger()Empty drops Cell RangerUse an approach analogous to Cell Ranger's algorithm to identify empty droplets

scran and scater

Read the scran package documentation, and a vignette on its usage.

Read the scater package documentation, and a vignette on its usage.

Library/PackagePiece of CodeWhat it's calledWhat it does
scranquickCluster()Quick ClusteringGroups similar cells into clusters which are stored in the SingleCellExperiment object and are used for the calculation of size factors by scran::computeSumFactors
scrancomputeSumFactors()Compute Sum FactorsReturns a numeric vector of computed sum factors for each cell cluster stored in the SingleCellExperiment object. The cluster-based size factors are deconvolved into cell-based size factors that are stored in the SingleCellExperiment object and used by the scran::normalize function for the normalization of each cell's gene expression profile
scrangetTopHVGs()Get top highly variable genesIdentify variable genes in a SingleCellExperiment object, based on variance
scranmodelGeneVar()model per gene varianceModel the per gene variance of a SingleCellExperiment object
scranfindMarkers()Find marker genesFind candidate marker genes for clusters of cells
scranclusterCells()Cluster cellsPerform clustering on an SCE object using the bluster package
scaterlogNormCounts()Normalize log countsReturns the SingleCellExperiment object with normalized expression values for each cell, using the size factors stored in the object
scateraddPerCellQC()Add per cell quality controlFor a SingleCellExperiment object, calculate and add quality control per cell and store in colData
scateraddPerFeatureQC()Add per feature quality controlFor a SingleCellExperiment object, calculate and add quality control per feature (genes usually) and store in rowData
scatercalculatePCA()Calculate PCACalculates principal components analysis on a SingleCellExperiment object, returning a PCA matrix
scaterrunPCA()Run PCACalculates principal components analysis on a SingleCellExperiment object, returning an SCE object with a PCA reduced dimension
scatercalculateUMAP()Calculate UMAPCalculates uniform manifold approximate projection on a SingleCellExperiment object, returning a UMAP matrix
scaterrunUMAP()Run UMAPCalculates uniform manifold approximate projection on a SingleCellExperiment object, returning an SCE object with a UMAP reduced dimension
scatercalculateTSNE()Calculate t-SNECalculates t-stochastic neighbor embedding on a SingleCellExperiment object, returning an SCE object with a TSNE reduced dimension
scaterrunTSNE()Calculate UMAPCalculates t-stochastic neighbor embedding on a SingleCellExperiment object, returning a t-SNE matrix
scaterplotReducedDim()Plot reduced dimensionsPlot a given reduced dimension slot from a SingleCellExperiment object by its name
scaterplotPCA()Plot PCAPlot the "PCA"-named reduced dimension slot from a SingleCellExperiment object
scaterplotUMAP()Plot UMAPPlot the "UMAP"-named reduced dimension slot from a SingleCellExperiment object

purrr, stringr, and tibble

Read the purrr package documentation.

Read the stringr package documentation.

Read the tibble package documentation.

Library/PackagePiece of CodeWhat it's calledWhat it does
purrrmap()mapApply a function across each element of list; return a list
purrrmap_df()map dfApply a function across each element of list; return a data frame
purrrimap()imapApply a function across each element of list and its index/names
stringrstr_remove()String removeRemove matched string patterns
tibbleas_tibble()As tibbleCoerce data.frame or matrix to a tibble

Note that purrr::map() functions can take advantage of R's new (as of version 4.1.0) anonymous function syntax:

# One-line syntax:
\(x) # function code goes here #

# Multi-line syntax:
\(x) {
  # function code goes      #
  # inside the curly braces #
}

# Example: Use an anonymous function with `purrr::map()`
# to get the colData's rownames for each SCE in `list_of_sce_objects`
purrr::map(
  list_of_sce_objects,
  \(x) rownames(colData(x))
)

bluster

Read the bluster package documentation and this vignette on its usage.

Library/PackagePiece of CodeWhat it's calledWhat it does
blusterclusterRows()Cluster rows of a matrixPerform clustering using a variety of algorithms on a matrix-like object
blusterKmeansParam()K-means clustering parametersSet up parameters to run clustering using kmeans() within scran::clusterCells() or bluster::clusterRows()
blusterNNGraphParam()Graph-based clustering parametersSet up parameters for nearest-neighbor (NN) graph-based clustering algorithms within scran::clusterCells() or bluster::clusterRows()

SingleR

Read the SingleR package documentation, and an e-book on its usage.

Library/PackagePiece of CodeWhat it's calledWhat it does
SingleRtrainSingleR()Train the SingleR classifierBuild a SingleR classifier model object from an annotated reference dataset
SingleRclassifySingleR()Classify cells with SingleRUse a SingleR model object to assign cell types to the cells in an SCE object
SingleRSingleR()Annotate scRNA-seq dataCombines trainSingleR() and classifySingleR() to assign cell types to an SCE object from an annotated reference dataset