Skip to contents

This function calls download.file to download the pre-build database file of cRegulome. Additionally, the function checks the validity of the pre-defined URL and whether the database file exists in the current working directory to avoid redownloading it. Typically, users would run this function once at the first time the use the package or to update the database to the latest version.

Usage

get_db(test = FALSE, destfile, ...)

Arguments

test

A logical, default FALSE. When TRUE downloads a database file with the same structure with a subset of the data for speed.

destfile

A character vector for the desired path for the database file. By default, when not specified, is constructed by using tempdir as a directory and the string cRegulome.db.gz

...

Optional arguments passed to download.file

Value

Downloads a compressed sqlite file to the current working directory. The file is named cRegulome.db.gz by default and it's not advised to change the name to avoid breaking the other functions that calls the database.

Examples

if (FALSE) { # \dontrun{
# download a test set of the database
get_db(test = TRUE)

# download the full database file
get_db(test = FALSE)
} # }

# load the test db file from shipped with the pacakge
db_file <- system.file("extdata", "cRegulome.db", package = "cRegulome")
file.info(db_file)
#>                                                                 size isdir mode
#> /usr/local/lib/R/site-library/cRegulome/extdata/cRegulome.db 1204224 FALSE  644
#>                                                                            mtime
#> /usr/local/lib/R/site-library/cRegulome/extdata/cRegulome.db 2024-09-18 06:15:06
#>                                                                            ctime
#> /usr/local/lib/R/site-library/cRegulome/extdata/cRegulome.db 2024-09-18 06:15:09
#>                                                                            atime
#> /usr/local/lib/R/site-library/cRegulome/extdata/cRegulome.db 2024-09-18 06:15:16
#>                                                              uid gid uname
#> /usr/local/lib/R/site-library/cRegulome/extdata/cRegulome.db   0   0  root
#>                                                              grname
#> /usr/local/lib/R/site-library/cRegulome/extdata/cRegulome.db   root