Getting ensembl ID from gene symbol for rat(rn6) in biomart
1
0
Entering edit mode
4.3 years ago
sinha.puja ▴ 20

Hi I am trying to get ensembl ID from official gene symbol of rat (rn6) using biomart and below is the code but the last line has error.

library("biomaRt")
listMarts()
ensembl <- useMart("ensembl")
datasets <- listDatasets(ensembl)
ensembl = useDataset("rnorvegicus_gene_ensembl",mart=ensembl)
Gene <- read.csv("TMM-normalizedcounts-ANOVA-8-30-19.csv",header=T)
final <- getBM(attributes=c('external_gene_name','ensembl_gene_id'), filters = 'external_gene_name', values = Gene$Gene Symbol, mart = ensembl)

Can anyone help me in correcting the code.

Thanks in advance.

R • 3.4k views
ADD COMMENT
1
Entering edit mode
4.3 years ago

Hello,

What is the error? What is the output of str(Gene)?

The error is likely caused by this:

getBM(..., values = Gene$Gene Symbol, ...)

This will cause an error (the space): Gene$Gene Symbol

Just to confirm, you are already using the correct attributes:

library('biomaRt')
listMarts()
ensembl <- useMart("ensembl")
datasets <- listDatasets(ensembl)
ensembl = useDataset("rnorvegicus_gene_ensembl",mart=ensembl)
annot <- getBM(attributes=c('external_gene_name','ensembl_gene_id'), mart = ensembl)

head(annot)
  external_gene_name    ensembl_gene_id
1        AY172581.13 ENSRNOG00000031780
2         AY172581.9 ENSRNOG00000030478
3         AY172581.3 ENSRNOG00000029171
4        AY172581.24 ENSRNOG00000043866
5        AY172581.14 ENSRNOG00000032112
6             Mt-nd1 ENSRNOG00000030644

tail(annot)
      external_gene_name    ensembl_gene_id
32878     AABR07020983.1 ENSRNOG00000051347
32879     AABR07038690.1 ENSRNOG00000003345
32880             Pou5f1 ENSRNOG00000046487
32881               Sox5 ENSRNOG00000027869
32882              Eda2r ENSRNOG00000013018
32883            Ccdc88b ENSRNOG00000024931

Kevin

ADD COMMENT
1
Entering edit mode

A minor addition - Kevin already solved your problem, I think. Try

Gene$`Gene Symbol` #notice the back-ticks

instead of

Gene$Gene Symbol
ADD REPLY
0
Entering edit mode

Thanks you, it worked.

ADD REPLY
1
Entering edit mode

Please accept Kevin's answer to mark this question as resolved.

ADD REPLY

Login before adding your answer.

Traffic: 1599 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6