Default function to download Gesel database files.

downloadDatabaseFile(
  name,
  url = databaseUrl(),
  cache = cacheDirectory(),
  overwrite = FALSE
)

databaseUrl(url = NULL)

Arguments

name

String containing the name of a Gesel database file. This usually has the species identifier as a prefix, e.g., "9606_set2gene.tsv.gz".

url

String containing the base URL to the Gesel database files.

cache

String specifying the path to a cache directory.

overwrite

Boolean indicating whether any cached file should be overwritten.

Value

downloadDatabaseFile returns a string containing a path to the downloaded file.

For databaseUrl, if url=NULL, the function returns a string containing the URL to the Gesel database. If url is provided, it instead stores url as the URL to the database, and the previous value of url is invisibly returned.

Details

The database URL defaults to the GitHub releases at https://github.com/LTLA/gesel-feedstock. This can be altered by setting the GESEL_DATABASE_URL environment variable prior to the first call to this function.

Author

Aaron Lun

Examples

# Download file.
downloadDatabaseFile("9606_collections.tsv.gz")
#> [1] "~/.cache/gesel/https%3A%2F%2Fgithub.com%2FLTLA%2Fgesel-feedstock%2Freleases%2Fdownload%2Findices-v0.2.1%2F9606_collections.tsv.gz"

# Altering the default database URL.
databaseUrl()
#> [1] "https://github.com/LTLA/gesel-feedstock/releases/download/indices-v0.2.1"
old <- databaseUrl("https://foo")
databaseUrl()
#> [1] "https://foo"
databaseUrl(old)