Download a remote file and cache it to re-use later

file_retrieve(
  url,
  bfc = recount3_cache(),
  verbose = getOption("recount3_verbose", TRUE)
)

Arguments

url

A character(1) with the file URL or the actual local path in which case, it won't be cached. If length(url) > 1 , this function will be used recursively.

bfc

A BiocFileCache-class object where the files will be cached to, typically created by recount3_cache().

verbose

A logical(1) indicating whether to show messages with updates.

Value

A character(1) with the path to the cached file.

See also

Other internal functions for accessing the recount3 data: annotation_ext(), create_rse_manual(), locate_url_ann(), locate_url(), project_homes(), read_counts(), read_metadata()

Examples


## Download the metadata file for project SRP009615
url_SRP009615_meta <- locate_url(
    "SRP009615",
    "data_sources/sra"
)
local_SRP009615_meta <- file_retrieve(
    url = url_SRP009615_meta
)
#> 2024-12-10 22:01:36.08779 caching file sra.sra.SRP009615.MD.gz.
#> 2024-12-10 22:01:36.542605 caching file sra.recount_project.SRP009615.MD.gz.
#> 2024-12-10 22:01:36.995848 caching file sra.recount_qc.SRP009615.MD.gz.
#> 2024-12-10 22:01:37.433981 caching file sra.recount_seq_qc.SRP009615.MD.gz.
#> 2024-12-10 22:01:37.858852 caching file sra.recount_pred.SRP009615.MD.gz.
local_SRP009615_meta
#>                                                           sra.sra.SRP009615.MD.gz 
#>             "/github/home/.cache/R/recount3/227e18ae2f4c_sra.sra.SRP009615.MD.gz" 
#>                                               sra.recount_project.SRP009615.MD.gz 
#> "/github/home/.cache/R/recount3/227e18d97a94_sra.recount_project.SRP009615.MD.gz" 
#>                                                    sra.recount_qc.SRP009615.MD.gz 
#>      "/github/home/.cache/R/recount3/227e42553808_sra.recount_qc.SRP009615.MD.gz" 
#>                                                sra.recount_seq_qc.SRP009615.MD.gz 
#>  "/github/home/.cache/R/recount3/227e474eb65b_sra.recount_seq_qc.SRP009615.MD.gz" 
#>                                                  sra.recount_pred.SRP009615.MD.gz 
#>    "/github/home/.cache/R/recount3/227e57a81614_sra.recount_pred.SRP009615.MD.gz" 

## Download the gene counts file for project SRP009615
url_SRP009615_gene <- locate_url(
    "SRP009615",
    "data_sources/sra",
    type = "gene"
)
local_SRP009615_gene <- file_retrieve(
    url = url_SRP009615_gene
)
#> 2024-12-10 22:01:38.311329 caching file sra.gene_sums.SRP009615.G026.gz.
local_SRP009615_gene
#>                                               sra.gene_sums.SRP009615.G026.gz 
#> "/github/home/.cache/R/recount3/227e2ae5d501_sra.gene_sums.SRP009615.G026.gz"