Skip to content

大佬怎样富集分析自定义的基因集 #143

@wyj20031116

Description

@wyj20031116

library(dplyr)
library(clusterProfiler)
library(org.Hs.eg.db)
gmt <- read.gmt('../resource/h.all.v2024.1.Hs.symbols.gmt')

转换为ENSEMBL

gmt_ensembl <- gmt %>%

首先为每个基因获取Ensembl ID映射

left_join(
bitr(.$gene, fromType = "SYMBOL", toType = "ENSEMBL", OrgDb = org.Hs.eg.db),
by = c("gene" = "SYMBOL")
) %>%

移除原来的gene符号列,保留Ensembl ID

dplyr::select(term, gene = ENSEMBL) %>%

移除未能映射的基因

filter(!is.na(gene)) %>%

去重

distinct()

enrich <- enrichCluster(object = df,
OrgDb = "org.Hs.eg.db",
type = "ownSet", # c("BP", "MF", "CC", "KEGG", "ownSet")
TERM2GENE = gmt_ensembl,
organism = "hsa",
pvalueCutoff = 0.05,
topn = 5,
seed = 123)
我想要富集Hallmark通路,但是不管是Symbol还是ENSEMBL,都是'select()' returned 1:1 mapping between keys and columns
--> No gene can be mapped....
--> Expected input gene ID: ENSG00000145839,ENSG00000273506,ENSG00000100075,ENSG00000112493,ENSG00000289755,ENSG00000153094
--> return NULL...
'select()' returned 1:1 mapping between keys and columns
--> No gene can be mapped....
--> Expected input gene ID: ENSG00000145839,ENSG00000273506,ENSG00000100075,ENSG00000112493,ENSG00000289755,ENSG00000153094
--> return NULL...
'select()' returned 1:1 mapping between keys and columns
--> No gene can be mapped....
--> Expected input gene ID: ENSG00000145839,ENSG00000273506,ENSG00000100075,ENSG00000112493,ENSG00000289755,ENSG00000153094
--> return NULL...
'select()' returned 1:1 mapping between keys and columns
--> No gene can be mapped....
--> Expected input gene ID: ENSG00000145839,ENSG00000273506,ENSG00000100075,ENSG00000112493,ENSG00000289755,ENSG00000153094
--> return NULL...'select()' returned 1:1 mapping between keys and columns
--> No gene can be mapped....
--> Expected input gene ID: CCND1,PTPN21,SPARCL1,ACTA1,UQCR10,PEX11A
--> return NULL...
'select()' returned 1:1 mapping between keys and columns
--> No gene can be mapped....
--> Expected input gene ID: CCND1,PTPN21,SPARCL1,ACTA1,UQCR10,PEX11A
--> return NULL...
'select()' returned 1:1 mapping between keys and columns
--> No gene can be mapped....
--> Expected input gene ID: CCND1,PTPN21,SPARCL1,ACTA1,UQCR10,PEX11A
--> return NULL...
'select()' returned 1:1 mapping between keys and columns
--> No gene can be mapped....
--> Expected input gene ID: CCND1,PTPN21,SPARCL1,ACTA1,UQCR10,PEX11A
--> return NULL...是哪个地方设置的有问题吗,该怎样修正代码

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions