-
Notifications
You must be signed in to change notification settings - Fork 0
/
10. Gene Expression Analysis - HDFn - GSE84144.Rmd
186 lines (147 loc) · 5.86 KB
/
10. Gene Expression Analysis - HDFn - GSE84144.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
---
title: "Gene Expression Analysis"
subtitle: "Human Dermal Fibroblasts, neonatal (HDFn) | GSE84144 | Necroptosis, Ferroptosis & Pyroptosis"
author:
- Mark Edward M. Gonzales^[De La Salle University, Manila, Philippines, gonzales.markedward@gmail.com]
- Dr. Anish M.S. Shrestha^[De La Salle University, Manila, Philippines, anish.shrestha@dlsu.edu.ph]
output: html_notebook
---
## I. Preliminaries
### Loading libraries
```{r, warning=FALSE, message=FALSE}
library("tidyverse")
library("tibble")
library("msigdbr")
library("ggplot2")
library("ensembldb")
library("purrr")
library("magrittr")
library("matrixStats")
library("dplyr")
library("grex")
library("gplots")
library("RColorBrewer")
library("illuminaHumanv4.db")
```
### Constants
```{r}
DATA_DIR <- "data/HDFn/"
```
## Loading the Expression Data
The expression data are taken from this study: https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE84144
Download the RNA-seq normalized counts matrices (one matrix per replicate) from:
- https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSM2227697
- https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSM2227698
- https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSM2227699
```{r}
hdfn.expression1 <- read.delim(paste0(DATA_DIR, "GSE84144-hdfn-1.tsv"), as.is = TRUE, header = TRUE, row.names = 1)
hdfn.expression1 <- rownames_to_column(hdfn.expression1, "ID_REF")
hdfn.expression1 <- hdfn.expression1[c("ID_REF", "VALUE")]
hdfn.expression2 <- read.delim(paste0(DATA_DIR, "GSE84144-hdfn-2.tsv"), as.is = TRUE, header = TRUE, row.names = 1)
hdfn.expression2 <- rownames_to_column(hdfn.expression2, "ID_REF")
hdfn.expression2 <- hdfn.expression2[c("ID_REF", "VALUE")]
hdfn.expression3 <- read.delim(paste0(DATA_DIR, "GSE84144-hdfn-3.tsv"), as.is = TRUE, header = TRUE, row.names = 1)
hdfn.expression3 <- rownames_to_column(hdfn.expression3, "ID_REF")
hdfn.expression3 <- hdfn.expression3[c("ID_REF", "VALUE")]
hdfn.expression3
```
Merge the gene expression data for the three replicates into one data frame.
```{r}
hdfn.expression <- left_join(hdfn.expression1, hdfn.expression2, join_by(ID_REF))
hdfn.expression <- left_join(hdfn.expression, hdfn.expression3, join_by(ID_REF))
hdfn.expression <- hdfn.expression %>% rename("VALUE.x" = "Replicate 1", "VALUE.y" = "Replicate 2", "VALUE" = "Replicate 3")
hdfn.expression
```
Map the Illumina probe IDs to Ensembl accessions.
```{r}
illumina_to_ensembl = data.frame(gene_id=unlist(mget(x = hdfn.expression[["ID_REF"]], envir = illuminaHumanv4ENSEMBL)))
illumina_to_ensembl <- rownames_to_column(illumina_to_ensembl, "ID_REF")
illumina_to_ensembl
```
```{r}
hdfn.expression <- left_join(hdfn.expression, illumina_to_ensembl)
hdfn.expression
```
## Exploratory Data Analysis
We load the gene sets from RCDdb: https://pubmed.ncbi.nlm.nih.gov/39257527/
```{r}
RCDdb <- "data/RCDdb/"
```
### Necroptosis
Load the gene set.
```{r}
genes <- read.csv(paste0(RCDdb, "Necroptosis.csv"))
genes$gene_id <- cleanid(genes$gene_id)
genes <- distinct(genes, gene_id, .keep_all = TRUE)
genes <- subset(genes, gene_id != "")
genes
```
Get the normalized expression data for the genes in the gene set.
```{r}
tpm.df <- hdfn.expression %>% dplyr::filter(gene_id %in% genes$gene_id)
tpm.df <- left_join(tpm.df, genes %>% dplyr::select(gene_id, gene), by = c("gene_id" = "gene_id"))
tpm.df <- distinct(tpm.df, gene, .keep_all = TRUE)
rownames(tpm.df) <- tpm.df$gene
tpm.df <- subset(tpm.df, select = -c(gene_id, ID_REF, gene) )
tpm.df <- tpm.df[ order(row.names(tpm.df)), , drop = FALSE]
tpm.df
```
Plot the results.
```{r, fig.height=30, fig.width=10}
tpm.matrix <- as.matrix(tpm.df)
heatmap.2(tpm.matrix, srtCol=360, cellnote = tpm.matrix, dendrogram="none", Colv=FALSE, Rowv=FALSE,
col=brewer.pal(n = 9, name = "BuPu")[5:9], trace="none", key = FALSE, lwid=c(0.1,4), lhei=c(0.1,4),
cexCol=1, cexRow=0.75, symm = TRUE)
```
### Ferroptosis
Load the gene set.
```{r}
genes <- read.csv(paste0(RCDdb, "Ferroptosis.csv"))
genes$gene_id <- cleanid(genes$gene_id)
genes <- distinct(genes, gene_id, .keep_all = TRUE)
genes <- subset(genes, gene_id != "")
genes
```
Get the normalized expression data for the genes in the gene set.
```{r}
tpm.df <- hdfn.expression %>% dplyr::filter(gene_id %in% genes$gene_id)
tpm.df <- left_join(tpm.df, genes %>% dplyr::select(gene_id, gene), by = c("gene_id" = "gene_id"))
tpm.df <- distinct(tpm.df, gene, .keep_all = TRUE)
rownames(tpm.df) <- tpm.df$gene
tpm.df <- subset(tpm.df, select = -c(gene_id, ID_REF, gene) )
tpm.df <- tpm.df[ order(row.names(tpm.df)), , drop = FALSE]
tpm.df
```
Plot the results.
```{r, fig.height=150, fig.width=10}
tpm.matrix <- as.matrix(tpm.df)
heatmap.2(tpm.matrix, srtCol=360, cellnote = tpm.matrix, dendrogram="none", Colv=FALSE, Rowv=FALSE,
col=brewer.pal(n = 9, name = "BuPu")[5:9], trace="none", key = FALSE, lwid=c(0.1,4), lhei=c(0.1,4),
cexCol=1, cexRow=0.75, symm = TRUE)
```
### Pyroptosis
Load the gene set.
```{r}
genes <- read.csv(paste0(RCDdb, "Pyroptosis.csv"))
genes$gene_id <- cleanid(genes$gene_id)
genes <- distinct(genes, gene_id, .keep_all = TRUE)
genes <- subset(genes, gene_id != "")
genes
```
Get the normalized expression data for the genes in the gene set.
```{r}
tpm.df <- hdfn.expression %>% dplyr::filter(gene_id %in% genes$gene_id)
tpm.df <- left_join(tpm.df, genes %>% dplyr::select(gene_id, gene), by = c("gene_id" = "gene_id"))
tpm.df <- distinct(tpm.df, gene, .keep_all = TRUE)
rownames(tpm.df) <- tpm.df$gene
tpm.df <- subset(tpm.df, select = -c(gene_id, ID_REF, gene) )
tpm.df <- tpm.df[ order(row.names(tpm.df)), , drop = FALSE]
tpm.df
```
Plot the results.
```{r, fig.height=20, fig.width=10}
tpm.matrix <- as.matrix(tpm.df)
heatmap.2(tpm.matrix, srtCol=360, cellnote = tpm.matrix, dendrogram="none", Colv=FALSE, Rowv=FALSE,
col=brewer.pal(n = 9, name = "BuPu")[5:9], trace="none", key = FALSE, lwid=c(0.1,4), lhei=c(0.1,4),
cexCol=1, cexRow=0.75, symm = TRUE)
```