org.Hs.eg.db包主要注释人类基因:不同数据库ID间的转化。
# if (!requireNamespace("BiocManager", quietly = TRUE))
# install.packages("BiocManager")
#
# BiocManager::install("org.Hs.eg.db")
library(org.Hs.eg.db)
ls("package:org.Hs.eg.db") # 查看包的信息
keytypes(org.Hs.eg.db) # 基因编号系统名称
columns(org.Hs.eg.db)
##columns shows which kinds of data can be returned for the AnnotationDb object.
##keytypes allows the user to discover which keytypes can be passed in to select or ##keys and the keytype argument.
keys(org.Hs.eg.db) # 默认为主键ENTREZID
keys(org.Hs.eg.db,keytype="UNIPROT")
class(org.Hs.eg.db) # AnnotationDb objects
# select 返回data.frame
##ENTREZIDz to 其他id
select(org.Hs.eg.db, keys=keys(org.Hs.eg.db), columns="GO")
select(org.Hs.eg.db, keys=keys(org.Hs.eg.db), columns="SYMBOL")
select(org.Hs.eg.db, keys=keys(org.Hs.eg.db), columns="UNIPROT")
select(org.Hs.eg.db, keys=c("313","314","317"), columns="UNIPROT")
uniport_id <- c("P28039","O75106","O14727")
select(org.Hs.eg.db, keys=uniport_id, columns=c("UNIPROT","SYMBOL"),
keytype="UNIPROT")
select(org.Hs.eg.db, keys=uniport_id, columns=c("UNIPROT","ENTREZID"),
keytype="UNIPROT")
goannot <- select(org.Hs.eg.db, keys=keys(org.Hs.eg.db), columns="GO")
head(goannot)
genesbygo <- split(goannot$ENTREZID, goannot$GO)
# split(x, f, drop = FALSE, ...)
# divides the data in the vector x into the groups defined by f
class(genesbygo) # "list" 可用于GO富集分析
length(genesbygo)
head(genesbygo)