I am trying to use the getBM
function for a list of dataframes(or datasets if you prefer) (genes2peaks
) and use only a list of gene_id
s from there and get the GO annotations for each dataset separately in a new list, but I get only annotations for the final dataset in my list!
I also retrieve the correct dataset argument for the useMart
function from a list I have made (samples.annotationsnew$biomart
)!
Can somebody identify any the problem in that iteration?
library(biomaRt)
GOannotations<-list()
for (i in nrow(samples.annotationsnew)){
mart <- useMart(biomart = "ensembl", dataset = samples.annotationsnew$biomart[i])
values <- genes2peaks[[i]]$feature
GOannotations[[i]] <- getBM(attributes = c("ensembl_gene_id", "go_id","name_1006"), filters = "ensembl_gene_id",values = values, mart = mart)
}
Thanks in advance!
Right..-.-"! Thanks