-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDissertation_KG_Chapter_1.2.Rmd
214 lines (186 loc) · 6.98 KB
/
Dissertation_KG_Chapter_1.2.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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
---
title: "Role of Piwi-piRNA pathway in somatic and cancer cells"
author: "__Konstantinos Geles__"
date: "Thu Jun 30 2022, Last Update: `r format(Sys.Date(), '%a %b %d %Y')`"
output:
html_document:
toc: yes
toc_depth: 3
df_print: paged
pdf_document:
toc: yes
toc_depth: 3
html_notebook: null
editor_options:
chunk_output_type: console
subtitle: UMG PhD Programme of Molecular and Translational Oncology - Circle XXXIV
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, eval = FALSE)
```
This project contains the scripting part of the Doctoral Dissertation of **Konstantinos Geles** with doi:
# CHAPTER 1: Role of the PIWI-piRNA pathway in Colorectal Cancer (CRC)
## 1.2 Evaluation of piRNA expression in CRC cell lines and comparison to germline
Import Libraries
```{r}
#library(readxl)
library(vroom)
library(dplyr)
library(stringr)
library(purrr)
library(tidyr)
library(ggplot2)
library(scales)
```
### PIWIL genes RNA expression in CRC lines and Testis
After getting the gene quantification with featurecounts we import the data for visualization
```{r}
bulk_RNA_CRC <- vroom::vroom("Chapter_1_2/CRC_cell_lines_RNA_seq_CPM_04_Jul_2022.txt")
```
format the table
```{r}
PIWIL_RNA_CRC <- bulk_RNA_CRC %>%
filter(str_detect(gene_name , "PIWI")) %>%
select(-c(transcript, Chr:gene_type)) %>%
pivot_longer(cols = -gene_name, names_to = "Sample", values_to = "CPM") %>%
mutate(Sample = str_remove_all(Sample, "Pool_|_.+|EMPTY.+"))
```
PhD theme for plots
```{r}
wes_cols <- c(wesanderson::wes_palettes$Rushmore[2:3],
wesanderson::wes_palettes$Darjeeling1[4],
wesanderson::wes_palettes$BottleRocket1[1])
PhD_theme <-
list(
scale_fill_manual(values = wes_cols),
scale_color_manual(values = wes_cols),
theme_bw() +
theme(
panel.border = element_blank(),
strip.background = element_blank(),
strip.text = element_text(size = 20, colour = "black"),
axis.line = element_line(),
panel.grid.major = element_line(size = 0.2),
panel.grid.minor = element_line(size = 0.1),
text = element_text(size = 20),
axis.title.x = element_text(margin = margin(t = 10, r = 10, b = 10, l = 10),
colour = "black"),
axis.title.y = element_text(margin = margin(t = 10, r = 10, b = 10, l = 10),
colour = "black"),
axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1, size = 20),
axis.text.y = element_text(size = 20, colour = "black"),
plot.title = element_text(hjust = 0.5, colour = "black")
)
)
```
plot the PIWIL expressions
```{r}
p_PIWIL <- PIWIL_RNA_CRC %>%
rename("Cell line"= Sample) %>%
ggplot() +
geom_col(mapping = aes(x = `Cell line`, y = CPM, fill = `Cell line`),
position = "dodge") +
facet_wrap(facets = "gene_name", ncol = 2) +
ylab("Counts pem Million (CPM)") +
ggtitle("PIWIL genes expression in CRC cell-lines and testis samples") +
PhD_theme
tiff(filename = file.path("FIG_13_PIWIL_genes_Cell_lines_Testis.tiff"),
compression = "none", height = 10, width = 14, units = 'in', res = 600)
p_PIWIL
dev.off()
```
### sncRNA concetrations in CRC cell lines and testis samples
After running the SPORTS workflow I import the length_distribution txt
```{r}
sncRNA_CRC_cells <- list.files("Chapter_1_2/",full.names = TRUE) %>%
purrr::set_names(nm = ~basename(.x) %>%
str_remove_all("Human_|_Non_Treated|_length_distribution.txt")) %>%
purrr::map(vroom::vroom) %>%
bind_rows(.id = "Sample")
```
format the table
```{r}
sncRNA_CRC_cells_MG <- sncRNA_CRC_cells %>%
filter(!str_detect(Class, c("Unmatch|Clean"))) %>%
filter(Class != "Match_Genome") %>%
mutate(Class = str_remove(Class, "_Match_Genome")) %>%
separate(col = Class, into = c("DB", "Class"), sep = "-", extra = "merge") %>%
mutate(Class = ifelse(is.na(Class), "Unannotated", Class))
sncRNA_CRC_cells_MG_sum <- sncRNA_CRC_cells %>%
filter(Class == "Match_Genome")
```
check results
```{r}
MG_SUM <- sncRNA_CRC_cells_MG_sum %>%
group_by( Sample) %>%
summarise(sss=sum(Reads)) %>%
mutate(sss = as.integer(sss))
sncMG_SUM <- sncRNA_CRC_cells_MG %>%
filter( Class != "tRNA_5_end", !(Class =="rRNA" & DB == "rRNAdb")) %>% group_by( Sample) %>% summarise(sss=sum(Reads)) %>%
mutate(sss = as.integer(round(sss)))
identical(MG_SUM, sncMG_SUM)
stopifnot(identical(MG_SUM, sncMG_SUM))
```
PhD theme for plots
```{r}
PhD_theme <-
list(
scale_fill_brewer(palette = "Set1"),
theme_bw() +
theme(
panel.border = element_blank(),
strip.background = element_blank(),
strip.text = element_text(size = 20, colour = "black"),
axis.line = element_line(),
panel.grid.major = element_line(size = 0.2),
panel.grid.minor = element_line(size = 0.1),
text = element_text(size = 20),
axis.title.x = element_text(margin = margin(t = 10, r = 10, b = 10, l = 10),
colour = "black"),
axis.title.y = element_text(margin = margin(t = 10, r = 10, b = 10, l = 10),
colour = "black"),
axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1, size = 20),
axis.text.y = element_text(size = 20, colour = "black"),
plot.title = element_text(hjust = 0.5, colour = "black")
)
)
```
make the summary plot for all DBs
```{r}
p_sncRNA_MG <- sncRNA_CRC_cells_MG %>%
filter( Class != "tRNA_5_end", DB != "rRNAdb") %>%
group_by( Sample, DB) %>%
summarise(C_reads = sum(Reads)) %>%
rename("Cell line"= Sample, Database = DB) %>%
ggplot() +
geom_col(mapping = aes(x = `Cell line`, y = C_reads, fill = Database),
position = "fill") +
ylab("Mapped Reads") +
ggtitle("Percentage of mapped reads to each sncRNA database \nfor the CRC cell-lines and testis samples") +
scale_y_continuous(labels = scales::percent) +
PhD_theme
tiff(filename = file.path("FIG_14_sncRNA_DBs_CRC_lines_Testis.tiff"),
compression = "none", height = 10, width = 14, units = 'in', res = 600)
p_sncRNA_MG
dev.off()
```
make a read length plot
```{r}
p_sncRNA_MG_rl <- sncRNA_CRC_cells_MG %>%
filter( Class != "tRNA_5_end", DB != "rRNAdb") %>%
rename(Database = DB) %>%
ggplot() +
geom_col(mapping = aes(x = Length, y = Reads, fill = Database),
position = "fill") +
facet_wrap(facets = "Sample", ncol = 2) +
scale_y_continuous(labels = scales::percent) +
scale_x_continuous(breaks = extended_breaks(n = 9)) +
ylab("Mapped Reads") +
xlab("Read Length") +
ggtitle("Percentage of mapped reads to each sncRNA database \n respect to read length, for the CRC cell-lines and testis samples") +
PhD_theme
tiff(filename = file.path("FIG_15_sncRNA_DBs_read_length_CRC_lines_Testis.tiff"),
compression = "none", height = 10, width = 14, units = 'in', res = 600)
p_sncRNA_MG_rl
dev.off()
```