GO和KEGG富集结果如何显示基因symbol

前面在讲GO和KEGG富集倍数(Fold Enrichment)如何计算时,给大家简单介绍过GO富集分析结果如何看。

ONTOLOGY:区分是BP,MF还是CC
ID:具体的GO条目的ID号
Description:GO条目的描述
GeneRatio:这里是一个分数,分子是富集到这个GO条目上的gene的数目,
            分母是所有输入的做富集分析的gene的数目,可以是差异表达
            分析得到的gene
BgRatio:Background Ratio. 这里也是一个分数,分母是人的所有编码蛋白的
        基因中有GO注释的gene的数目,这里是19623个,分子是这19623个
        gene中注释到这个GO条目上面的gene的数目
pvalue:富集的p值
p.adjust:校正之后的p值
qvalue:q值
geneID:输入的做富集分析的gene中富集到这个GO条目上面的具体的
        gene名字
Count:输入的做富集分析的gene中富集到这个GO条目上面的gene的数目

有时候我们得到的富集结果中geneID这一列显示的是基因的名字(symbol),有时候显示的是一串数字(Entrez gene ID)或者是ensembl gene ID。其实我们最希望看到的是显示基因的名字(symbol),因为只有这样你才能一眼就看出是什么基因富集到这个GO条目或者是KEGG通路上,其他的ID号,都不太直观。那么我们如何能保证富集结果中就显示gene symbol呢?
今天给大家介绍三种不同的方法,来达到同样的效果假设我们这里差异表达分析得到了1000个差异表达的基因(DEG),基因的ID号是ensembl gene ID。

load("DEG.rds")
ls()
library(org.Hs.eg.db)
library(clusterProfiler)
ego <- enrichGO(gene = DEG,
                OrgDb=org.Hs.eg.db,
                ont = "all",
                pAdjustMethod = "BH",
                minGSSize = 10,
                pvalueCutoff = 0.01,
                qvalueCutoff = 0.01,
                keyType='ENSEMBL')

富集得到的结果如下,geneID为ensembl gene ID

>ego
# over-representation test
#
#...@organism    Homo sapiens 
#...@ontology    GOALL 
#...@keytype    ENSEMBL 
#...@gene    chr [1:1000] "ENSG00000259250" "ENSG00000255717" ...
#...pvalues adjusted by 'BH' with cutoff <0.01 
#...81 enriched terms found
'data.frame':  81 obs. of  10 variables:
 $ ONTOLOGY   : Factor w/ 3 levels "BP","CC","MF": 1 1 1 1 1 1 1 1 1 1 ...
 $ ID         : chr  "GO:0016054" "GO:0046395" "GO:0044282" "GO:0009063" ...
 $ Description: chr  "organic acid catabolic process" "carboxylic acid catabolic process" "small molecule catabolic process" "cellular amino acid catabolic process" ...
 $ GeneRatio  : chr  "50/832" "50/832" "63/832" "30/832" ...
 $ BgRatio    : chr  "300/20610" "300/20610" "476/20610" "140/20610" ...
 $ pvalue     : num  1.06e-17 1.06e-17 8.27e-17 4.25e-14 1.33e-11 ...
 $ p.adjust   : num  2.69e-14 2.69e-14 1.39e-13 5.38e-11 1.34e-08 ...
 $ qvalue     : num  2.51e-14 2.51e-14 1.30e-13 5.01e-11 1.25e-08 ...
 $ geneID     : chr  "ENSG00000198650/ENSG00000248098/ENSG00000078070/ENSG00000169738/ENSG00000113492/ENSG00000113790/ENSG00000111271"| __truncated__ "ENSG00000198650/ENSG00000248098/ENSG00000078070/ENSG00000169738/ENSG00000113492/ENSG00000113790/ENSG00000111271"| __truncated__ "ENSG00000198650/ENSG00000248098/ENSG00000171903/ENSG00000173597/ENSG00000078070/ENSG00000169738/ENSG00000113492"| __truncated__ "ENSG00000198650/ENSG00000248098/ENSG00000078070/ENSG00000113492/ENSG00000008311/ENSG00000139631/ENSG00000140905"| __truncated__ ...
 $ Count      : int  50 50 63 30 50 35 24 22 27 43 ...
#...Citation
  Guangchuang Yu, Li-Gen Wang, Yanyan Han and Qing-Yu He.
  clusterProfiler: an R package for comparing biological themes among
  gene clusters. OMICS: A Journal of Integrative Biology
  2012, 16(5):284-287  

方法一、使用readable = TRUE参数

ego1 <- enrichGO(gene = DEG,
                 OrgDb=org.Hs.eg.db,
                 ont = "all",
                 pAdjustMethod = "BH",
                 minGSSize = 10,
                 pvalueCutoff = 0.01,
                 qvalueCutoff = 0.01,
                 keyType='ENSEMBL',
                 readable = TRUE)

这时候得到的结果你会发现已经转换成了gene symbol

>ego1
# over-representation test
#
#...@organism    Homo sapiens 
#...@ontology    GOALL 
#...@keytype    ENSEMBL 
#...@gene    chr [1:1000] "ENSG00000259250" "ENSG00000255717" ...
#...pvalues adjusted by 'BH' with cutoff <0.01 
#...81 enriched terms found
'data.frame':  81 obs. of  10 variables:
 $ ONTOLOGY   : Factor w/ 3 levels "BP","CC","MF": 1 1 1 1 1 1 1 1 1 1 ...
 $ ID         : chr  "GO:0016054" "GO:0046395" "GO:0044282" "GO:0009063" ...
 $ Description: chr  "organic acid catabolic process" "carboxylic acid catabolic process" "small molecule catabolic process" "cellular amino acid catabolic process" ...
 $ GeneRatio  : chr  "50/832" "50/832" "63/832" "30/832" ...
 $ BgRatio    : chr  "300/20610" "300/20610" "476/20610" "140/20610" ...
 $ pvalue     : num  1.06e-17 1.06e-17 8.27e-17 4.25e-14 1.33e-11 ...
 $ p.adjust   : num  2.69e-14 2.69e-14 1.39e-13 5.38e-11 1.34e-08 ...
 $ qvalue     : num  2.51e-14 2.51e-14 1.30e-13 5.01e-11 1.25e-08 ...
 $ geneID     : chr  "TAT/BCKDHA/MCCC1/DCXR/AGXT2/EHHADH/ACAD10/ACADS/ACOX1/AASS/PCCB/CSAD/GCSH/AFMID/GPT/ABAT/MLYCD/ABHD10/PRODH2/DD"| __truncated__ "TAT/BCKDHA/MCCC1/DCXR/AGXT2/EHHADH/ACAD10/ACADS/ACOX1/AASS/PCCB/CSAD/GCSH/AFMID/GPT/ABAT/MLYCD/ABHD10/PRODH2/DD"| __truncated__ "TAT/BCKDHA/CYP4F11/SULT1B1/MCCC1/DCXR/AGXT2/PGM2L1/DPYD/DERA/EHHADH/ACAD10/ACADS/ACOX1/AASS/PCCB/CSAD/GCSH/AFMI"| __truncated__ "TAT/BCKDHA/MCCC1/AGXT2/AASS/CSAD/GCSH/AFMID/GPT/ABAT/PRODH2/DDAH1/ARG1/ACMSD/BCKDK/SHMT1/HGD/CDO1/DBT/GSTZ1/HSD"| __truncated__ ...
 $ Count      : int  50 50 63 30 50 35 24 22 27 43 ...
#...Citation
  Guangchuang Yu, Li-Gen Wang, Yanyan Han and Qing-Yu He.
  clusterProfiler: an R package for comparing biological themes among
  gene clusters. OMICS: A Journal of Integrative Biology
  2012, 16(5):284-287 
​

方法二、使用setReadable函数

library(DOSE)
#如果原始的ID号为entrez gene id那么这里keyType设置为ENTREZID
ego2<-setReadable(ego, OrgDb = org.Hs.eg.db, keyType="ENSEMBL")

转换之后的结果为

>ego2
# over-representation test
#
#...@organism    Homo sapiens 
#...@ontology    GOALL 
#...@keytype    ENSEMBL 
#...@gene    chr [1:1000] "ENSG00000259250" "ENSG00000255717" "ENSG00000163328" ...
#...pvalues adjusted by 'BH' with cutoff <0.01 
#...81 enriched terms found
'data.frame':  81 obs. of  10 variables:
 $ ONTOLOGY   : Factor w/ 3 levels "BP","CC","MF": 1 1 1 1 1 1 1 1 1 1 ...
 $ ID         : chr  "GO:0016054" "GO:0046395" "GO:0044282" "GO:0009063" ...
 $ Description: chr  "organic acid catabolic process" "carboxylic acid catabolic process" "small molecule catabolic process" "cellular amino acid catabolic process" ...
 $ GeneRatio  : chr  "50/832" "50/832" "63/832" "30/832" ...
 $ BgRatio    : chr  "300/20610" "300/20610" "476/20610" "140/20610" ...
 $ pvalue     : num  1.06e-17 1.06e-17 8.27e-17 4.25e-14 1.33e-11 ...
 $ p.adjust   : num  2.69e-14 2.69e-14 1.39e-13 5.38e-11 1.34e-08 ...
 $ qvalue     : num  2.51e-14 2.51e-14 1.30e-13 5.01e-11 1.25e-08 ...
 $ geneID     : chr  "TAT/BCKDHA/MCCC1/DCXR/AGXT2/EHHADH/ACAD10/ACADS/ACOX1/AASS/PCCB/CSAD/GCSH/AFMID/GPT/ABAT/MLYCD/ABHD10/PRODH2/DD"| __truncated__ "TAT/BCKDHA/MCCC1/DCXR/AGXT2/EHHADH/ACAD10/ACADS/ACOX1/AASS/PCCB/CSAD/GCSH/AFMID/GPT/ABAT/MLYCD/ABHD10/PRODH2/DD"| __truncated__ "TAT/BCKDHA/CYP4F11/SULT1B1/MCCC1/DCXR/AGXT2/PGM2L1/DPYD/DERA/EHHADH/ACAD10/ACADS/ACOX1/AASS/PCCB/CSAD/GCSH/AFMI"| __truncated__ "TAT/BCKDHA/MCCC1/AGXT2/AASS/CSAD/GCSH/AFMID/GPT/ABAT/PRODH2/DDAH1/ARG1/ACMSD/BCKDK/SHMT1/HGD/CDO1/DBT/GSTZ1/HSD"| __truncated__ ...
 $ Count      : int  50 50 63 30 50 35 24 22 27 43 ...
#...Citation
  Guangchuang Yu, Li-Gen Wang, Yanyan Han and Qing-Yu He.
  clusterProfiler: an R package for comparing biological themes among
  gene clusters. OMICS: A Journal of Integrative Biology
  2012, 16(5):284-287 

方法三、自己动手丰衣足食

library(org.Hs.eg.db)
ego3=as.data.frame(ego)
ensembl=strsplit(ego3$geneID,"/")
​
symbol=sapply(ensembl,function(x){
  y=bitr(x, fromType="ENSEMBL", toType="SYMBOL", OrgDb="org.Hs.eg.db")
  #一对多,取第一个
  y=y[!duplicated(y$ENSEMBL),-1]
  y=paste(y,collapse = "/")
})
​
ego3$geneID=symbol
ego3

得到结果如下

参考下面文章获取DEG.rds文件

GO和KEGG富集结果如何显示基因symbol

你可能感兴趣的:(GO和KEGG富集结果如何显示基因symbol)