「知识星球」里的问题,https://t.zsxq.com/aEyneA2,拟南芥的ID怎么搞,这个内置是支持的。

比如我随便搞几个ID来演示一下:

> require(clusterProfiler)
Loading required package: clusterProfiler

clusterProfiler v3.9.0  For help: https://guangchuangyu.github.io/software/clusterProfiler

If you use clusterProfiler in published research, please cite:
Guangchuang Yu, Li-Gen Wang, Yanyan Han, 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.

g <- c("AT5G61600", "AT2G44230", "AT1G49130", "AT1G30310", "AT3G18560",
"AT2G15960", "AT2G29290", "AT1G08930", "AT2G44460", "AT3G46600",
"AT5G24380", "AT3G59270", "AT5G55780", "AT2G45090", "AT5G38430",
"AT2G17040", "AT4G35770", "AT5G30341", "AT1G56320", "AT2G16367")

KEGG分析

你只要指定物种是ath就行,默认就是使用TAIR.

> y = enrichKEGG(g, organism="ath", pvalueCutoff=.1)
> y
#
# over-representation test
#
#...@organism 	 ath
#...@ontology 	 KEGG
#...@keytype 	 kegg
#...@gene 	 chr [1:20] "AT5G61600" "AT2G44230" "AT1G49130" "AT1G30310" "AT3G18560" ...
#...pvalues adjusted by 'BH' with cutoff <0.1
#...4 enriched terms found
'data.frame':	4 obs. of  9 variables:
 $ ID         : chr  "ath00960" "ath00460" "ath00710" "ath00630"
 $ Description: chr  "Tropane, piperidine and pyridine alkaloid biosynthesis" "Cyanoamino acid metabolism" "Carbon fixation in photosynthetic organisms" "Glyoxylate and dicarboxylate metabolism"
 $ GeneRatio  : chr  "1/3" "1/3" "1/3" "1/3"
 $ BgRatio    : chr  "35/4934" "67/4934" "69/4934" "78/4934"
 $ pvalue     : num  0.0211 0.0402 0.0414 0.0467
 $ p.adjust   : num  0.0817 0.0817 0.0817 0.0817
 $ qvalue     : num  0.0369 0.0369 0.0369 0.0369
 $ geneID     : chr  "AT2G29290" "AT2G44460" "AT5G38430" "AT5G38430"
 $ Count      : int  1 1 1 1
#...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

> head(y)
               ID                                            Description
ath00960 ath00960 Tropane, piperidine and pyridine alkaloid biosynthesis
ath00460 ath00460                             Cyanoamino acid metabolism
ath00710 ath00710            Carbon fixation in photosynthetic organisms
ath00630 ath00630                Glyoxylate and dicarboxylate metabolism
         GeneRatio BgRatio     pvalue  p.adjust     qvalue    geneID Count
ath00960       1/3 35/4934 0.02113456 0.0817067 0.03686017 AT2G29290     1
ath00460       1/3 67/4934 0.04019509 0.0817067 0.03686017 AT2G44460     1
ath00710       1/3 69/4934 0.04137809 0.0817067 0.03686017 AT5G38430     1
ath00630       1/3 78/4934 0.04668955 0.0817067 0.03686017 AT5G38430     1

GO分析

GO的话,有org.At.tair.db,你只要指定`keyType=“TAIR”,然后就完事了。

> y2 = enrichGO(g, OrgDb = "org.At.tair.db", keyType="TAIR", ont="BP")
> y2
#
# over-representation test
#
#...@organism 	 Arabidopsis thaliana
#...@ontology 	 BP
#...@keytype 	 TAIR
#...@gene 	 chr [1:20] "AT5G61600" "AT2G44230" "AT1G49130" "AT1G30310" "AT3G18560" ...
#...pvalues adjusted by 'BH' with cutoff <0.05
#...2 enriched terms found
'data.frame':	2 obs. of  9 variables:
 $ ID         : chr  "GO:0010200" "GO:0010243"
 $ Description: chr  "response to chitin" "response to organonitrogen compound"
 $ GeneRatio  : chr  "4/14" "4/14"
 $ BgRatio    : chr  "421/20876" "443/20876"
 $ pvalue     : num  0.000139 0.000169
 $ p.adjust   : num  0.00778 0.00778
 $ qvalue     : num  0.00703 0.00703
 $ geneID     : chr  "AT5G61600/AT1G08930/AT3G46600/AT2G17040" "AT5G61600/AT1G08930/AT3G46600/AT2G17040"
 $ Count      : int  4 4
#...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

> head(y2)
                   ID                         Description GeneRatio   BgRatio
GO:0010200 GO:0010200                  response to chitin      4/14 421/20876
GO:0010243 GO:0010243 response to organonitrogen compound      4/14 443/20876
                 pvalue    p.adjust      qvalue
GO:0010200 0.0001390340 0.007779913 0.007032187
GO:0010243 0.0001691285 0.007779913 0.007032187
                                            geneID Count
GO:0010200 AT5G61600/AT1G08930/AT3G46600/AT2G17040     4
GO:0010243 AT5G61600/AT1G08930/AT3G46600/AT2G17040     4

GSEA

GSEA的分析也是一样的,gseKEGG就设置organism="ath",而gseGO就设置OrgDb=org.At.tair.db,以及指定keyType="TAIR"。这里不再进一步展开。

可视化

clusterProfiler支持多种可视化方法,这个也请自己移步去翻看在线文档。