SingleCell RNA-seq data로 GSEA하는법
FindMarker()로 DEG구한후에 어떤 function을 갖고 Gene set enrichment가 있는지 확인해보자
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
library(clusterProfiler)
library(AnnotationDbi)
library(org.Hs.eg.db)
library(fgsea)
library(presto)
library(tibble)
detable <- read.table(paste0("AnnotL2.",i,".",j,".deg_sig_noRibo.txt"), sep='\t')
gene_list <- detable$avg_log2FC
names(gene_list) <- rownames(detable)
gene_list_sorted <- sort(gene_list, decreasing = TRUE)
GOresults <- gseGO(gene_list_sorted, OrgDb="org.Hs.eg.db",keyType="SYMBOL",ont="BP")
hallmark_path <- system.file("extdata", "h.all.v2023.2.Hs.symbols.gmt", package = "clusterProfiler")
entrez_ids <- bitr(names(gene_list_sorted), fromType = "SYMBOL", toType = "ENTREZID", OrgDb = org.Hs.eg.db)
gene_list_sorted_mapped <- gene_list_sorted[entrez_ids$SYMBOL]
names(gene_list_sorted_mapped) <- entrez_ids$ENTREZID
KEGGresults <- gseKEGG(geneList = gene_list_sorted_mapped,organism = "hsa")
This post is licensed under CC BY 4.0 by the author.