I am mapping Entrez gene ids to ensembl ids using biomaRt.
library("biomaRt")                                                                                                                    
library("readxl")                                                                                                                     
tbl <- read_excel(input_excel)                                                                                                   
tbl <- tbl["EntrezID"]                                                                                                                
print(tbl, n=Inf)                                                                                                                     
listMarts()                                                                                                                           
ensembl <- useMart("ensembl",dataset="hsapiens_gene_ensembl")                                                                         
filters = listFilters(ensembl)                                                                                                        
entrezgene = tbl                                                                                                                                                                                                                                   
genes <- getBM(                                                                                                                               
filters="entrezgene_id",                                                                                                              
attributes=c("ensembl_gene_id","entrezgene_id"),                                                                                      
values=entrezgene,                                                                                                                    
mart=ensembl)                                                                                                                 
print(genes)
The input is read from the excel here from this study.
I get the following error message
Error in `[[<-.data.frame`(`*tmp*`, vIdx, value = c("26155", "9636", "375790",  :                                                       replacement has 494 rows, data has 6909                                                                                            
 Calls: getBM ... .generateFilterXML -> .splitValues -> [[<- -> [[<-.data.frame                                                        
Execution halted                                                                                                                      
Error in `[[<-.data.frame`(`*tmp*`, vIdx, value = c("26155", "9636", "375790",  :                                                       replacement has 494 rows, data has 6909                                                                                             
Calls: getBM ... .generateFilterXML -> .splitValues -> [[<- -> [[<-.data.frame                                                        
Execution halted
Does 494 rows, data has 6909 this mean only ensembl ids of 494 entrez genes(out of 6909) were mapped?
Could someone look into this? I'm not sure how to resolve this error.
Maybe try convert entrez_id from character to nemuric?
Thank you. I added
tbl <- mapply(tbl, FUN=as.numeric)before listMart(). The query proceeds without any error. However, I obtain 7720 entries, whereas my input has 6909 entries.This is normal, many ENTREZ ID map to multiple ENSEMBL ID.
Can you post the actual function that gives the error? Where is your
getBM()call?Sorry, there was a formatting error. Now it's displayed