Question: Getting ensembl ID from gene symbol for rat(rn6) in biomart
0
gravatar for sinha.puja
7 weeks ago by
sinha.puja10
sinha.puja10 wrote:

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 • 143 views
ADD COMMENTlink modified 7 weeks ago by Kevin Blighe65k • written 7 weeks ago by sinha.puja10
1
gravatar for Kevin Blighe
7 weeks ago by
Kevin Blighe65k
Kevin Blighe65k wrote:

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 COMMENTlink written 7 weeks ago by Kevin Blighe65k
1

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

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

instead of

Gene$Gene Symbol
ADD REPLYlink written 7 weeks ago by RamRS30k

Thanks you, it worked.

ADD REPLYlink written 6 weeks ago by sinha.puja10
1

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

ADD REPLYlink written 6 weeks ago by RamRS30k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1898 users visited in the last hour