Learn how to create and interpret a volcano plot for visualizing differentially expressed genes (DEGs) from gene expression data using the ggplot2 package in R.
Prerequisites:
Basic knowledge of R and data manipulation
tidyverse and ggplot2 packages installed (install.packages(c("tidyverse", "ggplot2")))
Exercise Steps:
1. Install and Load Necessary Packages
Ensure you have the necessary packages installed and loaded.
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.5.1 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.1
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggplot2)library(ggrepel)library(readxl)
2. Load Gene Expression Data
For this exercise, we’ll use a gene expression dataset stored in an Excel file. Typically, you would have results from a differential expression analysis.
data <-read_excel("../_files_module_1/rnaseq.xlsx")head(data)