Can someone help explain how I can convert a list of gene symbols to entrez IDs? I am trying to use id2eg. I start by reading in a .txt file with a list of mouse gene IDs and then try to use the id2eg( ) function. I don't get how to convert the variable to make it match the data Below is an example:
library(pathview)
# Example of first 10 genes
genes <- c("Sergef", "Zfp949", "Endog", "Gstt3", "Mccc1",
"Cndp2", "Cep78", "Tmem147", "Cox6a1", "Tcn2")
# convert gene symbol IDs to EntrezIDs
id.map.symbol <- id2eg(ids = names(genes), category = gene.idtype.list[1], org = "Mm")
No matter how I try to change the variable I get the same the following error:
Error in as.vector(x, "character") :
cannot coerce type 'environment' to vector of type 'character'
Any help will be greatly appreciated.
Mike
Never used it, but I'd suggest removing the
names(...)
from around 'genes'
Thank you, Giovanni. id2eg is part of the pathview package. I ran the conversion with AnnontationDbi and it worked perfectly.
You are welcome. After the conversion, remember to check if there are any NAs (symbols not converted), or any duplicated entrez (symbols matching to the same id).
p.s. biostar works differently from other forums. You should use the "add comment" function to answer to a reply, instead of adding a new reply like you did here.