Question: Iterate with getBM(bioMart package) for GO annotation
gravatar for newscient
4.2 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 • 1.5k views
ADD COMMENTlink modified 4.2 years ago by Devon Ryan89k • written 4.2 years ago by newscient20
gravatar for Devon Ryan
4.2 years ago by
Devon Ryan89k
Freiburg, Germany
Devon Ryan89k 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 4.2 years ago by Devon Ryan89k

Right..-.-"! Thanks 

ADD REPLYlink written 4.2 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: 2357 users visited in the last hour