Question: Iterate with getBM(bioMart package) for GO annotation
gravatar for newscient
5.9 years ago by
European Union
newscient20 wrote:

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_ids from there and get the GO annotations for each dataset seperately 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?

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!

iteration getbm gene ontology • 2.1k views
ADD COMMENTlink modified 5.9 years ago by Devon Ryan98k • written 5.9 years ago by newscient20
gravatar for Devon Ryan
5.9 years ago by
Devon Ryan98k
Freiburg, Germany
Devon Ryan98k wrote:

You want

for (i in 1:nrow(samples.annotationsnew)){

rather than

for (i in nrow(samples.annotationsnew)){

As an aside, it's generally best to avoid for loops in R for performance reasons (though in cases like this I doubt that will be an issue).

ADD COMMENTlink written 5.9 years ago by Devon Ryan98k

Right..-.-"! Thanks 

ADD REPLYlink written 5.9 years ago by newscient20
Please log in to add an answer.


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