Source: https://github.com/markziemann/bioinformatics_intro_workshop
Packages DESeq2, kableExtra, gplots and beeswarm are required.
Use the following commands to install them:
install.packages("gplots")
install.packages("beeswarm")
install.packages("kableExtra")
install.packages("BiocManager")
library("BiocManager")
BiocManager::install("DESeq2")
Previously we have been learning about how to use R to do basic numerical analysis, work with datatables and generate charts. In this session we will learn a new concept to take your Rstudio skills to the next level; R Markdown.
An R Markdown notebook file is a combination of text, code and outputs, which when executed generates a document that looks like a report and is a great way to share your work with others. The benefits of using an R Markdown notebook are:
The analysis is transparent and reproducible. The analysis steps (code) are shown in the report which means that the reader can get a good idea about what steps were done. This helps with auditing, in case inconsistencies arise. The report should be able to be reproduced perfectly by another researcher on another system so long as the software versions are consistent. The outputs of the analysis, including charts and tables are included in line after the corresponding code, so you can see which code chunk generated each output. This is in sharp contrast to previous approaches, which involved R scripts that generated many outputs and it was not clear which lines of code generated which output.
There is sufficient space to explain to the reader all the background details. For each chunk of code you use, you can write descriptions of any size to introduce concepts, explain rationale and discuss the results of analysis. This is much better than including come comments into the code using hashes # This explanatory text can also incorporated into the version control system so it enjoys all the benefits including backups and collaboration (more on that later).
The R Markdown report is versatile. The source file (.Rmd suffix) can be modified in Rstudio and with the version control system (eg: GitHub). The Rmd can be used to generate a bunch of different outputs from simple analysis reports, essays, draft journal articles, and even books and theses! In case you need to make some modifications to the analysis (for example by changing some parameters), it is relatively easy to regenerate the report after making these modifications in Rstudio. Contrast this to creating a word doc and then copy/pasting tables and charts everytime some modifications are made. The format can be changed by altering the document theme. There are themes for different types of documents like lab reports, marketing materials, books, etc. Individual Rmd notebooks that represent chapters in a thesis can be “bound” into a full book. The file format is HTML by default, and this allows the report to be viewed on differnt types of devices as a webpage, but it can also be generated as a PDF or DOCX.
With that out of the way, now it is time to describe what an R Markdown file actually is. It is a text document with a .Rmd suffix and contains three components:
Header
Free text
Code chunk and outputs
While there is just one header at the top of the Rmd, there are no limits to the size and number of free text and code chunk sections. You can literally have thousands of free text sections each with thousands of words. Similarly, you can have thousands of code chunks, each with thousands of lines of code. The only limitation is the execution time and the computing power available, so it is possible to make really large reports. Although it is possible to make really large reports thousands of pages long, it is best practise to keep them as short as possible. For example if the dataset contains 1000 lines of records, you wouldn’t want to show all of them in the report because that would take up dozens of pages. Rather it is best practice just to show a summary of the data with head(mydata) or str(mydata) which should only take up a few lines.
Have a look at an example.
So now let’s dig into the structure of an Rmd file a bit more.
The header tells Rstudio how the report should look. it contains, author, date and output information. Here is a minimal header example:
---
title: "Read in mydata.tsv"
author: "Jane Smith"
output: html_document
theme: cosmo
---
Here is an actual header that I have previously used (link):
---
title: "Compare DEG tools"
author: "Mark Ziemann"
date: "2026-10-16"
output:
html_document:
toc: true
theme: cosmo
---
Notice that you can specify additional options to get a report that contains a table of contents (TOC). The TOC is hyperlinked, so you can jump to other parts of the report with a mouse-click.
After the header, you’re free to add free text and code chunks.
The name “R Markdown” comes from the merging of “Markdown” and R scripts. Markdown is a lightweight markup language that allows us to create webpages and other documents from an extremely simple set of rules, as you can read at the Wikipedia link. The overall goal of Markdown is that the source file is simple to read/edit and can be easily converted to HTML in a web browser. The most important parts of Markdown for Rstudio users are Headers and free text, which are described in the Wikipedia page above and also in the Markdown cheatsheet which I will not duplicate here. Briefly, using Markdown you can format text with bold, italics, strikethrough, use block quotes, numbered lists, bullet lists, insert images and diagrams, videos, tables and many other features.
In R Markdown, it is good practice to have one sentence per line. One important thing to know is that if you want to have a line break (new paragraph), you will need to leave an empty line between sentences, otherwise they will appear in the same paragraph.
I’ve even used R Markdown to write essays for my own assessments in the units that I’m enrolled in. These PDFs that you are downloading from the unit site were also completely written in R Markdown. I find Markdown better than MS Word because Markdown has fewer ways that the text formatting can go wrong. In a way, MS Word is more flexible, but that means it’s more work to keep everything consistent throughout a long document like a journal article or thesis chapter. Also it isn’t possible to maintain an MS Word document with version control, unlike Markdown.
Using Markdown based text, you can break up your report into sections with headings, include an introduction to describe all the background information the reader will need, describe the rationale of the analysis, interpret the results of the analysis and provide some conclusions.
Code chunks are special Markdown elements that allow for lines of code to be executed. A code chunk begins with a chunk header that looks like this: ‘```{r}’, followed by some lines of code, followed by a chunk footer on a new like that looks like ‘```’.
Here is what a chunk looks like (except that the \ don’t belong there):
\```{r, mychunk1}
summary(cars)
plot(mtcars$`wt`,mtcars$`mpg`,xlab="weight",ylab="mpg",main="mtcars")
\```
You can see that this chunk has some information in the header.
Firstly, there is an r which tells Rstudio that the code should be executed with R. Interestingly Rstudio also allows execution of chunks with unix shell (sh), python and other languages, which makes it very flexible.
Other information provided includes the name mychunk1 which is an optional, arbitrary user-defined name which allows the user to give each chunk a unique name to aid the debugging process.
When this chunk is executed it will look like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
plot(mtcars$`wt`,mtcars$`mpg`,xlab="weight",ylab="mpg",main="mtcars",col="blue")
Isn’t that cool!
One thing I would recommend is adding the option fig.height=7 and fig.width=7 to get a nice square-shaped chart. So the chunk header would look like this:
```{r, mychunk1, fig.height=7, fig.width=7}
Now it is your turn to give it a try.
Create an Rmd document called “plantgrowth.Rmd” to analyse the built-in PlantGrowth dataset. In the “file” drop down menu create an R Markdown file. Type PlantGrowth to check the dataset format. It contains measurements of control (ctrl) and treated (trt1, trt2) samples.
In the Rmd, calculate the mean, median and interquartile ranges of the three groups of samples, and plot these as a boxplot. Use the head() and str() commands to get a better idea of the structure of the dataset.
Use plain text to explain the steps you are doing, and headings as appropriate.
Include a chunk at the very end of each Rmd file that executes the sessionInfo() command. We do this so that the reader can see what version of R was used along with all the loaded package versions. In theory, the report is 100% reproducible if the software versions are consistent (unless some element of randomness was used).
Finally, run “knit” for both your Rmd files to ensure that there are no errors and that they are generating the desired output.
We will analyse gene expression data from 39 lung cancer patients that includes matched tumor and normal adjacent tissue, which is available from NCBI GEO under accession number GSE158420.
The general goals of today’s session is to conduct the following:
Load the needed libraries.
Data import, checking and cleaning.
Basic quality control: count the number of reads per sample.
Principal component analysis: quantify within and between group variation.
Statistical analysis of differential expression.
Visualisation of key findings.
For all of these steps, I will be providing you helpful code chunks for conducting the analysis, but it is up to you to put the pieces into a complete workflow.
As you are growing the workflow, be sure to knit it regularly to ensure the parts are working well together.
For best results, work in small groups of 2-3.
library("DESeq2") # differential expression
## Loading required package: S4Vectors
## Loading required package: stats4
## Loading required package: BiocGenerics
## Loading required package: generics
##
## Attaching package: 'generics'
## The following objects are masked from 'package:base':
##
## as.difftime, as.factor, as.ordered, intersect, is.element, setdiff,
## setequal, union
##
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:stats':
##
## IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
##
## anyDuplicated, aperm, append, as.data.frame, basename, cbind,
## colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
## get, grep, grepl, is.unsorted, lapply, Map, mapply, match, mget,
## order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
## rbind, Reduce, rownames, sapply, saveRDS, table, tapply, unique,
## unsplit, which.max, which.min
##
## Attaching package: 'S4Vectors'
## The following object is masked from 'package:utils':
##
## findMatches
## The following objects are masked from 'package:base':
##
## expand.grid, I, unname
## Loading required package: IRanges
## Loading required package: GenomicRanges
## Loading required package: Seqinfo
## Loading required package: SummarizedExperiment
## Loading required package: MatrixGenerics
## Loading required package: matrixStats
##
## Attaching package: 'MatrixGenerics'
## The following objects are masked from 'package:matrixStats':
##
## colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
## colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
## colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
## colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
## colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
## colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
## colWeightedMeans, colWeightedMedians, colWeightedSds,
## colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
## rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
## rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
## rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
## rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
## rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
## rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
## rowWeightedSds, rowWeightedVars
## Loading required package: Biobase
## Welcome to Bioconductor
##
## Vignettes contain introductory material; view with
## 'browseVignettes()'. To cite Bioconductor, see
## 'citation("Biobase")', and for packages 'citation("pkgname")'.
##
## Attaching package: 'Biobase'
## The following object is masked from 'package:MatrixGenerics':
##
## rowMedians
## The following objects are masked from 'package:matrixStats':
##
## anyMissing, rowMedians
library("kableExtra") # neat html tables
library("gplots") # heatmap
##
## ---------------------
## gplots 3.3.0 loaded:
## * Use citation('gplots') for citation info.
## * Homepage: https://talgalili.github.io/gplots/
## * Report issues: https://github.com/talgalili/gplots/issues
## * Ask questions: https://stackoverflow.com/questions/tagged/gplots
## * Suppress this message with: suppressPackageStartupMessages(library(gplots))
## ---------------------
##
## Attaching package: 'gplots'
## The following object is masked from 'package:IRanges':
##
## space
## The following object is masked from 'package:S4Vectors':
##
## space
## The following object is masked from 'package:stats':
##
## lowess
library("beeswarm") # beeswarm chart
Cleaned RNA-seq expression counts are available here.
Use download.file() to download it to your local directory.
Then use read.table() to read it in.
Then use str(), head() and dim() to see what the dataset table looks like and check the dimensions of the object.
If there are ~60,000 genes annotated in the human genome, do you think this dataset has already undergone some filtering of lowly expressed genes?
URL="https://raw.githubusercontent.com/markziemann/bioinformatics_intro_workshop/refs/heads/2026/GSE158420_counts_fixed.tsv"
download.file(url=URL,destfile="GSE158420_counts_fixed.tsv")
x <- read.table("GSE158420_counts_fixed.tsv")
head(x)
## X10N X10T X11N X11T X12N X12T X14N X14T X15N X15T X16N
## A1BG 120 217 148 39 73 87 146 95 88 69 72
## A1CF 8 29 22 2 0 1 4 0 2 3 1
## A2M 89330 6096 39181 3282 126977 89739 108730 40523 160543 179385 155740
## A2ML1 16 1307 50 2729 26 19 31 393 20 16 21
## A3GALT2 5 49 21 3 2 0 1 5 1 4 5
## A4GALT 304 1138 350 1439 219 149 178 809 446 150 300
## X16T X17N X17T X18N X18T X19N X19T X20N X20T X21N X21T
## A1BG 121 63 30 113 279 43 137 152 129 56 19
## A1CF 0 3 9 4 104 0 46 6 3 1 1
## A2M 39899 129176 16554 109697 15992 125658 3504 106485 59452 194434 10592
## A2ML1 17 15 114 13 591 10 5830 16 38 15 29
## A3GALT2 4 2 3 13 76 3 53 17 5 14 6
## A4GALT 249 203 286 296 787 209 1814 335 554 220 311
## X22N X22T X23N X23T X24N X24T X25N X25T X26N X26T X27N
## A1BG 92 12 106 85 68 101 107 15 50 46 110
## A1CF 1 10 2 5 3 1 3 7 2 5 1
## A2M 127707 7544 129002 107685 84494 8974 125875 3304 133114 23805 124283
## A2ML1 13 146 13 24 16 298 96 2730 7 257 9
## A3GALT2 1 6 4 1 8 11 17 0 4 13 9
## A4GALT 248 115 291 567 177 728 248 536 284 445 235
## X27T X28N X28T X29N X29T X2N X2T X30N X30T X31N X31T
## A1BG 155 143 64 204 125 82 117 97 127 115 39
## A1CF 1 2 4 3 4 0 0 2 6 1 1
## A2M 16776 163693 15056 56772 32450 110818 57261 242936 22835 157038 5604
## A2ML1 3891 74 67 19 50 8 11 8 28 31 93
## A3GALT2 16 6 1 11 6 6 6 19 1 10 8
## A4GALT 1059 586 3534 808 461 280 1505 723 236 442 481
## X32N X32T X33N X33T X34N X34T X35N X35T X36N X36T X37N
## A1BG 82 105 116 104 119 63 101 111 58 90 107
## A1CF 0 0 3 2 3 1 7 4 1 3 4
## A2M 158632 11656 64662 92680 122607 84313 190327 145504 148968 7674 38901
## A2ML1 6 130 42 9 17 31 22 33 9 33 24
## A3GALT2 14 3 6 10 10 12 8 14 1 47 5
## A4GALT 299 94 292 564 345 694 452 521 454 322 656
## X37T X38N X38T X39N X39T X3N X3T X4N X4T X5N X5T X6N
## A1BG 57 57 133 105 125 67 94 99 291 87 59 68
## A1CF 9 1 15 2 5 2 18 1 6 3 10 0
## A2M 65047 82116 123542 127464 91470 99241 9283 117914 5648 89583 2462 97346
## A2ML1 58 12 61 13 26 13 3833 57 499 37 1108 5
## A3GALT2 1 14 30 2 10 12 21 18 11 8 3 2
## A4GALT 949 588 934 209 473 359 1134 257 711 235 627 126
## X6T X7N X7T X8N X8T X9N X9T
## A1BG 27 108 86 194 84 77 8
## A1CF 0 2 6 35 9 1 0
## A2M 9188 98328 29242 15384 26414 121946 4447
## A2ML1 632 8 329 158 1072 13 2879
## A3GALT2 1 16 9 57 9 11 3
## A4GALT 1176 225 2035 498 491 160 1470
dim(x)
## [1] 18704 74
For RNA-seq, there are several types of QC that can be done. Let’s just focus on quantifying the number of reads per sample. This can be calculated with the colSums() command. Present the data as a bargraph, using the barplot() or ggplot2() functions.
The size of the chart can be adjusted using fig.width and fig.height options in the chunk header.
Does the dataset need any additional filtering of lowly expressed genes?
colSums(x)
## X10N X10T X11N X11T X12N X12T X14N X14T
## 25013412 21355158 23715570 23008410 23539213 23438887 22828432 21989978
## X15N X15T X16N X16T X17N X17T X18N X18T
## 25091038 22134783 27932373 24848810 26094608 24379481 24329929 15715862
## X19N X19T X20N X20T X21N X21T X22N X22T
## 24878375 21280605 21485147 22776668 27373026 19265323 24656928 25807715
## X23N X23T X24N X24T X25N X25T X26N X26T
## 22490711 23507681 24017423 31018240 22673595 25196462 21506039 20385568
## X27N X27T X28N X28T X29N X29T X2N X2T
## 29173162 27732752 27745839 26194606 23154972 25635266 24558560 24149248
## X30N X30T X31N X31T X32N X32T X33N X33T
## 30341513 24467737 26246565 26003629 23777939 19206611 25947277 21801499
## X34N X34T X35N X35T X36N X36T X37N X37T
## 27845354 27616972 29606629 26995063 25442133 21854398 27090620 24554290
## X38N X38T X39N X39T X3N X3T X4N X4T
## 21896705 28795533 21261403 25768968 26103056 24645006 23046538 25690059
## X5N X5T X6N X6T X7N X7T X8N X8T
## 24138260 25661233 24029863 24994427 23236706 24210914 18288909 22429225
## X9N X9T
## 22688194 21733571
sort(colSums(x))
## X18T X8N X32T X21T X26T X39N X19T X10T
## 15715862 18288909 19206611 19265323 20385568 21261403 21280605 21355158
## X20N X26N X9T X33T X36T X38N X14T X15T
## 21485147 21506039 21733571 21801499 21854398 21896705 21989978 22134783
## X8T X23N X25N X9N X20T X14N X11T X4N
## 22429225 22490711 22673595 22688194 22776668 22828432 23008410 23046538
## X29N X7N X12T X23T X12N X11N X32N X24N
## 23154972 23236706 23438887 23507681 23539213 23715570 23777939 24017423
## X6N X5N X2T X7T X18N X17T X30T X37T
## 24029863 24138260 24149248 24210914 24329929 24379481 24467737 24554290
## X2N X3T X22N X16T X19N X6T X10N X15N
## 24558560 24645006 24656928 24848810 24878375 24994427 25013412 25091038
## X25T X36N X29T X5T X4T X39T X22T X33N
## 25196462 25442133 25635266 25661233 25690059 25768968 25807715 25947277
## X31T X17N X3N X28T X31N X35T X37N X21N
## 26003629 26094608 26103056 26194606 26246565 26995063 27090620 27373026
## X34T X27T X28N X34N X16N X38T X27N X35N
## 27616972 27732752 27745839 27845354 27932373 28795533 29173162 29606629
## X30N X24T
## 30341513 31018240
mycounts <- sort(colSums(x))
barplot(mycounts,horiz=TRUE,las=1)
barplot(mycounts,horiz=TRUE,las=1,cex.names=0.4,main="Reads per sample")
hist(log10(rowMeans(x)))
You can use the cmdscale() functions. Here are examples below, assuming the gene expression data is named x
Initially, we can quantify the dimensions using sd().
When we plot the MDS, the first two dimensions are selected automatically, but that can be changed if desired.
The closer the points are, the more correlated the datasets are. This can be used to demonstrate clustering between sample groups.
mds <- cmdscale(dist(t(scale(x))),k=6)
head(mds)
## [,1] [,2] [,3] [,4] [,5] [,6]
## X10N 40.070771 -13.852841 0.8921715 4.377453 6.505232 11.4130878
## X10T -81.069795 -20.808417 -13.3728277 -4.789210 -16.245612 -0.5466543
## X11N 32.630497 -1.196597 -2.0156752 -6.995532 -4.564001 -3.0615883
## X11T -41.065942 -1.730249 36.4369671 -5.096060 17.811098 18.1193181
## X12N 41.507851 -6.608014 -10.5664939 -12.986290 -13.236209 -10.6621547
## X12T 3.508647 48.516745 -40.8269763 -8.989894 -32.036675 13.7165380
apply(mds, 2, sd)
## [1] 43.73266 28.45592 22.86441 20.89168 18.75565 15.61361
barplot(apply(mds, 2, sd), names.arg=1:6)
plot(mds, col="gray", pch=19, cex=2, xlab="Dim 1", ylab="Dim 2", main="MDS plot")
text(mds, labels=colnames(x))
Alternatively princomp() can be used.
In this step we will conduct differential analysis. We will use DESeq2 because it has superior accuracy compared to other similar packages. Make yourself familiar with the DESeq2 page on Bioconductor.
We need to set up a samplesheet (ss). We will need to set up a sample sheet that has the patient ID and whether the sample is normal or tumour. Normally this is provided by the clinical team. Here we will use column names to make our own. Make columns for the patient ID and tumor status. These are categorical data, so should be converted to factors.
ss <- as.data.frame(colnames(x))
rownames(ss) <- ss[,1]
ss$patient <- factor(gsub("T","",gsub("N","",gsub("X","",ss[,1]))))
ss$tumor <- factor(grepl("T",ss[,1]))
ss[,1]=NULL
head(ss)
## patient tumor
## X10N 10 FALSE
## X10T 10 TRUE
## X11N 11 FALSE
## X11T 11 TRUE
## X12N 12 FALSE
## X12T 12 TRUE
The samplesheet should be included in the report in a nice kable table.
ss %>%
kbl(caption = "Sample sheet") %>%
kable_paper("hover", full_width = F)
| patient | tumor | |
|---|---|---|
| X10N | 10 | FALSE |
| X10T | 10 | TRUE |
| X11N | 11 | FALSE |
| X11T | 11 | TRUE |
| X12N | 12 | FALSE |
| X12T | 12 | TRUE |
| X14N | 14 | FALSE |
| X14T | 14 | TRUE |
| X15N | 15 | FALSE |
| X15T | 15 | TRUE |
| X16N | 16 | FALSE |
| X16T | 16 | TRUE |
| X17N | 17 | FALSE |
| X17T | 17 | TRUE |
| X18N | 18 | FALSE |
| X18T | 18 | TRUE |
| X19N | 19 | FALSE |
| X19T | 19 | TRUE |
| X20N | 20 | FALSE |
| X20T | 20 | TRUE |
| X21N | 21 | FALSE |
| X21T | 21 | TRUE |
| X22N | 22 | FALSE |
| X22T | 22 | TRUE |
| X23N | 23 | FALSE |
| X23T | 23 | TRUE |
| X24N | 24 | FALSE |
| X24T | 24 | TRUE |
| X25N | 25 | FALSE |
| X25T | 25 | TRUE |
| X26N | 26 | FALSE |
| X26T | 26 | TRUE |
| X27N | 27 | FALSE |
| X27T | 27 | TRUE |
| X28N | 28 | FALSE |
| X28T | 28 | TRUE |
| X29N | 29 | FALSE |
| X29T | 29 | TRUE |
| X2N | 2 | FALSE |
| X2T | 2 | TRUE |
| X30N | 30 | FALSE |
| X30T | 30 | TRUE |
| X31N | 31 | FALSE |
| X31T | 31 | TRUE |
| X32N | 32 | FALSE |
| X32T | 32 | TRUE |
| X33N | 33 | FALSE |
| X33T | 33 | TRUE |
| X34N | 34 | FALSE |
| X34T | 34 | TRUE |
| X35N | 35 | FALSE |
| X35T | 35 | TRUE |
| X36N | 36 | FALSE |
| X36T | 36 | TRUE |
| X37N | 37 | FALSE |
| X37T | 37 | TRUE |
| X38N | 38 | FALSE |
| X38T | 38 | TRUE |
| X39N | 39 | FALSE |
| X39T | 39 | TRUE |
| X3N | 3 | FALSE |
| X3T | 3 | TRUE |
| X4N | 4 | FALSE |
| X4T | 4 | TRUE |
| X5N | 5 | FALSE |
| X5T | 5 | TRUE |
| X6N | 6 | FALSE |
| X6T | 6 | TRUE |
| X7N | 7 | FALSE |
| X7T | 7 | TRUE |
| X8N | 8 | FALSE |
| X8T | 8 | TRUE |
| X9N | 9 | FALSE |
| X9T | 9 | TRUE |
Here is a general workflow of how DESeq2 can be applied, which does a paired analysis.
dds <- DESeqDataSetFromMatrix(countData = x , colData=ss, design = ~ patient + tumor)
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## 1 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
dge[1:10,1:6]
## baseMean log2FoldChange lfcSE stat pvalue
## PDK1 937.8952 2.135137 0.1258481 16.96598 1.466252e-64
## SPP1 17973.0188 4.417347 0.2689330 16.42546 1.257307e-60
## AGER 11561.4469 -5.477402 0.3350700 -16.34704 4.566465e-60
## MMP12 1248.0259 4.512944 0.2770686 16.28818 1.197405e-59
## KRT16 6222.4749 5.837821 0.3646853 16.00783 1.126628e-57
## KRT6A 101473.3174 6.204029 0.3928314 15.79311 3.470406e-56
## CLDN18 1566.5015 -4.550731 0.2973923 -15.30212 7.401016e-53
## NCKAP5 3576.0654 -3.273828 0.2147737 -15.24315 1.828447e-52
## PPP2R2C 251.8864 5.634243 0.3721481 15.13979 8.850223e-52
## GPA33 202.7639 -4.075666 0.2703226 -15.07704 2.293050e-51
## padj
## PDK1 2.726788e-60
## SPP1 1.169107e-56
## AGER 2.830751e-56
## MMP12 5.567034e-56
## KRT16 4.190381e-54
## KRT6A 1.075652e-52
## CLDN18 1.966238e-49
## NCKAP5 4.250453e-49
## PPP2R2C 1.828751e-48
## GPA33 4.264386e-48
To disregard the patient pairing, delete patient + from the DESeqDataSetFromMatrix command. You will notice that including sample pairing drastically improves statistical power.
Once DESeq2 is done, count the number of genes with FDR<0.05 that are up- and down-regulated. The subset() function can be used for this.
Make kable tables showing the top 20 up and down regulated genes as ranked by p-value.
nrow(subset(dge, padj<0.05 & log2FoldChange>0))
## [1] 7415
nrow(subset(dge, padj<0.05 & log2FoldChange<0))
## [1] 4965
subset(dge, padj<0.05 & log2FoldChange>0)[1:20,1:6] %>%
kbl(caption = "Top upregulated genes") %>%
kable_paper("hover", full_width = F)
| baseMean | log2FoldChange | lfcSE | stat | pvalue | padj | |
|---|---|---|---|---|---|---|
| PDK1 | 937.89516 | 2.135137 | 0.1258481 | 16.96598 | 0 | 0 |
| SPP1 | 17973.01877 | 4.417347 | 0.2689330 | 16.42546 | 0 | 0 |
| MMP12 | 1248.02590 | 4.512944 | 0.2770686 | 16.28818 | 0 | 0 |
| KRT16 | 6222.47492 | 5.837821 | 0.3646853 | 16.00783 | 0 | 0 |
| KRT6A | 101473.31744 | 6.204029 | 0.3928314 | 15.79311 | 0 | 0 |
| PPP2R2C | 251.88644 | 5.634243 | 0.3721481 | 15.13979 | 0 | 0 |
| DSG3 | 3758.29050 | 6.506869 | 0.4448106 | 14.62840 | 0 | 0 |
| ZIC2 | 85.66032 | 4.656638 | 0.3231962 | 14.40808 | 0 | 0 |
| CALML3 | 258.87718 | 5.952597 | 0.4165206 | 14.29124 | 0 | 0 |
| TUBB3 | 1068.06821 | 3.649497 | 0.2577809 | 14.15736 | 0 | 0 |
| TICRR | 448.05671 | 3.693874 | 0.2622315 | 14.08631 | 0 | 0 |
| COL11A1 | 1767.04346 | 4.112089 | 0.2919503 | 14.08489 | 0 | 0 |
| HOXA10 | 290.97605 | 4.035229 | 0.2868807 | 14.06588 | 0 | 0 |
| SERPINE2 | 625.77226 | 2.952067 | 0.2123605 | 13.90121 | 0 | 0 |
| PI15 | 106.88273 | 4.351186 | 0.3155009 | 13.79136 | 0 | 0 |
| B4GALNT4 | 100.02719 | 3.862416 | 0.2801867 | 13.78515 | 0 | 0 |
| PSAT1 | 482.39242 | 3.227686 | 0.2343246 | 13.77442 | 0 | 0 |
| MYBL2 | 724.87125 | 3.675804 | 0.2671747 | 13.75806 | 0 | 0 |
| SLC2A1 | 3544.97241 | 3.829011 | 0.2809181 | 13.63034 | 0 | 0 |
| DLGAP5 | 671.90609 | 3.423135 | 0.2546829 | 13.44077 | 0 | 0 |
subset(dge, padj<0.05 & log2FoldChange<0)[1:20,1:6] %>%
kbl(caption = "Top downregulated genes") %>%
kable_paper("hover", full_width = F)
| baseMean | log2FoldChange | lfcSE | stat | pvalue | padj | |
|---|---|---|---|---|---|---|
| AGER | 11561.4469 | -5.477402 | 0.3350700 | -16.34704 | 0 | 0 |
| CLDN18 | 1566.5015 | -4.550731 | 0.2973923 | -15.30212 | 0 | 0 |
| NCKAP5 | 3576.0654 | -3.273827 | 0.2147737 | -15.24315 | 0 | 0 |
| GPA33 | 202.7639 | -4.075666 | 0.2703226 | -15.07704 | 0 | 0 |
| SLC6A4 | 892.1543 | -4.759471 | 0.3181866 | -14.95811 | 0 | 0 |
| CLIC5 | 3786.4950 | -4.567870 | 0.3181320 | -14.35841 | 0 | 0 |
| FABP4 | 2345.3615 | -4.866164 | 0.3413414 | -14.25600 | 0 | 0 |
| RGCC | 1638.5670 | -3.119538 | 0.2189143 | -14.25004 | 0 | 0 |
| EMP2 | 3619.3202 | -2.733623 | 0.1929350 | -14.16862 | 0 | 0 |
| GRIA1 | 383.9068 | -3.934796 | 0.2796520 | -14.07033 | 0 | 0 |
| RAB11FIP1 | 6948.6711 | -2.457498 | 0.1755447 | -13.99927 | 0 | 0 |
| TNNC1 | 2165.7843 | -4.248620 | 0.3041176 | -13.97032 | 0 | 0 |
| PRX | 1256.5956 | -2.547103 | 0.1828826 | -13.92753 | 0 | 0 |
| INMT | 1227.8307 | -4.462958 | 0.3230968 | -13.81307 | 0 | 0 |
| RTKN2 | 4815.9237 | -3.680728 | 0.2672934 | -13.77037 | 0 | 0 |
| MYRF | 932.7512 | -3.332325 | 0.2436880 | -13.67455 | 0 | 0 |
| ENTREP1 | 702.6908 | -3.525212 | 0.2585197 | -13.63615 | 0 | 0 |
| LMO7 | 30999.7934 | -2.699189 | 0.2018979 | -13.36908 | 0 | 0 |
| SFTPC | 67868.1016 | -6.258806 | 0.4742181 | -13.19816 | 0 | 0 |
| UPK3B | 892.8225 | -2.921199 | 0.2217162 | -13.17540 | 0 | 0 |
We are going to make four charts: MA plot, volcano plot, heatmap and gene boxplot.
Use plot() with log10(baseMean) on the x-axis and log2 fold change on the y-axis. Mark significant genes in a different colour. This can be achieved by first running plot() and then points(). The points() function adds additional data series to the plot. Bonus points for adding a subtitle that includes the number of genes in total, the number with FDR<0.05 that are up- and down-regulated respectively. The mtext() function can add a subheading.
sig <- subset(dge, padj<0.05)
plot(log10(dge$baseMean), dge$log2FoldChange,
pch=19, cex=0.7, col="gray",
main="Lung cancer gene expression",
xlab="log10(baseMean)",
ylab="log2(fold change)")
points(log10(sig$baseMean),sig$log2FoldChange,pch=19,cex=0.7,col="darkorange")
N_TOT <- nrow(dge)
N_SIG <- nrow(sig)
N_UP <- nrow(subset(sig, log2FoldChange>0))
N_DN <- nrow(subset(sig, log2FoldChange<0))
HEADER <- paste(N_SIG,"genes of",N_TOT, "@5% FDR, ",N_UP,"up, and",N_DN, "down")
mtext(HEADER)
Similar to the above, except that log2 fold change is on the x-axis and -log10 p-value is on the y-axis.
plot(dge$log2FoldChange,-log10(dge$pvalue),
pch=19, cex=0.7, col="gray",
main="Lung cancer gene expression",
xlab="log2(fold change)",
ylab="-log10(p-value)")
points(sig$log2FoldChange, -log10(sig$pvalue) , pch=19,cex=0.7,col="darkorange")
mtext(HEADER)
Use the heatmap.2 function of the gplots() CRAN package to make a heatmap with the top 50 genes.
Here is an example of plotting Pearson correlation coefficient with the default red and yellow palette.
heatmap.2(cor(x),trace="n",scale="none", main="Pearson correlation heatmap")
Now for showing the ctrl-tumor differences. First we make a blue, white and red palette which is popular. Then we create a library size normalised verison of the data, where intensities are shown in reads per million (rpm). Then we can make a heatmap of the top X DE genes with data from the rpm object.
colfunc <- colorRampPalette(c("blue", "white", "red"))
rpm <- apply(x,2,function(x) { x/sum(x) * 1e6 } ) # reads per million normalisation
colSums(rpm)
## X10N X10T X11N X11T X12N X12T X14N X14T X15N X15T X16N X16T X17N
## 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06
## X17T X18N X18T X19N X19T X20N X20T X21N X21T X22N X22T X23N X23T
## 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06
## X24N X24T X25N X25T X26N X26T X27N X27T X28N X28T X29N X29T X2N
## 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06
## X2T X30N X30T X31N X31T X32N X32T X33N X33T X34N X34T X35N X35T
## 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06
## X36N X36T X37N X37T X38N X38T X39N X39T X3N X3T X4N X4T X5N
## 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06
## X5T X6N X6T X7N X7T X8N X8T X9N X9T
## 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06 1e+06
NGENES=30
topgenes <- head(rownames(dge),NGENES)
topgeneindices <- which(rownames(rpm) %in% topgenes)
topmx <- log10(rpm[topgeneindices,]+1)
dim(topmx)
## [1] 30 74
head(topmx)
## X10N X10T X11N X11T X12N X12T
## AGER 3.17464076 0.7053468 2.51676671 0.9259339 2.87128431 2.42248545
## B4GALNT4 0.04919307 1.3834457 0.32145886 0.8228287 0.01806869 0.19162812
## CALML3 0.09337661 1.7151762 0.01793706 0.1822858 0.00000000 0.03556112
## CLDN18 2.25754290 0.7172075 1.49344369 0.2914071 2.13302394 1.64392737
## CLIC5 2.46900061 0.4790806 2.26322756 0.6950503 2.42440338 1.84766246
## COL11A1 0.78655656 2.4038835 0.74788831 1.7311876 0.46414717 2.28283511
## X14N X14T X15N X15T X16N X16T
## AGER 3.12073673 1.9284517 2.74055210 2.31122755 3.00500181 2.3228512
## B4GALNT4 0.05362196 0.7296203 0.10686514 0.08845108 0.03003332 0.1940721
## CALML3 0.18345784 1.2554594 0.01697273 0.05519987 0.01527622 0.1077876
## CLDN18 2.24389089 0.8250629 1.89120386 1.83278857 2.07554435 1.3280259
## CLIC5 2.66191953 1.5662549 2.38985695 1.95096101 2.42656884 1.8149725
## COL11A1 0.75153564 1.9990098 0.30024140 0.42676774 0.67424354 1.4161681
## X17N X17T X18N X18T X19N X19T
## AGER 3.18836716 1.2684784 2.93245105 1.635350 3.08716411 0.7935122
## B4GALNT4 0.25642041 1.1048685 0.08117017 1.363228 0.06475074 1.1070327
## CALML3 0.01633209 0.4604216 0.00000000 1.038472 0.03358100 0.5188515
## CLDN18 2.22054797 0.6398334 2.13972380 1.157224 2.45414244 0.5310378
## CLIC5 2.50902401 1.0544813 2.53352968 1.468037 2.71250207 0.5820030
## COL11A1 0.46480311 2.2165940 0.27024420 1.980828 0.39571689 2.2936368
## X20N X20T X21N X21T X22N X22T
## AGER 2.8418483 2.02556659 3.1588494 0.8130546 2.93375434 0.7945573
## B4GALNT4 0.3062026 0.41171477 0.1352355 0.8833242 0.17221710 1.2545884
## CALML3 0.0197574 0.07026634 0.1467032 1.0338407 0.03387113 1.2451223
## CLDN18 1.9186439 1.23886129 2.2032951 0.3201549 2.02331106 0.5010447
## CLIC5 2.3456953 1.72052292 2.5601236 1.7970264 2.40772249 0.4444216
## COL11A1 0.5220775 1.13913046 0.2194749 1.6173710 0.54082353 1.8398419
## X23N X23T X24N X24T X25N X25T
## AGER 3.11317869 1.2357170 2.87655232 0.6355468 3.1677144 0.6247705
## B4GALNT4 0.13216437 0.5237024 0.08213243 1.4184831 0.3742403 1.2727832
## CALML3 0.01889298 0.0837521 0.00000000 0.4378950 0.1019618 0.1691621
## CLDN18 2.00962847 0.8288405 2.13548213 0.8813284 2.0364152 0.0786165
## CLIC5 2.52482009 1.5491785 2.35427482 0.3078491 2.4571038 0.0786165
## COL11A1 0.44381228 1.6782050 0.51719645 1.6332189 1.3845845 2.0310198
## X26N X26T X27N X27T X28N X28T
## AGER 2.7602832 1.5796344 2.67480661 1.0351878 2.9286039 1.1160613
## B4GALNT4 0.0907844 1.0157525 0.02879735 0.9863276 0.2706776 1.0677857
## CALML3 0.0000000 1.3174132 0.04251024 1.4105427 0.2871470 1.7953576
## CLDN18 1.8853197 0.7991934 2.27062922 0.7323238 2.1450454 0.6862568
## CLIC5 2.4077633 1.7575193 2.32587657 1.0037503 2.4678929 0.8447008
## COL11A1 0.1518254 0.9296901 0.25246365 2.7061255 0.5000287 1.5004446
## X29N X29T X2N X2T X30N X30T
## AGER 2.58674936 1.3748051 3.02626383 1.4321088 2.4994344 0.5060973
## B4GALNT4 0.37694041 1.1647708 0.06553341 1.1981915 0.2839405 0.9488010
## CALML3 0.08491084 1.3390672 0.00000000 1.3858449 0.0277231 0.1092717
## CLDN18 1.51625788 0.9407025 2.18261744 0.6177441 1.8580779 0.5912628
## CLIC5 2.25153234 0.9987829 2.50602332 1.3056490 2.1417640 0.3475455
## COL11A1 0.74981650 2.7430110 0.62076902 2.2155749 0.9594089 2.5691316
## X31N X31T X32N X32T X33N X33T
## AGER 3.02849246 0.8591323 3.1121477 0.9157739 2.9108272 2.6505094
## B4GALNT4 0.12804433 0.9723623 0.1524589 0.7704210 0.1167132 0.7435860
## CALML3 0.03189317 1.5761937 0.2447728 1.9239700 0.0164231 0.3030026
## CLDN18 1.99426863 0.2662401 2.0956715 0.3717512 1.9293064 1.5666625
## CLIC5 2.51654796 0.5806172 2.5768011 1.1686526 2.3820624 2.0690408
## COL11A1 0.70883071 2.0939001 0.3702883 1.0070438 0.3489412 0.4309020
## X34N X34T X35N X35T X36N X36T
## AGER 3.03085809 0.68142305 2.83145274 2.7785789 3.03378616 1.0219140
## B4GALNT4 0.07172120 0.07226758 0.06777034 0.6217751 0.09195848 0.5346785
## CALML3 0.03012399 0.04478618 0.01442654 0.4011930 0.09195848 0.3218421
## CLDN18 2.31520544 0.33419385 2.12251782 1.7981402 2.32751867 0.2822023
## CLIC5 2.53442424 0.40153907 2.36560612 2.2084008 2.77767196 0.7935349
## COL11A1 0.19717084 0.31937437 0.14777357 0.4551785 0.64537556 2.1931970
## X37N X37T X38N X38T X39N X39T
## AGER 1.81222231 1.1993243 2.96683685 2.3895285 2.62151797 2.1804983
## B4GALNT4 0.09981596 0.1959453 0.08932031 0.8257718 0.13870323 0.3112816
## CALML3 0.03093403 0.7788245 0.00000000 1.0782365 0.03904399 0.1043657
## CLDN18 0.99057542 0.9011400 2.06375279 1.4511902 1.77286872 1.2170558
## CLIC5 1.98665611 1.4026524 2.36564707 1.9576141 2.24681689 1.9425825
## COL11A1 0.51211072 0.5213194 0.37476102 1.0414539 0.19434864 0.4387458
## X3N X3T X4N X4T X5N X5T
## AGER 2.82475807 1.0192928 2.8841648 0.6609747 2.82255629 0.4973873
## B4GALNT4 0.16426845 0.9063487 0.3936236 1.1096560 0.03457071 0.5714585
## CALML3 0.01632691 1.6439589 0.0000000 0.1889166 0.00000000 2.0189644
## CLDN18 1.93046355 0.4188061 1.9152433 0.2404458 2.11507184 0.3284019
## CLIC5 2.33697618 0.8274494 2.4305591 0.4456938 2.35066292 0.2779056
## COL11A1 0.43519691 1.8004607 0.7774198 1.2223783 0.63905482 1.9837114
## X6N X6T X7N X7T X8N X8T X9N
## AGER 3.08568671 0.4533811 2.9791450 1.8671915 2.3045194 1.8085812 3.1914046
## B4GALNT4 0.00000000 0.9138989 0.1929741 0.6582134 0.6687048 0.8148135 0.2428614
## CALML3 0.05109255 2.0064763 0.1143599 1.5240505 0.2729659 1.3198297 0.1167839
## CLDN18 2.23750917 0.6191669 1.9194360 1.1005889 1.3864541 0.8781741 2.1295933
## CLIC5 2.56584980 0.5106120 2.3841206 1.4270346 2.2677926 1.4845143 2.5837038
## COL11A1 0.89115966 3.1402779 0.7102354 1.6199708 1.3390994 1.6875790 0.7112270
## X9T
## AGER 0.8977241
## B4GALNT4 0.7858497
## CALML3 1.7523266
## CLDN18 0.4603689
## CLIC5 0.7337692
## COL11A1 1.3572403
heatmap.2( topmx, col=colfunc(25),
scale="row" , trace="none",
margins = c(6,10), cexRow=0.7, cexCol=0.7, main="Top genes")
Bonus points for using ColSideColors to specify which samples are tumour and which are normal.
mycols <- as.character(as.numeric(ss$tumor))
mycols <- gsub("1","lightgreen",mycols)
mycols <- gsub("2","magenta",mycols)
mycols
## [1] "lightgreen" "magenta" "lightgreen" "magenta" "lightgreen"
## [6] "magenta" "lightgreen" "magenta" "lightgreen" "magenta"
## [11] "lightgreen" "magenta" "lightgreen" "magenta" "lightgreen"
## [16] "magenta" "lightgreen" "magenta" "lightgreen" "magenta"
## [21] "lightgreen" "magenta" "lightgreen" "magenta" "lightgreen"
## [26] "magenta" "lightgreen" "magenta" "lightgreen" "magenta"
## [31] "lightgreen" "magenta" "lightgreen" "magenta" "lightgreen"
## [36] "magenta" "lightgreen" "magenta" "lightgreen" "magenta"
## [41] "lightgreen" "magenta" "lightgreen" "magenta" "lightgreen"
## [46] "magenta" "lightgreen" "magenta" "lightgreen" "magenta"
## [51] "lightgreen" "magenta" "lightgreen" "magenta" "lightgreen"
## [56] "magenta" "lightgreen" "magenta" "lightgreen" "magenta"
## [61] "lightgreen" "magenta" "lightgreen" "magenta" "lightgreen"
## [66] "magenta" "lightgreen" "magenta" "lightgreen" "magenta"
## [71] "lightgreen" "magenta" "lightgreen" "magenta"
heatmap.2( topmx, col=colfunc(25),
scale="row" , trace="none",
margins = c(6,10), cexRow=0.7, cexCol=0.7,
main="Top genes",
ColSideColors=mycols )
mtext("green:ctrl, pink:tumor")
This ensures your script runs from top to bottom and doesn’t rely on objects previously saved in the memory.
Hit the knit button, or type rmarkdown::render("myanalysis.Rmd") to generate the html.
At the end of all reports, include sessionInfo() to print out the version R and all the libraries used. It helps with reproducibility.
sessionInfo()
## R version 4.6.1 (2026-06-24)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.5 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## time zone: Australia/Melbourne
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats4 stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] beeswarm_0.4.0 gplots_3.3.0
## [3] kableExtra_1.4.1 DESeq2_1.52.0
## [5] SummarizedExperiment_1.42.0 Biobase_2.72.0
## [7] MatrixGenerics_1.24.0 matrixStats_1.5.0
## [9] GenomicRanges_1.64.0 Seqinfo_1.2.0
## [11] IRanges_2.46.0 S4Vectors_0.50.1
## [13] BiocGenerics_0.58.1 generics_0.1.4
##
## loaded via a namespace (and not attached):
## [1] gtable_0.3.6 xfun_0.61 bslib_0.12.0
## [4] ggplot2_4.0.3 caTools_1.18.4 lattice_0.23-1
## [7] bitops_1.1-0 vctrs_0.7.3 tools_4.6.1
## [10] parallel_4.6.1 tibble_3.3.1 pkgconfig_2.0.3
## [13] KernSmooth_2.23-27 Matrix_1.7-6 RColorBrewer_1.1-3
## [16] S7_0.2.2 lifecycle_1.0.5 compiler_4.6.1
## [19] farver_2.1.2 stringr_1.6.0 textshaping_1.0.5
## [22] codetools_0.2-20 htmltools_0.5.9 sass_0.4.10
## [25] yaml_2.3.12 pillar_1.11.1 jquerylib_0.1.4
## [28] BiocParallel_1.46.0 DelayedArray_0.38.1 cachem_1.1.0
## [31] abind_1.4-8 gtools_3.9.5 tidyselect_1.2.1
## [34] locfit_1.5-9.12 digest_0.6.39 stringi_1.8.9
## [37] dplyr_1.2.1 fastmap_1.2.0 grid_4.6.1
## [40] cli_3.6.6 SparseArray_1.12.2 magrittr_2.0.5
## [43] S4Arrays_1.12.0 dichromat_2.0-1 scales_1.4.0
## [46] rmarkdown_2.32 XVector_0.52.0 otel_0.2.0
## [49] evaluate_1.0.5 knitr_1.52 viridisLite_0.4.3
## [52] rlang_1.3.0 Rcpp_1.1.2 glue_1.8.1
## [55] xml2_1.6.0 svglite_2.2.2 rstudioapi_0.19.0
## [58] jsonlite_2.0.0 R6_2.6.1 systemfonts_1.3.2