Iterate through sever annotation database packages
1
0
Entering edit mode
@morgan-howard-19584
Last seen 5.3 years ago
IUPUI

Hello,

I am looking for a method in R to check a list of accession numbers against annotation databases for 19 species. In theory the code below should extract the ENTREZID, SYMBOL, GENENAME and match the mapped results with the results file via the ACCNUM

mapped <- foreach(i = dbMap$dbName) %do% select(i, as.character(ResultsFile$ACCNUM), c("ENTREZID","SYMBOL","GENENAME"), "ACCNUM")

However select is throwing the error:

Error in select(i, as.character(ResultsFile$ACCNUM), c("ENTREZID", "SYMBOL",  : 
  task 1 failed - "unable to find an inherited method for function ‘select’ for signature ‘"factor"’

This is because i is a factor with 19 levels (one for each database). How could I coerce this to work and produce the desired results?

Thanks for your time and help,

Morgan

Image showing the layout of the dbMap dataframe

R annotation • 497 views
ADD COMMENT
2
Entering edit mode
@james-w-macdonald-5106
Last seen 50 minutes ago
United States

Ideally you wouldn't start with a factor, so when you create your data.frame (however you are doing that), you would want to use stringsAsFactors = FALSE. Also note that select expects you to pass an OrgDb, not a character value that has the same name as an OrgDb, so you need to get the OrgDb. Something like this

mapped <- foreach(i = get(dbMap$dbName)) %do% select(i, as.character(ResultsFile$ACCNUM), c("ENTREZID","SYMBOL","GENENAME"), "ACCNUM")

And having ResultsFile$ACCNUM already being a character is one less coercion you need to worry about.

ADD COMMENT

Login before adding your answer.

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