模式生物做什么都簡單,非模式生物則很多缺少注釋,沒有注釋你就沒法做,只能是借助于各種軟件比如blastgo,自己跑電子注釋。但今天要講的不是這種情況,很多物種還是有注釋的,只是你有時候不知道該去那里下載,或者你有數(shù)據(jù),卻不知道該怎么用!很多的軟件都是針對模式生物的,或者針對某一些類型的非模式生物,能夠支持多種非模式生物,能夠支持用戶自己的注釋文件的軟件相對來講,就非常少有了,然而clusterProfiler就是這類少有的軟件之一。
獲得OrgDb
- 今天要講的是通過OrgDb來做GO分析,這是clusterProfiler的enrichGO函數(shù)所支持的背景注釋,Bioconductor自帶20個OrgDb可供使用,多半是模式生物,難道我們要做的物種不在這20個里面就不行了嗎?顯然不是的,clusterProfiler能支持的物種我自己都數(shù)不過來。
我們可以通過AnnotationHub在線檢索并抓取OrgDb,比如這里以rice為例:
> require(AnnotationHub)
> hub <- AnnotationHub()
> query(hub, "oryza sativa")
AnnotationHub with 2 records
# snapshotDate(): 2017-04-25
# $dataprovider: Inparanoid8, ftp://ftp.ncbi.nlm.nih.gov/gene/DATA/
# $species: Oryza sativa, Oryza sativa_Japonica_Group
# $rdataclass: Inparanoid8Db, OrgDb
# additional mcols(): taxonomyid, genome, description,
# coordinate_1_based, maintainer, rdatadateadded, preparerclass, tags,
# rdatapath, sourceurl, sourcetype
# retrieve records with, e.g., 'object[["AH10561"]]'
title
AH10561 | hom.Oryza_sativa.inp8.sqlite
AH55775 | org.Oryza_sativa_Japonica_Group.eg.sqlite
> rice <- hub[['AH55775']]
downloading from ‘https://annotationhub.bioconductor.org/fetch/62513’
retrieving 1 resource
|======================================================================| 100%
Loading required package: AnnotationDbi
Loading required package: stats4
Loading required package: Biobase
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
Attaching package: ‘Biobase’
The following object is masked from ‘package:AnnotationHub’:
cache
Loading required package: IRanges
Loading required package: S4Vectors
Attaching package: ‘S4Vectors’
The following object is masked from ‘package:base’:
expand.grid
> length(keys(rice))[1]
[1] 32639
#通過檢索,org.Oryza_sativa_Japonica_Group.eg.sqlite就是我們所要的OrgDb,可以通過相應(yīng)的accession number, AH55775 抓取文件,并存入了rice對象中,它包含了32639個基因的注釋
這個OrgDb,包含有以下一些注釋信息:
> columns(rice)
[1] "ACCNUM" "ALIAS" "CHR" "ENTREZID" "EVIDENCE"
[6] "EVIDENCEALL" "GENENAME" "GID" "GO" "GOALL"
[11] "ONTOLOGY" "ONTOLOGYALL" "PMID" "REFSEQ" "SYMBOL"
##我們可以使用bitr來轉(zhuǎn)換ID,甚至于直接檢索GO注釋:
> require(clusterProfiler)
> bitr(keys(rice)[1], 'ENTREZID', c("REFSEQ", "GO", "ONTOLOGY"), rice)
'select()' returned 1:many mapping between keys and columns
ENTREZID REFSEQ GO ONTOLOGY
1 3131385 NP_039457.2 GO:0005739 CC
2 3131385 NP_039457.2 GO:0005763 CC
##GO富集分析
> sample_genes <- keys(rice)[1:100]
> head(sample_genes)
[1] "3131385" "3131390" "3131391" "3131392" "3131393" "3131394"
##這里只是簡單地使用ID列表中前100個ENTREZ基因ID,也可以使用其它的ID,通過借助于bitr進行轉(zhuǎn)換,或者通過給enrichGO指定ID類型(keyType參數(shù))。
> 有了OrgDb,使用起來,就跟文檔中使用人類基因做為例子一樣,用法一致,并且也可以通過clusterProfiler所提供的各種可視化函數(shù)對結(jié)果進行展示:
> require(clusterProfiler)
> res = enrichGO(sample_genes, OrgDb=rice, pvalueCutoff=1, qvalueCutoff=1)
> res
#
# over-representation test
#
#...@organism Oryza sativa_Japonica_Group
#...@ontology MF
#...@keytype ENTREZID
#...@gene chr [1:100] "3131385" "3131390" "3131391" "3131392" "3131393" "3131394" ...
#...pvalues adjusted by 'BH' with cutoff <1
#...28 enriched terms found
'data.frame': 28 obs. of 9 variables:
$ ID : chr "GO:0003735" "GO:0005198" "GO:0003723" "GO:0016830" ...
$ Description: chr "structural constituent of ribosome" "structural molecule activity" "RNA binding" "carbon-carbon lyase activity" ...
$ GeneRatio : chr "7/12" "7/12" "2/12" "1/12" ...
$ BgRatio : chr "22/478" "22/478" "14/478" "10/478" ...
$ pvalue : num 1.08e-07 1.08e-07 4.45e-02 2.26e-01 3.24e-01 ...
$ p.adjust : num 1.52e-06 1.52e-06 4.15e-01 1.00 1.00 ...
$ qvalue : num 1.42e-06 1.42e-06 3.90e-01 9.40e-01 9.40e-01 ...
$ geneID : chr "3131425/3131435/3131436/3131439/3131441/3131442/3131457" "3131425/3131435/3131436/3131439/3131441/3131442/3131457" "3131425/3131457" "3131463" ...
$ Count : int 7 7 2 1 3 1 2 4 4 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
如果你有表達譜數(shù)據(jù),你也可以使用gseGO進行GSEA分析
KEGG Organisms: Complete Genomes:
http://www.genome.jp/kegg/catalog/org_list.html
ref:Y叔
http://guangchuangyu.github.io/2016/01/go-analysis-using-clusterprofiler/