Bulk RNA-seq Cheatsheet

August 8, 2024 · 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 package documentation.

Library/PackagePiece of CodeWhat it's calledWhat it does
Base Rlist.files()List filesProduces a character vector of files or directories in the specified directory
Base Rnames()NamesGets or sets the names of an object
Base Rcolnames()Column namesGets or sets the column names of a matrix or data frame
Base Rall.equal()All equalChecks if two R objects are nearly equal
Base Rattr()Object AttributesGets or sets the attributes of an object
Base RrowSums()Row SumsReturns the sum of the rows in a numeric matrix-like object (i.e.. a matrix, data.frame, etc.)
Base RrowMeans()Row MeansReturns the mean of the rows in a number matrix-like object (i.e.. a matrix, data.frame, etc.)
Base Rrelevel()RelevelReorders the levels of a factor as specified
Base Rsummary()Object SummaryReturns a result summary of an object
Base Ras.data.frame()Data FrameChecks if an object is a data.frame, and transforms the object into one, if possible

DESeq2

Read the DESeq2 package documentation (PDF), and the package vignette by Love, Anders, and Huber.

Library/PackagePiece of CodeWhat it's calledWhat it does
DESeq2vst()Variance Stabilizing TransformationApplies variance stabilizing transformation to data (log2-like scale)
DESeq2DESeqDataSet()DESeqDataSet constructor that can take a SummarizedExperimentCreates a DESeqDataSet object
DESeq2DESeqDataSetFromMatrix()DESeqDataSet constructorCreates a DESeqDataSet object from a matrix of count data
DESeq2DESeq()Differential Expression Analysis Based on the Negative Binomial DistributionEstimates size factors, estimates dispersion, and performs negative binomial fitting and Wald statistics as steps in the default DESeq2 differential expression analysis
DESeq2plotPCA()PCA plotProduces a principal component analysis plot for transformed data. It can be used to visually inspect the data, which might allow an analyst to identify batch effects.
DESeq2counts()CountsReturns count matrix from DESeqDataSet object
DESeq2results()ResultsReturns the results table from a DESeq2 analysis
DESeq2assay()AssayReturns matrix from the assay slot of a DESeqDataSet object

FastQC and fastp

Read the FastQC documentation and the fastp documentation.

Library/PackagePiece of CodeWhat it's calledWhat it does
fastpfastpFASTQ preprocessorPreprocesses FASTQ files through adapter trimming, quality filtering, length filtering, and a number of additional options
FastQCfastqcFASTQC (Quality Control)Performs quality control checks on raw sequence data and outputs a QC (quality control) report

ggplot2

Read the ggplot2 package documentation, an overall reference for ggplot2 functions, and a vignette on the usage of the ggplot2 aesthetics. Additional vignettes are available from the "Articles" dropdown menu on this webpage.

Library/PackagePiece of CodeWhat it's calledWhat it does
ggplot2ggsave()GG SaveSaves the last plot in working directory
ggplot2last_plot()Last plotReturns the last plot produced
ggplot2geom_point()Geom pointCreates a scatterplot (when added to the ggplot() function)
ggplot2labs(); xlab(); ylab()X Axis Labels; Y Axis LabelsModifies the plot labels, with specific functions for the x axis and y axis, respectively
ggplot2coord_fixed()Cartesian Coordinates with Fixed Aspect RatioCoerces the coordinates on the plot to represent a fixed specified ratio

tximeta and SummarizedExperiment

Read the tximeta package documentation (PDF), and the package vignette by Love et al.. Read the SummarizedExperiment package documentation (PDF), and the package vignette by Morgan et al..

Library/PackagePiece of CodeWhat it's calledWhat it does
tximetatximeta()tximetaImports transcript-level estimates, attaches transcriptome annotation, and returns a SummarizedExperiment object
tximetamakeLinkedTxome()Make Linked TranscriptomeSets up transcriptome annotation to be used by the tximeta() function (Only necessary if tximeta() fails to find annotation, like for non-human, non-mouse species data)
tximetasummarizeToGene()Summarize to GeneTakes a SummarizedExperiment that was set up by tximeta and summarizes transcript data to the gene-level
SummarizedExperimentrowData(); colData()Row/Col DataAccesses the row or column data from a SummarizedExperiment object
SummarizedExperimentassay(); assayNames()Assay or Assay NamesAccesses the assay data or the names of the assays from SummarizedExperiment object

stringr, readr, dplyr

Documentation for each of these packages can be accessed by clicking the package name in the table below.

Library/PackagePiece of CodeWhat it's calledWhat it does
stringrword()WordExtracts words from a character vector
readrwrite_rds()Write RDSWrites data to a .RDS output file
dplyrpull()PullExtracts a variable (column) as a vector

matrixStats

Read the matrixStats package documentation (PDF) and summary of functions.

Library/PackagePiece of CodeWhat it's calledWhat it does
matrixStatsrowVars()Row varianceEstimates the variance for each row in a matrix
matrixStatsrowSds()Row standard deviationsEstimates the standard deviations for each row in a matrix

ComplexHeatmap and EnhancedVolcano

Read the ComplexHeatmap Complete Reference. Read the EnhancedVolcano manual.

Library/PackagePiece of CodeWhat it's calledWhat it does
ComplexHeatmapHeatmap()Heatmap constructorConstructs a Heatmap class object that can then be used to plot a heatmap
ComplexHeatmapHeatmapAnnotation()Heatmap annotation constructorConstructs a HeatmapAnnotation class object that can be used to annotate a heatmap
EnhancedVolcanoEnhancedVolcano()Enhanced volcano plotConstructs a highly customizable volcano plot with colored and labeled points

Salmon

Read the Salmon tool documentation.

ToolPiece of CodeWhat it's calledWhat it does
Salmonsalmon indexSalmon indexBuilds a transcriptome index which is required for Salmon quantification (from the command line)
Salmonsalmon quantSalmon quantificationRuns Salmon’s quantification of transcript expression (from the command line)