Hello,
I have a tab delimited txt file with ensembl_gene_id in the first column. The other columns represent the counts of RNA-seq alignment. Is that possible to convert those IDs to entrezgene with biomaRt package in R? Thanks.
Hello,
I have a tab delimited txt file with ensembl_gene_id in the first column. The other columns represent the counts of RNA-seq alignment. Is that possible to convert those IDs to entrezgene with biomaRt package in R? Thanks.
This isn't a Biomart method, but uses the various org.XX.eg.db
packages in R (org.Mm.eg.db in this example).
#Loading data not shown, but in this example it's stored in "d"
library(org.Mm.eg.db)
egENSEMBL <- toTable(org.Mm.egENSEMBL)
m <- match(d$EnsemblID, egENSEMBL$ensembl_id)
d$EntrezID <- egENSEMBL$gene_id[m]
The match()
functions are quite useful. You can add gene symbols and names in a similar way.
Edit: I should mention that Ensembl IDs are generally more useful than Entrez IDs, at least in my experience.
Is that possible? Yes, it is.
A little more detail: use ensembl_gene_id as the filter and as a minimum, entrezgene and ensembl_gene_id as the attributes.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Thanks you dpryan79!
I was not able to load the library(org.Mm.eg.db). The R replied "there is no package called "org.Mm.eg.db", although loading "org.Hs.eg.dg" is OK. Did I miss something like dependencies to load the database? Or is there any other alternative databases for the purpose? Thanks again.
org.Mm.eg.db
was just an example, use whatever is appropriate to your species of interest. Also, you have to install the relevant package before you can use it.Finally I got it done by your match() function and biomaRt database.
Millions of thanks!