title: ReactomePA试用 tags: [] id: '2001' categories:
library(stringr)
library(org.Hs.eg.db)
DEG <- subset(readRDS('DEG.rds'), !grepl('pseudogene', gene_type) & baseMean > quantile(baseMean)['25%'] & padj < 0.05)
rownames(DEG) <- t(as.data.frame(str_split(DEG$gene_id, '\\.')))[,1]
allEntrez = clusterProfiler::bitr(rownames(DEG), fromType="ENSEMBL", toType="ENTREZID", OrgDb=org.Hs.eg.db)
DEG$ENSEMBL <- rownames(DEG)
lfc <- merge(data.frame(DEG), allEntrez, by="ENSEMBL")
lfc <- lfc[order(lfc$log2FoldChange, decreasing=TRUE),]
geneList <- lfc$log2FoldChange
names(geneList) <- lfc$ENTREZID
x <- readRDS('DEG_filer.rds')
rownames(x) <- t(as.data.frame(str_split(x$gene_id, '\\.')))[,1]
cand.entrez = clusterProfiler::bitr(rownames(x), fromType="ENSEMBL", toType="ENTREZID", OrgDb=org.Hs.eg.db)$ENTREZID
set.seed(123)
pway = ReactomePA::enrichPathway(gene = cand.entrez)
pway = clusterProfiler::setReadable(pway, OrgDb=org.Hs.eg.db)
pway = enrichplot::pairwise_termsim(pway)
pway@result
set.seed(123)
pwayGSE <- ReactomePA::gsePathway(geneList, eps = 0)
pwayGSE = clusterProfiler::setReadable(pwayGSE, OrgDb=org.Hs.eg.db)
pwayGSE = enrichplot::pairwise_termsim(pwayGSE)
pwayGSE@result