# Nacteni dat load("ER_vysledky.rdata") load("GSE20194_MDACC_Expression.rdata") clinical<-read.csv("GSE20194_MDACC_Sample_Info.csv", header=T) # kontrola head(ER_vysledky) head(X) head(clinical) #načtení balíku fgsea library(fgsea) #načtení balíku pro správu msigdb genových sad library(msigdbr) #více info https://cran.r-project.org/web/packages/msigdbr/vignettes/msigdbr-intro.html #vybereme napr. hallmark pathways h_gene_sets = msigdbr(species = "human", category = "H") #pripravime k analyze h_list_GS = split(x = h_gene_sets$gene_symbol, f = h_gene_sets$gs_name) # připravíme data pro analýzu - seřadíme dle statistiky v<-ER_vysledky$Tstat names(v)<-ER_vysledky$Gen #otestujeme hallmark pathways fgseaRes <- fgseaSimple(h_list_GS, v, nperm=10000, maxSize=500) fgseaRes$Enrichment = ifelse(fgseaRes$NES > 0 & fgseaRes$padj<0.1, "Up-regulated", ifelse(fgseaRes$NES < 0 & fgseaRes$padj<0.1, "Down-regulated","Not significant")) View(fgseaRes) #vizualizujeme library(ggplot2) filtRes=fgseaRes[which(fgseaRes$Enrichment!="Not significant"),] total_up = sum(fgseaRes$Enrichment == "Up-regulated") total_down = sum(fgseaRes$Enrichment == "Down-regulated") header = paste0("Significant pathways (Up=", total_up,", Down=", total_down, ")") colos = setNames(c("firebrick2", "dodgerblue2"), c("Up-regulated", "Down-regulated")) g1= ggplot(filtRes, aes(reorder(pathway, NES), NES)) + geom_point( aes(fill = Enrichment, size = size), shape=21) + scale_fill_manual(values = colos ) + scale_size_continuous(range = c(2,10)) + geom_hline(yintercept = 0) + coord_flip() + labs(x="Pathway", y="Normalized Enrichment Score", title=header) #+ th #??? g1