I want to add gene name information to my expression file, I use Biomart for this, but actually I did not get any result from getBM,
My code in R:
upregul<-read.csv(file.choose())
View(upregul)
library(biomaRt)
listEnsembl()
ensembl <- useEnsembl(biomart = "genes")
ensembl_ids<-(upregul)
View(ensembl_ids)
datasets <- listDatasets(ensembl)
head(datasets)
ensembl_con<-useEnsembl("ensembl",dataset="hsapiens_gene_ensembl")
attr<-listAttributes(ensembl_con)
filters<-listFilters(ensembl_con)
theBm<-getBM(attributes = c("ensembl_gene_id","external_gene_name"),
filters = "ensembl_gene_id",
values = ensembl_ids$X ,
mart =ensembl_con)
The result after running the getBM:
[1] ensembl_gene_id external_gene_name
<0 rows> (or 0-length row.names)
Can you update your post to show some examples of what's in your
ensembl_ids
object? Perhaps the contents ofhead(ensembl_ids)
.It's hard to say why this might be happening without seeing at least a small example of the data you are using.
Exclude commands you use to examine the data (such as
View()
,head()
or just typing in the object name which prints a representation of the object to the Console) when you share your code here.Many thanks, it worked. but at first, I had 5000 observations and after getBM, my obs reduced to 4000.