[BioC] "Testing" the connection of getBM() ?
Wolfgang Huber
huber at ebi.ac.uk
Wed Apr 8 18:00:33 CEST 2009
Dear Marion
thanks for the feedback.
Please have a look at the documentation of the biomaRt package (its
vignette, and the man page of the getBM function) where you can learn
that getBM supports vectorized queries, i.e. queries in which the
"values" argument of getBM has multiple elements per attribute. This
will be much faster and resource-efficient than the way you propose.
Note that the BioMart webservice that you are connecting to is a public
service that wants to be used by many people.
What is your rationale for calling 'martDisconnect(ensembl)' within your
'query' function?
Also, see "? tryCatch" for a general mechanism for catching errors
without stopping the interpreter.
Best wishes
Wolfgang
------------------------------------------------
Wolfgang Huber, EMBL, http://www.ebi.ac.uk/huber
G M wrote:
> Hi all,
>
> I'm currently trying to write a script allowing me to get some informations about several (actually about 18000 per file) sequence intervals. My query works, but I can't throw it all my file long.
>
> Basically, I throw my request with getBM as many as my file got lines, but after a while, the connection cuts, and i have this error message :
> Erreur dans postForm(paste(martHost(mart), "?", sep = ""), query = xmlQuery) :
> couldn't connect to host
>
> Is there a way to "test" the postForm method or the connection with biomaRt from R before throwing the request ?
>
> Here is my script :
>
>
> file="/myfile"
>
> chr=9
> db=useMart("ensembl")
> ensembl=useDataset("hsapiens_gene_ensembl",mart=db)
> filtres = c("chromosome_name","start","end")
> attributs = c("ensembl_gene_id","embl","description","start_position","end_position")
>
> data <- read.table(file, sep="\t", header=T)
>
> query <- function (chr,start, end) {
> valeurs = list(chr, start, end)
> genes=getBM(mart=ensembl, filters=filtres,values=valeurs,attributes=attributs)
> martDisconnect(ensembl)
> }
>
> genes=c()
>
> for(i in 1:nrow(data)){
>
> genes=query(chr,data[i,1],data[i,2])
>
> }
>
>
>
>
> Thanks for your help,
>
> Marion
>
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
More information about the Bioconductor
mailing list