[BioC] building a "for loop" with getGene, biomaRt

Morten Mattingsdal morten.mattingsdal at student.uib.no
Thu Dec 15 13:37:42 CET 2005


Hello everyone,
Ill be blunt: I want to make multiple queries with the getGene funciton 
of biomaRt, but having some trouble (this is probably my lack of 
knowledge in programming)

first I make an object containing 3 entrez gene ID's.

test=c("4205","9185","4791")

if i then

library(biomaRt)
mart <- martConnect( biomarts = c("ensembl","vega"))
g= getGene( id = test[1], type = "entrezgene", species = "hsapiens", db 
= "ensembl", mart = mart)
g

This workes. But I want to make a "for loop", so that getGene retrieves 
all my 3 id's in one go.. ive tried several "for loops", but I think I 
have trouble handeling the returning martTable-class.

So my question is:
Have anyone else managed to build a "for loop" of getGene, and is it 
doable with the returning martTable-class ?

best
morten



More information about the Bioconductor mailing list