使用"biomaRt"包进行基因ID转换

1、安装"biomaRt"包

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install("biomaRt")
library("biomaRt")

2、"ensembl_transcript_id_version" 转 "refseq_mrna", "ensembl_gene_id", "hgnc_symbol"

输入文件file.txt如下所示:

转换命令如下:

values<- read.table("file.txt",header=F)
ensembl = useEnsembl(biomart = "ensembl", dataset = "hsapiens_gene_ensembl", mirror = "useast")
new=getBM(attributes=c("ensembl_transcript_id_version","refseq_mrna", "ensembl_gene_id", "hgnc_symbol"), filters = "ensembl_transcript_id_version", values = values, mart= ensembl)

输出文件new如下所示:

posted @ 2021-07-27 11:15  橙子牛奶糖  阅读(1615)  评论(0编辑  收藏  举报