Commit 82678dd6 authored by Stefano Beretta's avatar Stefano Beretta
Browse files

Upload New File

parent d4807adc
library(clusterProfiler)
library(ggplot2)
library(dplyr)
library(gtools)
library(RColorBrewer)
# Working Directory
wdir <- "~/conti_ge_2025_RNAseq"
# Results 24h: paired_stranded24h
wdir24 <- "paired_stranded24h"
contr24 <- "GE_24h-RNP_NEG_24h"
sen24 <- paste(wdir, wdir24, paste0(contr24, "-gsea-senescence_signatures.txt"), sep = "/")
sen24_res <- read.table(sen24, sep = "\t", header = T)
sasp24 <- paste(wdir, wdir24, paste0(contr24, "-gsea-sasp.txt"), sep = "/")
sasp24_res <- read.table(sasp24, sep = "\t", header = T)
sen24_res <- rbind(sen24_res, sasp24_res)
sen24_terms <- c("SenMayo", "Purcell", "Pribluda_SENESCENCE_INFLAMMATORY_GENES", "Sencan", "SASP_SCHLEICH")
sen24_res <- subset(sen24_res, ID %in% sen24_terms)
sen24_res$List <- "Senescence"
hmark24 <- paste(wdir, wdir24, paste0(contr24, "-gsea-h.all.v7.2.symbols.txt"), sep = "/")
hmark24_res <- read.table(hmark24, sep = "\t", header = T)
hmark24_res$List <- "Hallmark"
res24 <- as.data.frame(rbind(sen24_res, hmark24_res) %>% select(ID, NES, pvalue, p.adjust, List))
res24$Time <- "Day 1"
res24$Contr <- contr24
head(res24)
# Results 96h: unstrand_96h
wdir96 <- "unstrand_96h"
contr96 <- "GE_96h-RNP_NEG_96h"
sen96 <- paste(wdir, wdir96, paste0(contr96, "-gsea-senescence_signatures.txt"), sep = "/")
sen96_res <- read.table(sen96, sep = "\t", header = T)
sasp96 <- paste(wdir, wdir96, paste0(contr96, "-gsea-sasp.txt"), sep = "/")
sasp96_res <- read.table(sasp96, sep = "\t", header = T)
sen96_res <- rbind(sen96_res, sasp96_res)
sen96_terms <- c("SenMayo", "Purcell", "Pribluda_SENESCENCE_INFLAMMATORY_GENES", "Sencan", "SASP_SCHLEICH")
sen96_res <- subset(sen96_res, ID %in% sen96_terms)
sen96_res$List <- "Senescence"
hmark96 <- paste(wdir, wdir96, paste0(contr96, "-gsea-h.all.v7.2.symbols.txt"), sep = "/")
hmark96_res <- read.table(hmark96, sep = "\t", header = T)
hmark96_res$List <- "Hallmark"
res96 <- as.data.frame(rbind(sen96_res, hmark96_res) %>% select(ID, NES, pvalue, p.adjust, List))
res96$Time <- "Day 4"
res96$Contr <- contr96
res <- rbind(res24, res96)
res$ID <- gsub("HALLMARK_", "", res$ID)
sel_terms <- res %>% filter(p.adjust < 0.05 | List == "Senescence") %>% select(ID) %>% unique()
res <- subset(res, ID %in% sel_terms$ID)
ord_terms <- res %>% group_by(ID) %>% summarise(NES = mean(NES)) %>% arrange(NES)
res$ID <- factor(res$ID, levels = ord_terms$ID)
res$Sig <- stars.pval(p.value = res$pvalue)
p <- ggplot(data = res, mapping = aes(x = Time, y = ID, fill = NES, label = Sig)) +
theme_bw(base_size = 14) +
theme(panel.spacing = unit(0, "lines"),
plot.title = element_text(hjust=0, vjust = -1.5),
panel.border = element_rect(color = "white"),
strip.background.y = element_rect(fill= "white", color = "white"),
strip.text.x = element_text(size = 14),
strip.text.y = element_blank(),
axis.text.x = element_blank(),
axis.ticks.x = element_blank(),
strip.background.x = element_rect(fill= "white", color = "white")) +
geom_tile(color = "white", lwd = .5, linetype = 1, width = 1.2) +
ylab("") +
xlab("") +
ggtitle("HS/AAV6 vs. Ctrl") +
scale_fill_gradient2(low = "darkblue", high = "darkred", mid = "grey") +
geom_text(size = 5, color = "white") +
facet_grid(List~Time, scales = "free", space = "free_y", switch="x")
ggsave(filename = paste(wdir, "HM_GEvsRNPNEG_SenHallmark.png", sep = "/"),
plot = p, width = 7, height = 6)
#########################################################
# GSEA 2
hallmark_terms <- c("KRAS_SIGNALING_UP","ESTROGEN_RESPONSE_LATE","MYOGENESIS","EPITHELIAL_MESENCHYMAL_TRANSITION","ANGIOGENESIS",
"COAGULATION","HEDGEHOG_SIGNALING","IL6_JAK_STAT3_SIGNALING","TNFA_SIGNALING_VIA_NFKB","IL2_STAT5_SIGNALING",
"INTERFERON_ALPHA_RESPONSE","INTERFERON_GAMMA_RESPONSE","MYC_TARGETS_V2","MITOTIC_SPINDLE","DNA_REPAIR",
"UNFOLDED_PROTEIN_RESPONSE","G2M_CHECKPOINT","E2F_TARGETS","MTORC1_SIGNALING","MYC_TARGETS_V1","APICAL_JUNCTION",
"UV_RESPONSE_UP","APOPTOSIS","REACTIVE_OXYGEN_SPECIES_PATHWAY","ESTROGEN_RESPONSE_EARLY","P53_PATHWAY",
"ALLOGRAFT_REJECTION","XENOBIOTIC_METABOLISM","PROTEIN_SECRETION","OXIDATIVE_PHOSPHORYLATION","HEME_METABOLISM",
"UV_RESPONSE_DN","INFLAMMATORY_RESPONSE","COMPLEMENT","BILE_ACID_METABOLISM","KRAS_SIGNALING_DN")
# Results 24h: paired_stranded24h
wdir24 <- "paired_stranded24h"
contr24 <- "GE_ANAK_24h-GE_24h"
hallm24_file <- paste(wdir, wdir24, paste0(contr24, "-gsea-h.all.v7.2.symbols.txt"), sep = "/")
hallm24 <- read.table(hallm24_file, sep = "\t", header = T)
hallm24$ID <- gsub("HALLMARK_", "", hallm24$ID)
hallm24 <- subset(hallm24, ID %in% hallmark_terms)
hallm24$List <- "Hallmark"
head(hallm24)
res24 <- hallm24 %>% select(ID, NES, pvalue, p.adjust, List)
rownames(res24) <- seq(1, nrow(res24))
res24$Time <- "Day 1"
# Results 96h: unstrand_96h
wdir96 <- "unstrand_96h"
contr96 <- "GE_ANAK_96h-GE_96h"
hallm96_file <- paste(wdir, wdir96, paste0(contr96, "-gsea-h.all.v7.2.symbols.txt"), sep = "/")
hallm96 <- read.table(hallm96_file, sep = "\t", header = T)
hallm96$ID <- gsub("HALLMARK_", "", hallm96$ID)
hallm96 <- subset(hallm96, ID %in% hallmark_terms)
hallm96$List <- "Hallmark"
head(hallm96)
res96 <- hallm96 %>% select(ID, NES, pvalue, p.adjust, List)
rownames(res96) <- seq(1, nrow(res96))
res96$Time <- "Day 4"
res <- rbind(res24, res96)
ord_terms <- res %>% group_by(ID) %>% summarise(NES = mean(NES)) %>% arrange(desc(NES))
res$ID <- factor(res$ID, levels = ord_terms$ID)
p <- ggplot(data = res, mapping = aes(x = ID, y = Time, fill = NES)) +
theme_bw(base_size = 14) +
theme(plot.title = element_text(hjust=.5),
panel.border = element_rect(color = "white"),
panel.grid = element_line(color = "white"),
axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5),
strip.background.y = element_rect(fill= "white", color = "white"),
strip.text = element_blank(),
strip.background.x = element_rect(fill= "white", color = "white")) +
geom_tile(color = "white") +
ylab("") +
xlab("") +
ggtitle("HS/AAV6+ANAK vs. HS/AAV6") +
scale_fill_gradient2(low = "darkblue", high = "darkred", mid = "white", limits = c(-1.6,1.6)) +
scale_y_discrete(position = "right") +
facet_grid(.~List, scales = "free_x", space = "free_x")
ggsave(filename = paste(wdir, "HM_GEANAKvsGE_Hallmark.png", sep = "/"),
plot = p, width = 12, height = 6)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment