org.Hs.eg.db进行基因id转换
clusterProfiler进行GO可视化
#GO可视化
BiocManager::install("clusterProfiler")BiocManager::install("org.Hs.eg.db")
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("org.Hs.eg.db",force = TRUE)
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("clusterProfiler",force = TRUE)
library(org.Hs.eg.db)
library(clusterProfiler)
load("Desktop/go_genename.rda") ##加载数据
原始数据gene_list
#根据自己数据来
gene_list = c("MTLL3","MTLL14")
转换id的两种方法:
#org.Hs.eg.db:
ensembls <- mapIds(org.Hs.eg.db, keys = m6a_sym, keytype = "SYMBOL", column="ENSEMBL")
#一次性转换到ENSEMBL ID,ENTREZ ID和UNIPROT ID
AnnotationDbi::select(org.Hs.eg.db, keys=m6a_sym,keytype="SYMBOL", columns = c("ENSEMBL","ENTREZID","UNIPROT"))
#clusterProfiler:
s2ens = bitr(m6a_sym, fromType="SYMBOL", toType="ENSEMBL", OrgDb="org.Hs.eg.db")
#一次性转换多种id:
bitr(m6a_sym, fromType="SYMBOL", toType=c("ENSEMBL","ENTREZID"), OrgDb="org.Hs.eg.db")
怎么知道哪些数据格式可以进行转换:
keytypes(org.Hs.eg.db)
columns(org.Hs.eg.db)
运行代码可得结果(即以下都可进行转换)
[1] "ACCNUM" "ALIAS" "ENSEMBL" "ENSEMBLPROT"
[5] "ENSEMBLTRANS" "ENTREZID" "ENZYME" "EVIDENCE"
[9] "EVIDENCEALL" "GENENAME" "GENETYPE" "GO"
[13] "GOALL" "IPI" "MAP" "OMIM"
[17] "ONTOLOGY" "ONTOLOGYALL" "PATH" "PFAM"
[21] "PMID" "PROSITE" "REFSEQ" "SYMBOL"
[25] "UCSCKG" "UNIPROT"
mapIds(org.Hs.eg.db, keys=数据, “数据格式”, “想转换的格式”)
gene1 <- mapIds(org.Hs.eg.db, keys=gene_list, "SYMBOL", "ENSEMBL") #转化id形式
all <- enrichGO(gene = gene_list,
OrgDb = org.Hs.eg.db,
keyType = "SYMBOL",
ont = "ALL" , ##同时展示mf,bp和cc
pAdjustMethod = "BH",
pvalueCutoff = 0.01,
qvalueCutoff = 0.05)
barplot(all,showCategory=30)
分子功能(Molecular Function,MF )
细胞组分(Cellular Component ,CC)
生物过程(Biological Process ,BP)
#仅展示bp
BP <- enrichGO( gene = gene,
OrgDb = org.Hs.eg.db,
ont = "BP" ,
pAdjustMethod = "BH",
pvalueCutoff = 0.01,
qvalueCutoff = 0.05)
barplot(BP, showCategory=30)
#点图
dotplot(all,showCategory=30)