How can I convert Ensembl ID to gene symbol in R?

后端 未结 2 1955
北海茫月
北海茫月 2020-12-13 21:01

I have a data.frame containing Ensembl IDs in one column; I would like to find corresponding gene symbols for the values of that column and add them to a new column in my da

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 21:28

    I tried several R packages (mygene, org.Hs.eg.db, biomaRt, EnsDb.Hsapiens.v79) to convert Ensembl.gene to gene.symbol, and found that the EnsDb.Hsapiens.v79 package / gene database provides the best conversion quality (in terms of being able to convert most of Ensembl.gene to gene.symbol).

    Install the package if you have not installed by running this command: BiocManager::install("EnsDb.Hsapiens.v79")

    library(EnsDb.Hsapiens.v79)
    
    # 1. Convert from ensembl.gene to gene.symbol
    ensembl.genes <- c("ENSG00000150676", "ENSG00000099308", "ENSG00000142676", "ENSG00000180776", "ENSG00000108848", "ENSG00000277370", "ENSG00000103811", "ENSG00000101473")
    
    geneIDs1 <- ensembldb::select(EnsDb.Hsapiens.v79, keys= ensembl.genes, keytype = "GENEID", columns = c("SYMBOL","GENEID"))
    
    # 2. Convert from gene.symbol to ensembl.gene
    geneSymbols <-  c('DDX26B','CCDC83',  'MAST3', 'RPL11', 'ZDHHC20',  'LUC7L3',  'SNORD49A',  'CTSH', 'ACOT8')
    
    geneIDs2 <- ensembldb::select(EnsDb.Hsapiens.v79, keys= geneSymbols, keytype = "SYMBOL", columns = c("SYMBOL","GENEID"))
    

    Other available R packages / gene database for the conversion can refer to this GitHub page.

    My answer to similar question in bioinformatics.stackexchange.

提交回复
热议问题