I am trying to convert a list of gene names to entrez gene IDs.
for now i have this:
>library(biomaRt)
>ensembl <- useMart("ensembl", dataset = "hsapiens_gene_ensembl")
>mapping <- getBM(attributes=c('ensembl_gene_id','ensembl_transcript_id',
'entrezgene', 'hgnc_symbol'),mart = ensembl)
This creates a table with the entrez gene IDs and names. However how can I filter out the IDs based on my gene list?
This is an example of the gene names list: Gene names
It is just an excel files with couple of hundred gene names in total.
Hopefully someone could help me!
Data
Create a vector of gene names:
Retrieve information from the BioMart:
Map gene names to Ensembl gene ids, transcript ids, entreze ids
To do this, you don't need to convert whole database into the table of corresponding ids. Using
filter = "hgns_symbol"
as parameter for yourgetBM()
call, will subset database by gene names you've provided as avalues
argument ofgetBM()
function:Which give you 43 records for your genes: