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 DESeq2FastQCandfastpggplot2tximetaandSummarizedExperimentstringr,readr,dplyrmatrixStatsComplexHeatmapandEnhancedVolcano- Salmon
Base R
Read the Base R package documentation.
| Library/Package | Piece of Code | What it's called | What it does |
|---|---|---|---|
Base R | list.files() | List files | Produces a character vector of files or directories in the specified directory |
Base R | names() | Names | Gets or sets the names of an object |
Base R | colnames() | Column names | Gets or sets the column names of a matrix or data frame |
Base R | all.equal() | All equal | Checks if two R objects are nearly equal |
Base R | attr() | Object Attributes | Gets or sets the attributes of an object |
Base R | rowSums() | Row Sums | Returns the sum of the rows in a numeric matrix-like object (i.e.. a matrix, data.frame, etc.) |
Base R | rowMeans() | Row Means | Returns the mean of the rows in a number matrix-like object (i.e.. a matrix, data.frame, etc.) |
Base R | relevel() | Relevel | Reorders the levels of a factor as specified |
Base R | summary() | Object Summary | Returns a result summary of an object |
Base R | as.data.frame() | Data Frame | Checks 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/Package | Piece of Code | What it's called | What it does |
|---|---|---|---|
DESeq2 | vst() | Variance Stabilizing Transformation | Applies variance stabilizing transformation to data (log2-like scale) |
DESeq2 | DESeqDataSet() | DESeqDataSet constructor that can take a SummarizedExperiment | Creates a DESeqDataSet object |
DESeq2 | DESeqDataSetFromMatrix() | DESeqDataSet constructor | Creates a DESeqDataSet object from a matrix of count data |
DESeq2 | DESeq() | Differential Expression Analysis Based on the Negative Binomial Distribution | Estimates size factors, estimates dispersion, and performs negative binomial fitting and Wald statistics as steps in the default DESeq2 differential expression analysis |
DESeq2 | plotPCA() | PCA plot | Produces 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. |
DESeq2 | counts() | Counts | Returns count matrix from DESeqDataSet object |
DESeq2 | results() | Results | Returns the results table from a DESeq2 analysis |
DESeq2 | assay() | Assay | Returns matrix from the assay slot of a DESeqDataSet object |
FastQC and fastp
Read the FastQC documentation and the fastp documentation.
| Library/Package | Piece of Code | What it's called | What it does |
|---|---|---|---|
fastp | fastp | FASTQ preprocessor | Preprocesses FASTQ files through adapter trimming, quality filtering, length filtering, and a number of additional options |
FastQC | fastqc | FASTQC (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/Package | Piece of Code | What it's called | What it does |
|---|---|---|---|
ggplot2 | ggsave() | GG Save | Saves the last plot in working directory |
ggplot2 | last_plot() | Last plot | Returns the last plot produced |
ggplot2 | geom_point() | Geom point | Creates a scatterplot (when added to the ggplot() function) |
ggplot2 | labs(); xlab(); ylab() | X Axis Labels; Y Axis Labels | Modifies the plot labels, with specific functions for the x axis and y axis, respectively |
ggplot2 | coord_fixed() | Cartesian Coordinates with Fixed Aspect Ratio | Coerces 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/Package | Piece of Code | What it's called | What it does |
|---|---|---|---|
tximeta | tximeta() | tximeta | Imports transcript-level estimates, attaches transcriptome annotation, and returns a SummarizedExperiment object |
tximeta | makeLinkedTxome() | Make Linked Transcriptome | Sets 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) |
tximeta | summarizeToGene() | Summarize to Gene | Takes a SummarizedExperiment that was set up by tximeta and summarizes transcript data to the gene-level |
SummarizedExperiment | rowData(); colData() | Row/Col Data | Accesses the row or column data from a SummarizedExperiment object |
SummarizedExperiment | assay(); assayNames() | Assay or Assay Names | Accesses 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/Package | Piece of Code | What it's called | What it does |
|---|---|---|---|
stringr | word() | Word | Extracts words from a character vector |
readr | write_rds() | Write RDS | Writes data to a .RDS output file |
dplyr | pull() | Pull | Extracts a variable (column) as a vector |
matrixStats
Read the matrixStats package documentation (PDF) and summary of functions.
| Library/Package | Piece of Code | What it's called | What it does |
|---|---|---|---|
matrixStats | rowVars() | Row variance | Estimates the variance for each row in a matrix |
matrixStats | rowSds() | Row standard deviations | Estimates the standard deviations for each row in a matrix |
ComplexHeatmap and EnhancedVolcano
Read the ComplexHeatmap Complete Reference.
Read the EnhancedVolcano manual.
| Library/Package | Piece of Code | What it's called | What it does |
|---|---|---|---|
ComplexHeatmap | Heatmap() | Heatmap constructor | Constructs a Heatmap class object that can then be used to plot a heatmap |
ComplexHeatmap | HeatmapAnnotation() | Heatmap annotation constructor | Constructs a HeatmapAnnotation class object that can be used to annotate a heatmap |
EnhancedVolcano | EnhancedVolcano() | Enhanced volcano plot | Constructs a highly customizable volcano plot with colored and labeled points |
Salmon
Read the Salmon tool documentation.
| Tool | Piece of Code | What it's called | What it does |
|---|---|---|---|
| Salmon | salmon index | Salmon index | Builds a transcriptome index which is required for Salmon quantification (from the command line) |
| Salmon | salmon quant | Salmon quantification | Runs Salmon’s quantification of transcript expression (from the command line) |