Axel Axel - 1 month ago 21
R Question

Using getSRAdbFile() yields sqlite error

I'm using Bioconductor's SRAdb package. Unfortunately, when trying to download the SRAdb I run into an error in sqliteSendQuery (see below).

Someone suggested to install the latest sqlite3 version. But the problem persists.

sqlFile <- getSRAdbFile()

--2016-04-27 16:08:52-- http://dl.dropbox.com/u/51653511/SRAmetadb.sqlite.gz
Resolving dl.dropbox.com (dl.dropbox.com)... 108.160.172.6
Connecting to dl.dropbox.com (dl.dropbox.com)|108.160.172.6|:80... connected.
HTTP request sent, awaiting response... 302 FOUND
Location: http://dl.dropboxusercontent.com/u/51653511/SRAmetadb.sqlite.gz [following]
--2016-04-27 16:08:52-- http://dl.dropboxusercontent.com/u/51653511/SRAmetadb.sqlite.gz
Resolving dl.dropboxusercontent.com (dl.dropboxusercontent.com)... 199.47.217.69
Connecting to dl.dropboxusercontent.com (dl.dropboxusercontent.com)|199.47.217.69|:80... connected.
HTTP request sent, awaiting response... 302 Moved
Location: http://10.137.251.101:15871/cgi-bin/blockpage.cgi?ws-session=4060338223 [following]
--2016-04-27 16:08:52-- http://10.137.251.101:15871/cgi-bin/blockpage.cgi?ws-session=4060338223
Connecting to 10.137.251.101:15871... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1513 (1.5K) [text/html]
Saving to: ‘SRAmetadb.sqlite.gz’

0K . 100% 208M=0s

2016-04-27 16:08:52 (208 MB/s) - ‘SRAmetadb.sqlite.gz’ saved [1513/1513]

Unzipping...

Error in sqliteSendQuery(con, statement, bind.data) :
error in statement: file is encrypted or is not a database
Error in sqliteSendQuery(con, statement, bind.data) :
error in statement: file is encrypted or is not a database


Here is the session info:

sessionInfo()

R version 3.2.3 (2015-12-10)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora 23 (Workstation Edition)

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] SRAdb_1.28.1 RCurl_1.95-4.8 bitops_1.0-6 graph_1.48.0 RSQLite_1.0.0 DBI_0.3.1

loaded via a namespace (and not attached):
[1] parallel_3.2.3 tools_3.2.3 GEOquery_2.36.0 Biobase_2.30.0 BiocGenerics_0.16.1
[6] stats4_3.2.3 XML_3.98-1.4

Answer

I think there's something wrong with getSRAdbFile(). It looks like the file wasn't downloaded properly:

0K .                                                     100%  208M=0s

2016-04-27 16:08:52 (208 MB/s) - ‘SRAmetadb.sqlite.gz’ saved [1513/1513]

I got things to work by downloading the file using the same url (http://dl.dropbox.com/u/51653511/SRAmetadb.sqlite.gz), with wget, unzipping with gzip, and then starting the connection like normal from within R.

To keep everything within R, you could use system2 or download.file with R.utils::gunzip.