Error: unexpected symbol using BiomaRt in R
1
0
Entering edit mode
2.8 years ago

I'm trying to use biomaRt in R to make a table containing HGNC symbols and UnitProt/SwissProt IDs. Here is my code:

ensembl = useMart("ENSEMBL_MART_ENSEMBL", dataset="hsapiens_gene_ensembl")

hgncswissprot <- getBM(attributes=c("hgnc_symbol", "uniprotswissprot"), filters="with_hgnc", values=list(c("ACMSD", "ATP13A2"), TRUE, mart=ensembl)

However, I get this error:

Error: unexpected symbol in: "hgncswissprot <- getBM(attributes=c("hgnc_symbol", "uniprotswissprot"), filters="with_hgnc", values=list(c("ACMSD", "ATP13A2"), TRUE, mart=ensembl) hgncswissprot"

I've been trying to solve this for days but have no idea what I'm doing wrong. I would greatly appreciate any pointers! (:

ensembl r biomart biomaRt R • 746 views
ADD COMMENT
2
Entering edit mode
2.8 years ago

Hi,

You almost had it. Here is a working example:

ensembl <- useMart(
  'ENSEMBL_MART_ENSEMBL',
  dataset = 'hsapiens_gene_ensembl')

hgncswissprot <- getBM(
  attributes = c('hgnc_symbol', 'uniprotswissprot'),
  filters = c('hgnc_symbol', 'with_hgnc'),
  values = list(c('ACMSD', 'ATP13A2'), TRUE),
  mart = ensembl)

hgncswissprot
  hgnc_symbol uniprotswissprot
1       ACMSD           Q8TDX5
2     ATP13A2           Q9NQ11
3     ATP13A2

Note that we can also have returned to us an entire annotation table, by running this:

annotTable <- getBM(
  attributes = c('hgnc_symbol', 'uniprotswissprot'),
  mart = ensembl)

dim(annotTable)
[1] 33651     2

head(annotTable)
  hgnc_symbol uniprotswissprot
1      MT-ND1           P03886
2      MT-ND2           P03891
3      MT-CO1           P00395
4      MT-CO2           P00403
5     MT-ATP8           P03928
6     MT-ATP6           P00846

Kevin

ADD COMMENT

Login before adding your answer.

Traffic: 2011 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