[BioC] RSQLite and DB problems

James W. MacDonald jmacdon at uw.edu
Mon Sep 30 17:17:07 CEST 2013


Hi Assa,

On 9/30/2013 11:08 AM, Assa Yeroslaviz wrote:
> Hi,
>
> I did it again in a new session. I get the same results again. Here is 
> the complete output of the new session:
>
> Last login: Mon Sep 30 14:42:52 on ttys000
> USER-imac:~ USER$ R
>
> R version 3.0.1 (2013-05-16) -- "Good Sport"
> Copyright (C) 2013 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin10.8.0 (64-bit)
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
>   Natural language support but running in an English locale
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
> Warning: namespace ‘ggplot2’ is not available and has been replaced
> by .GlobalEnv when processing object ‘p’
> [Previously saved workspace restored]
>
> >
> >
> > library(biomaRt)
> > ensembl <- useMart("ensembl", dataset="hsapiens_gene_ensembl")
> > theIDs <- getBM(attributes="affy_huex_1_0_st_v2",
> + filters="entrezgene",values=10948, mart=ensembl)
> > names(theIDs) <- 'psets'
> > theIDs
>   psets    <NA>    <NA>    <NA> <NA>    <NA>    <NA> <NA>    <NA>    <NA>
> 3720380 3720356 3720363 3720372 3720377 3720358 3720375 3720344 
> 3720365 3720353
>    <NA>    <NA>    <NA> <NA>    <NA>    <NA> <NA>    <NA>    <NA>    <NA>
> 3720352 3720367 3720373 3720368 3720374 3720370 3720351 3720378 
> 3720355 3720371
>    <NA>    <NA>    <NA> <NA>    <NA>    <NA> <NA>    <NA>    <NA>    <NA>
> 3720369 3720360 3720357 3720362 3720364 3720359 3720361 3720354 
> 3720349 3720366
>    <NA>    <NA>
> 3720350 3720376

OK. I stand corrected, and I didn't closely look at your output last 
time. On linux you get a data.frame, but on lesser operating systems it 
appears you get a vector (I tried on Windows as well) ;-D

So you need a data.frame

theIDs <- data.frame(psets = theIDs)

Best,

Jim


> > sessionInfo()
> R version 3.0.1 (2013-05-16)
> Platform: x86_64-apple-darwin10.8.0 (64-bit)
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets methods   base
>
> other attached packages:
> [1] biomaRt_2.16.0
>
> loaded via a namespace (and not attached):
> [1] RCurl_1.95-4.1 XML_3.95-0.2
> >
> > str(theIDs)
>  Named int [1:32] 3720380 3720356 3720363 3720372 3720377 3720358 
> 3720375 3720344 3720365 3720353 ...
>  - attr(*, "names")= chr [1:32] "psets" NA NA NA ...
> >
>
> I do it the same in another terminal and got the same results.
> I don't get a data.frame as a result.
>
> Can someone explain it to me?
> Please,
>
>
> thanks for the help,
> Assa
>
>
> On Mon, Sep 30, 2013 at 5:00 PM, James W. MacDonald <jmacdon at uw.edu 
> <mailto:jmacdon at uw.edu>> wrote:
>
>     Hi Assa,
>
>
>     On Monday, September 30, 2013 9:23:17 AM, Assa Yeroslaviz wrote:
>
>         Hi,
>
>         I'm trying to work with the oligo package and the example
>         provided in the
>         pdf file to pre-processing exon arrays.
>
>         I'm following the commands given in the pdf but I get an error
>         massage when
>         trying to query my sqllite DB.
>
>         This is what I do:
>
>         library(biomaRt)
>         ensembl <- useMart("ensembl", dataset="hsapiens_gene_ensembl")
>         theIDs <- getBM(attributes="affy_huex_1_0_st_v2",
>         filters="entrezgene",values=10948, mart=ensembl)
>         names(theIDs) <- 'psets'
>
>
>     Well, I don't think that is actually what you have done, for two
>     reasons. Number 1, if you had really done so, you would not have
>     any NA values in your results (biomaRt won't return any NA values
>     for a query that has a single attribute - it will only return
>     values that do have a value). Number 2, getBM() returns a
>     data.frame, which isn't what you show below.
>
>     If I do what you say you did, I get this:
>
>         head(theIDs)
>
>        psets
>     1 3720380
>     2 3720356
>     3 3720363
>     4 3720372
>     5 3720377
>     6 3720358
>
>         any(is.na <http://is.na>(theIDs))
>
>     [1] FALSE
>
>     So try again, and if it still doesn't work let us know.
>
>     Best,
>
>     Jim
>
>
>
>             theIDs
>
>            psets    <NA>    <NA>    <NA>  <NA>    <NA>    <NA>    <NA>
>            <NA>
>         <NA>
>         3720380 3720356 3720363 3720372 3720377 3720358 3720375
>         3720344 3720365
>         3720353
>             <NA>    <NA>    <NA>  <NA>    <NA>    <NA>    <NA>    <NA>
>            <NA>
>         <NA>
>         3720352 3720367 3720373 3720368 3720374 3720370 3720351
>         3720378 3720355
>         3720371
>             <NA>    <NA>    <NA>  <NA>    <NA>    <NA>    <NA>    <NA>
>            <NA>
>         <NA>
>         3720369 3720360 3720357 3720362 3720364 3720359 3720361
>         3720354 3720349
>         3720366
>             <NA>    <NA>
>         3720350 3720376
>
>         conn <- db(affyExonFS)
>         fields <- 'meta_fsetid, pmfeature.fsetid, fid, start, stop'
>         tables <- 'featureSet, pmfeature, core_mps'
>         sql <- paste("SELECT", fields,
>         "FROM", tables,
>         "WHERE pmfeature.fsetid=featureSet.fsetid",
>         "AND featureSet.fsetid=core_mps.fsetid",
>         "AND pmfeature.fsetid=:psets")
>         probesetInfo <- dbGetPreparedQuery(conn, sql, theIDs)
>         probesetInfo <- dbGetPreparedQuery(conn, sql,
>         as.data.frame(theIDs))
>
>         But when I tried this I get the following error massage:
>
>         *Error in (function (classes, fdef, mtable)  :
>            unable to find an inherited method for function
>         ‘dbGetPreparedQuery’ for
>         signature ‘"SQLiteConnection", "character", "integer"’
>
>         *
>
>         Can anyone explain to me where this error is coming from? Is
>         it a problem
>         with the sqlite connection?
>
>         thanks
>         Assa
>
>                 [[alternative HTML version deleted]]
>
>
>
>         _______________________________________________
>         Bioconductor mailing list
>         Bioconductor at r-project.org <mailto:Bioconductor at r-project.org>
>         https://stat.ethz.ch/mailman/listinfo/bioconductor
>         Search the archives:
>         http://news.gmane.org/gmane.science.biology.informatics.conductor
>
>
>     --
>     James W. MacDonald, M.S.
>     Biostatistician
>     University of Washington
>     Environmental and Occupational Health Sciences
>     4225 Roosevelt Way NE, # 100
>     Seattle WA 98105-6099
>
>

-- 
James W. MacDonald, M.S.
Biostatistician
University of Washington
Environmental and Occupational Health Sciences
4225 Roosevelt Way NE, # 100
Seattle WA 98105-6099



More information about the Bioconductor mailing list