使用 biomaRt 注释位置

Annotate positions using biomaRt

我有一些基因组位置,我想使用 biomaRt R 包基于 Ensembl 注释这些位置(找到 Ensembl 基因 ID,外显子、内含子等特征)。

我的部分数据

  chr       start        stop     strand
chr10   100572320   100572373          -   
chr10   100572649   100572658          +   

准备您的数据以查询 biomaRt

示例数据

data = data.frame(chr = "chr17", start = 63973115, end = 64437414)
data$query = paste(gsub("chr",'',data$chr),data$start,data$end, sep = ":")

#> data
#    chr    start      end                query
#1 chr17 63973115 64437414 17:63973115:64437414

然后使用biomaRt

library(biomaRt)

# select your dataset of interest accordingly. 
# I have used human specific dataset identifier
# you can see all available datasets using listDatasets(mart),
# after setting your mart of interest

mart = useMart(
         'ENSEMBL_MART_ENSEMBL', 
          host = 'ensembl.org', 
          dataset = 'hsapiens_gene_ensembl')

# do listAttributes(mart) to list all information you can extract using biomaRt

out = getBM(
        attributes = c('ensembl_gene_id', 'external_gene_name', 'gene_biotype', 
                       'ensembl_transcript_id', 'ensembl_exon_id'), 
        filters = 'chromosomal_region', 
        values = data$query, 
        mart = mart)

这将为您提供给定基因组位置中存在的基因、转录本和外显子的整体 ID。 biomaRt 提供了更多信息,所以不要忘记使用 listAttributes() 来查找所有信息。