1.同物种ID的转换
Gene id 转换(四种基因各种id转换方法)_易易欢欢的博客-CSDN博客_gene id转换
library("clusterProfiler")
library("org.Hs.eg.db")
gene.df <- bitr(gene, fromType = "ENTREZID",
toType = c("ENSEMBL", "SYMBOL"),
OrgDb = org.Hs.eg.db)#Orgdb是指对应的注释包是哪个
head(gene.df)
geneid <- AnnotationDbi::select(
org.Hs.eg.db, keys=gene, keytype="SYMBOL", columns=c("ENTREZID","ENSEMBL")
)
gene <-AnnotationDbi::mapIds(org.Hs.eg.db,
keys=gene,
column="SYMBOL",
keytype="ENTREZID")#
library(AnnotationDbi)
mySymbols <- AnnotationDbi::mget(gene,
org.Hs.egSYMBOL,
ifnotfound=NA)
曾老师给大家的福利,能够转换各种探针名字
jmzeng1314/AnnoProbe (github.com)
ibrary(devtools)
install_github("jmzeng1314/AnnoProbe")
library(AnnoProbe)
使用biomaRt和gtf进行转换ID
转录组完整的ID转换:biomaRt和gtf - 简书 (jianshu.com)
library(rtracklayer)
gff <- readGFF("genes.gtf")
mapid <- gff[gff$type == "gene", c("gene_id", "gene_name")]
# 用merge进行合并
S1name=data.frame(geneid=data$gene)
dim(df)
df <- merge(S1name, mapid, by.x="geneid", by.y="gene_name")
2.不同物种ID的转换
biomaRt包实现不同物种之间同源基因转换 - 腾讯云开发者社区-腾讯云 (tencent.com)
https://mp.weixin.qq.com/s/FKAXJecDT_rcrrbTtjeQQw
library(biomaRt)
human <- useMart('ensembl',dataset = "hsapiens_gene_ensembl")
mouse <- useMart('ensembl',dataset = "mmusculus_gene_ensembl")
m2h.g <- getLDS(attributes = c("mgi_symbol"),filters = "mgi_symbol",
values = mouse.gene,mart = mouse,
attributesL = c("hgnc_symbol","chromosome_name","start_position"),
martL = human,uniqueRows = T)
如何快速查找物种间对应的同源基因 - 知乎 (zhihu.com)
#安装homologene这个R包
install.packages('homologene')
#加载homologene这个R包
library(homologene)
#这里以小鼠的三个基因为例
#更多基因方法是一样的
genelist<-c("Acadm","Eno2","Acadvl")
#使用homologene函进行转换
#@genelist是要转换的基因列表
#@inTax是输入的基因列表所属的物种号,10090是小鼠
#@outTax是要转换成的物种号,9606是人
homologene(genelist, inTax = 10090, outTax = 9606)