[BioC] arabidopsis annotate mget problem

Marc Carlson mcarlson at fhcrc.org
Fri Jun 20 00:43:32 CEST 2008


Siobhan Braybrook wrote:
> please excuse me if this is elementary, but I am lost about an error I am
> getting.
> I want to use a list of probe IDs to get out the genes from ath1121501ACCNUM.
>
> So I did the following:
>
> library(annotate)
> library(ath1121501.db)
> #next I made a short list of probe IDs to test my mget ability
> abaup=c("262128_at","255795_at","266462_at","250648_at","247095_at","258498_at","247723_at","258347_at","245982_at","263497_at")
> a1=mget(abaup, ath1121501ACCNUM)
> #this worked just fine
> #so I made a txt file of all the probe IDs I wanted to look up, and read in
> abaupr= read.delim("upgenes.txt", header = FALSE, quote="",sep = "\t")
> #then I made it a list
> abaupr=as.list(abaupr)  
> #then I did just like I did on my test case above but got an error about
> #ifnotfound.  
> a1=mget(abaupr, ath1121501ACCNUM)
> #Error in .checkKeys(value, Lkeys(x), x at ifnotfound) : 
> #  the keys must be character strings
>
> #I looked up ifnotfound in mget.....and still dont understand #the error.  
> #the only option is NA, but.........
> a1=mget(abaupr, ath1121501ACCNUM,ifnotfound=NA)
> #Error in .checkKeys(value, Lkeys(x), x at ifnotfound) : 
> #  the keys must be character strings
>
> My lack of understanding could be due to my lack of getting mget.....any help?
>
> Thanks!
> Siobhan
>
> S.A. Braybrook
> Section of Plant Biology
> University of California, Davis
> Davis, CA
> 530-752-6980
>
> "The time is always right to do what is right."
> -Dr. Martin Luther King Jr.
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>
>   

Hi Siobhan, 

The problem you are having is because the mget() function expects a 
simple character vector.  In your 1st example this is what you had, but 
after you read the data in from a file you had a matrix that you then 
cast into a list.  Try just slicing out the column that you need from 
your matrix like below:

#1st you can start out like before
abaupr= read.delim("upgenes.txt", header = FALSE, quote="",sep = "\t")

#but then do something more like this:
foo = as.vector(abaupr[,1])

#if you now look with class() you can see you have a simple character 
vector now
class(foo)

#and now this can work with mget:
a1=mget(foo, ath1121501ACCNUM)


    Marc



More information about the Bioconductor mailing list