Default function to download Gesel gene description files.

downloadGeneFile(name, url = geneUrl(), cache = NULL, overwrite = FALSE)

geneUrl(url)

Arguments

name

String containing the name of the file, typically of the form <species>_<type>.tsv.gz, e.g., "9606_symbol.tsv.gz".

url

String containing the base URL to the Gesel gene descriptions. For geneUrl, this can be NULL to set it back to the default.

cache

String specifying the path to a cache directory. If NULL, a cache location is automatically chosen.

overwrite

Logical scalar indicating whether any cached file should be overwritten.

Value

downloadGeneFile returns a string containing a local path to the downloaded file.

For geneUrl, if url is missing, the function returns a string containing the URL to the Gesel gene descriptions. If url is provided, it instead stores url as the URL to the indices, and the previous value of url is invisibly returned.

Details

The default gene URL is set to the GitHub releases at https://github.com/LTLA/gesel-feedstock. This can be altered by setting the GESEL_GENE_URL environment variable.

On first use of a cached file in an R session, downloadGeneFile will automatically check for updates at url. If the file on the remote has been updated, the new copy will be downloaded to the cache.

Author

Aaron Lun

Examples

# Download file.
downloadGeneFile("9606_symbol.tsv.gz")
#> [1] "~/.cache/gesel/https%3A%2F%2Fgithub.com%2FLTLA%2Fgesel-feedstock%2Freleases%2Fdownload%2Fgenes-v1.0.0%2F9606_symbol.tsv.gz"

# Altering the default gene URL.
geneUrl()
#> [1] "https://github.com/LTLA/gesel-feedstock/releases/download/genes-v1.0.0"
old <- geneUrl("https://foo")
geneUrl()
#> [1] "https://foo"
geneUrl(old)