-
Notifications
You must be signed in to change notification settings - Fork 0
/
9. Gene Expression Analysis - HDFn - GSE32581.Rmd
186 lines (149 loc) · 5.45 KB
/
9. Gene Expression Analysis - HDFn - GSE32581.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) | GSE32581 | Necroptosis, Ferroptosis & Pyroptosis"
author:
- Mark Edward M. Gonzales^[De La Salle University, Manila, Philippines, [email protected]]
- Dr. Anish M.S. Shrestha^[De La Salle University, Manila, Philippines, [email protected]]
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=GSE32581
Download the RNA-seq normalized counts matrix from https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?view=data&acc=GSM807459&id=28440&db=GeoDb_blob67
```{r}
hdfn.expression <- read.delim(paste0(DATA_DIR, "GSE32581-hdfn.tsv"), as.is = TRUE, header = TRUE, row.names = 1)
hdfn.expression <- rownames_to_column(hdfn.expression, "ID_REF")
hdfn.expression <- hdfn.expression[c("ID_REF", "VALUE")]
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.
**NOTE: `VALUE` and `VALUE1` are the same. This is just a workaround since R's `heatmap.2` requires the heatmap to have at least two columns.**
```{r, fig.height=30, fig.width=10}
tpm.df[["VALUE1"]] <- tpm.df[["VALUE"]]
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.
**NOTE: `VALUE` and `VALUE1` are the same. This is just a workaround since R's `heatmap.2` requires the heatmap to have at least two columns.**
```{r, fig.height=150, fig.width=10}
tpm.df[["VALUE1"]] <- tpm.df[["VALUE"]]
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.
**NOTE: `VALUE` and `VALUE1` are the same. This is just a workaround since R's `heatmap.2` requires the heatmap to have at least two columns.**
```{r, fig.height=20, fig.width=10}
tpm.df[["VALUE1"]] <- tpm.df[["VALUE"]]
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
)
```