This is a test version of Biostars. For the public version, visit https://www.biostars.org.
trying to retrieve data on go term from ensembl through biomaRt

Trying to retrieve data on genes pertaining to the GO term mentioned.... it won't work...

ensembl = useMart("ensembl",dataset="hsapiens_gene_ensembl")
go=c("GO:0006306")
getBM(attributes="hgnc_symbol", "hgnc_id"
       filters=c("go", "chromosome_name"),
       values=list(go, chrom), mart=ensembl)

Returns:

getBM(attributes="hgnc_symbol", "hgnc_id"
+        filters=c("go", "chromosome_name"),
Error: unexpected symbol in:
"getBM(attributes="hgnc_symbol", "hgnc_id"
       filters"
>        values=list(go, chrom), mart=ensembl)
Error: unexpected ',' in "       values=list(go, chrom),"
> getBM(attributes="hgnc_symbol", "hgnc_id"
+        filters=c("go", "chromosome_name"),
Error: unexpected symbol in:
"getBM(attributes="hgnc_symbol", "hgnc_id"
       filters"
>        values=list(go, chrom))

any tips?

Thanks

r

1 answer

You forgot an enclosure.

getBM(attributes="hgnc_symbol", "hgnc_id"

should be

getBM(attributes=c("hgnc_symbol", "hgnc_id"),

Also,

filters=c("go", "chromosome_name"),

should be:

filters=c("go_id", "chromosome_name"),

Hey Devon Ryan,

So my new code is:

getBM(attributes="hgnc_symbol", "hgnc_id")
       filters=c("go", "chromosome_name"),
       values=list(go, chrom), mart=ensembl)

and it returns:

getBM(attributes="hgnc_symbol", "hgnc_id")
Error in martCheck(mart) : 
  You must provide a valid Mart object. To create a Mart object use the function: useMart.  Check ?useMart for more information.
>        filters=c("go", "chromosome_name"),
Error: unexpected ',' in "       filters=c("go", "chromosome_name"),"
>        values=list(go, chrom),
Error: unexpected ',' in "       values=list(go, chrom),"
>        mart=ensembl)
Error: unexpected ')' in "       mart=ensembl)"

You forgot a comma on the first line :)

Log in to answer this question.