convert between RefSeq, Entrez and Ensembl gene IDs using R package biomaRt

# R code for convert gene/transcripts names
# personal notes

require(biomaRt)

# settings
features=c(“ensembl_gene_id”,”ensembl_transcript_id”,”entrezgene”,”external_gene_name”,”refseq_mrna”)
host=”www.ensembl.org”
# human
human_file=”geneID_mapping_human.tsv”
hmart=useMart(“ENSEMBL_MART_ENSEMBL”, dataset=”hsapiens_gene_ensembl”,host=host)
results=getBM(attributes=features,mart=hmart)
write.table(results,human_file,sep=”\t”,quote=FALSE,row.names=FALSE,col.names=TRUE)

# mouse
mouse_file=”geneID_mapping_mouse.tsv”
mmart=useMart(“ENSEMBL_MART_ENSEMBL”, dataset=”mmusculus_gene_ensembl”,host=host)
results=getBM(attributes=features,mart=mmart)
write.table(results,mouse_file,sep=”\t”,quote=FALSE,row.names=FALSE,col.names=TRUE)

Leave a Reply

Your email address will not be published. Required fields are marked *