Monday, January 5, 2015

Ensembl to Gene symbol convertion - R programming

There are many way to convert Ensembl ID to Gene symbol,
in this posting, I've set an example of R programming.




R programming -

at first, you need to install biocLite and library biomaRt.

> source("http://bioconductor.org/biocLite.R")
> biocLite()
> biocLite("biomaRt")
> library(biomaRt)

When you install this packages and libraries, you need an authentication.




I've set an example for you.


These are Ensembl examples.

ENSG00000116783
ENSG00000139656
ENSG00000196987
ENSG00000216560
...
..

To use Ensembl examples in R, you need to form those as vector c(" "... ).

like this..

> ensembl_gene = c("ENSG00000116783","ENSG00000139656","ENSG00000196987","ENSG00000216560"........);
> mart<- useDataset("hsapiens_gene_ensembl", useMart("ensembl"))
# hsapiens_gene_ensembl database, mart object
>getBM(filters= "ensembl_gene_id", attributes= c("ensembl_gene_id", "entrezgene", "description"),values=ensembl_gene,mart= mart)



This is R programming source.

ensembl_gene  <- c("ENSG00000116783","ENSG00000139656","ENSG00000196987","ENSG00000216560")
mart<- useDataset("hsapiens_gene_ensembl", useMart("ensembl"))
getBM(filters= "ensembl_gene_id", attributes= c("ensembl_gene_id", "entrezgene", "description"),values=ensembl_gene, mart= mart)





No comments:

Post a Comment