Given a list of gene IDs, how do you retrieve the gene description, summary and other detailed information in R?
3 Answers
$\begingroup$
$\endgroup$
1
Description of how to use biomaRt here. Filter by your list of gene IDs. Get the descriptions etc as attributes. Eg:
> library(biomaRt)
> ensembl = useEnsembl(biomart="ensembl", dataset="hsapiens_gene_ensembl")
> IDs <- c("BRCA2","BRAF")
genedesc <- getBM(attributes=c('external_gene_name','description'), filters = 'external_gene_name', values = IDs, mart =ensembl)
> genedesc
external_gene_name description
1 BRAF B-Raf proto-oncogene, serine/threonine kinase [Source:HGNC Symbol;Acc:HGNC:1097]
2 BRCA2 BRCA2, DNA repair associated [Source:HGNC Symbol;Acc:HGNC:1101]
-
1$\begingroup$ Thank you for the answer. I did not find a way to return detailed information using biomaRt. The description fields are just extended gene names. $\endgroup$– PeterCommented Oct 16, 2017 at 15:25
$\begingroup$
$\endgroup$
1
MyGene.info
Using the R package for the MyGene.info database:
source("https://bioconductor.org/biocLite.R")
biocLite("mygene")
library(mygene)
gene <- getGene("1017", fields="all")
gene$summary
Multiple genes:
gene <- getGenes(c(1347:1350), fields="summary")
Entrez database
library(devtools)
install_github("ropensci/rentrez")
library(rentrez)
genes <- entrez_summary(db="gene", id=c(718,720))
genes$`720`$summary
-
$\begingroup$ Nice question (and answer, I didn't know about MyGene), if you know what you are looking for maybe it is worth to mention biomaRt $\endgroup$– llrsCommented Oct 16, 2017 at 6:56
$\begingroup$
$\endgroup$
The easiest and fastest method (which also doesn’t require internet access) is to use annotation packages, e.g. org.Mm.eg.db:
library(AnnotationDbi)
library(org.Mm.eg.db)
# 1:1 mapping symbol→entrez
entrez_ids <- mapIds(org.Mm.eg.db, gene_symbols, 'ENTREZ', 'SYMBOL')
# 1:n mapping symbol→…
print(columns(org.Mm.eg.db)) # check what you can query
df <- select(org.Mm.eg.db, gene_symbols, c(...), 'SYMBOL')