Question: Error while converting SYMBOLS to ENTREZID - Bioconductor
0
gravatar for Bade
4.3 years ago by
Bade30
United States
Bade30 wrote:

I am getting a strange error converting Gene Symbols to Entrez ID. Here is my code:

testData = read.delim("IL_CellVar.txt",head=T,row.names = 2)
testData[1:5,1:3]

ClustID Genes.Symbol ChrLoc

NM_001034168.1 4 Ank2 chrNA:-1--1

NM_013795.4 4 Atp5l chrNA:-1--1

NM_018770 4 Igsf4a chrNA:-1--1

NM_146150.2 4 Nrd1 chrNA:-1--1

NM_134065.3 4 Epdr1 chrNA:-1--1

clustNum = 5
filteredClust = testData[testData$ClustID == clustNum,]
anyis.na(filteredClust$Genes.Symbol))

[1] FALSE

selectedEntrezIds <- unlist(mget(filteredClust$Genes.Symbol,org.Mm.egSYMBOL2EG))

Error in unlist(mget(filteredClust$Genes.Symbol, org.Mm.egSYMBOL2EG)) : error in evaluating the argument 'x' in selecting a method for function 'unlist': Error in .checkKeysAreWellFormed(keys) : keys must be supplied in a character vector with no NAs

Another approach fails too:

selectedEntrezIds = select(org.Mm.eg.db,filteredClust$Genes.Symbol, "ENTREZID")

Error in .select(x, keys, columns, keytype = extraArgs[["kt"]], jointype = jointype) : 'keys' must be a character vector

Just for the sake or error, removing 'NA', doesn't help:

a <- filteredClust$Genes.Symbol[!is.na(filteredClust$Genes.Symbol)]
selectedEntrezIds <- unlist(mget(a,org.Mm.egSYMBOL2EG))

Error in unlist(mget(a, org.Mm.egSYMBOL2EG)) : error in evaluating the argument 'x' in selecting a method for function 'unlist': Error in .checkKeysAreWellFormed(keys) : keys must be supplied in a character vector with no NAs

I am not sure why I am getting this error as the master file from which gene symbols were extracted for testData gives no problem while converting to EntrezID. Would appreciate help on this.

Thanks

AK

illumina bioconductor R annotate • 3.0k views
ADD COMMENTlink modified 4.2 years ago by Biostar ♦♦ 20 • written 4.3 years ago by Bade30

Is it just me or there really is a problem beginning right at the 4th line of code? You are assigning 5 to clustNum. Then you are checking if testData$ClustID is equal to clustNum which is 5. But testData$ClustID are NCBI accessions. This is not making any sense to me.

ADD REPLYlink written 4.2 years ago by komal.rathi3.3k

Just guessing, but I think the RefSeq accessions are actually rownames.  

ADD REPLYlink written 4.2 years ago by Sean Davis25k

Damn! You are right. 

ADD REPLYlink written 4.2 years ago by komal.rathi3.3k
2
gravatar for poisonAlien
4.3 years ago by
poisonAlien2.6k
Asgard
poisonAlien2.6k wrote:

answer is in the error itself. keys must be character vector. Try this,

selectedEntrezIds <- unlist(mget(as.character(a),org.Mm.egSYMBOL2EG))
ADD COMMENTlink written 4.3 years ago by poisonAlien2.6k

This is the answer, so why not drop it as an answer below, just for posterity sake.

ADD REPLYlink written 4.2 years ago by Sean Davis25k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 979 users visited in the last hour