This is a test version of Biostars. For the public version, visit https://www.biostars.org.
biomaRt code giving me trouble

Trying to get task number 4.3 from biomaRt vignette to work for me. I have established ensembl as the database but from there nothing works for me. I hope you could spot any mistakes in my code:

go=c("GO:0051330", "GO:0000080", chrom=c(1,2,"Y"))

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

Error in getBM(attributes = "hgnc_symbol", filters = c("go", "chromosome_name"),  : 
  object 'chrom' not found

getBM(attributes="hgnc_symbol"
+ filters=c("go","chromosome_name")

Error: unexpected symbol in:
"getBM(attributes="hgnc_symbol"
filters"

values=list(go,chrom), mart=ensembl)

Error: unexpected ',' in "values=list(go,chrom),"
r

The command head(gene$hgnc) returns NULL? What do I have to do to give it a value?

How did you create it in the first place (or did you)?

For what it's worth, section 4.3 of that vignette doesn't seem to work because the example GO IDs in it no longer match to the genes. Presumably this is due to ensembl now using GRCh38 when the vignette was made for hg19 (this is just a guess). If you change the GO ids to GO:0000086 and GO:0051322 and change the "go" filter to "go_id" then you'll get at least partly similar results. If I get a chance, I'll look at the devel branch vignette and see if it's broken too.

I've now alerted the package maintainer. The first error that you ran into has already been corrected for the next release of the package, but the GO ids and the filter are still wrong. Hopefully Steffen will have a chance to update things before the next release goes live, which shouldn't be long.

1 answer

It looks like you just merged two lines. Instead of this:

go=c("GO:0051330", "GO:0000080", chrom=c(1,2,"Y"))

Try this:

go=c("GO:0051330", "GO:0000080")
chrom=c("1","2","Y")

perfect thanks. how do i get the getBM command to work?

By reading help(getBM) and showing us what gene$hgnc contains in the other thread you just started.

Log in to answer this question.