# ReUseData: Reusable and Reproducible Data Management

Qian Liu, Qiang Hu, Song Liu, Alan Hutson, Martin Morgan1

1Roswell Park Comprehensive Cancer Center

#### 2023-04-25

`ReUseData` provides functionalities to construct workflow-based data recipes for fully tracked and reproducible data processing. Evaluation of data recipes generates curated data resources in their generic formats (e.g., VCF, bed), as well as a YAML manifest file recording the recipe parameters, data annotations, and data file paths for subsequent reuse. The datasets are locally cached using a database infrastructure, where updating and searching of specific data is made easy.

The data reusability is assured through cloud hosting and enhanced interoperability with downstream software tools or analysis workflows. The workflow strategy enables cross platform reproducibility of curated data resources.

# 1 Installation

1. Install the package from Bioconductor.

    if (!requireNamespace("BiocManager", quietly = TRUE))
        install.packages("BiocManager")
    BiocManager::install("ReUseData")

Use the development version:

    BiocManager::install("ReUseData", version = "devel")

2. Load the package and other packages used in this vignette into the R session.

    suppressPackageStartupMessages(library(Rcwl))
    library(ReUseData)

# 2 `ReUseData` core functions for data management

Here we introduce the core functions of `ReUseData` for data management and reuse: `getData` for reproducible data generation, `dataUpdate` for syncing and updating data cache, and `dataSearch` for multi-keywords searching of dataset of interest.

## 2.1 Data generation

First, we can construct data recipes by transforming shell or other ad hoc data preprocessing scripts into workflow-based data recipes. Some prebuilt data recipes for public data resources (e.g., downloading, unzipping and indexing) are available for direct use through `recipeSearch` and `recipeLoad` functions. Then we will assign values to the input parameters and evaluate the recipe to generate data of interest.

    recipeUpdate()
    #> Updating recipes...
    #>
    #> recipeHub with 15 records
    #> cache path:  /home/biocbuild/.cache/R/ReUseDataRecipe
    #> # recipeSearch() to query specific recipes using multipe keywords
    #> # recipeUpdate() to update the local recipe cache
    #>
    #>             name
    #>   BFC3331 | STAR_index
    #>   BFC3332 | bowtie2_index
    #>   BFC3333 | echo_out
    #>   BFC3334 | ensembl_liftover
    #>   BFC3335 | gcp_broad_gatk_hg19
    #>   ...       ...
    #>   BFC3341 | gencode_transcripts
    #>   BFC3342 | hisat2_index
    #>   BFC3343 | reference_genome
    #>   BFC3344 | salmon_index
    #>   BFC3345 | ucsc_database
    recipeSearch("echo")
    #> recipeHub with 1 records
    #> cache path:  /home/biocbuild/.cache/R/ReUseDataRecipe
    #> # recipeSearch() to query specific recipes using multipe keywords
    #> # recipeUpdate() to update the local recipe cache
    #>
    #>             name
    #>   BFC3333 | echo_out
    echo_out <- recipeLoad("echo_out")
    #> Note: you need to assign a name for the recipe: rcpName <- recipeLoad('xx')
    #> Data recipe loaded!
    #> Use inputs() to check required input parameters before evaluation.
    #> Check here: https://rcwl.org/dataRecipes/echo_out.html
    #> for user instructions (e.g., eligible input values, data source, etc.)
    inputs(echo_out)
    #> inputs:
    #>   input (input)  (string):
    #>   outfile (outfile)  (string):

Users can then assign values to the input parameters, and evaluate the recipe (`getData`) to generate data of interest. Users need to specify an output directory for all files (desired data file, intermediate files that are internally generated as workflow scripts or annotation files). Detailed notes for the data is encouraged which will be used for keywords matching for later data search.

    echo_out$input <- "Hello World!"
    echo_out$outfile <- "outfile"
    outdir <- file.path(tempdir(), "SharedData")
    res <- getData(echo_out,
                   outdir = outdir,
                   notes = c("echo", "hello", "world", "txt"))
    #> [1;30mINFO[0m Final process status is success

The file path to newly generated dataset can be easily retrieved. It can also be retrieved using `dataSearch()` functions with multiple keywords. Before that, `dataUpdate()` needs to be done.

    res$output
    #> [1] "/tmp/Rtmp0ZLHwn/SharedData/outfile.txt"

There are some automatically generated files to help track the data recipe evaluation, including `*.sh` to record the original shell script, `*.cwl` file as the official workflow script which was internally submitted for data recipe evaluation, `*.yml` file as part of CWL workflow evaluation, which also record data annotations, and `*.md5` checksum file to check/verify the integrity of generated data file.

    list.files(outdir, pattern = "echo")
    #> [1] "echo_out_Hello_World!_outfile.cwl" "echo_out_Hello_World!_outfile.md5"
    #> [3] "echo_out_Hello_World!_outfile.sh"  "echo_out_Hello_World!_outfile.yml"

The `*.yml` file contains information about recipe input parameters, the file path to output file, the notes for the dataset, and auto-added date for data generation time. A later data search using `dataSearch()` will refer to this file for keywords match.

    readLines(res$yml)
    #> [1] "input: Hello World!"
    #> [2] "outfile: outfile"
    #> [3] "# output: /tmp/Rtmp0ZLHwn/SharedData/outfile.txt"
    #> [4] "# notes: echo hello world txt"
    #> [5] "# date: 2023-04-25 18:25:50.207455"

## 2.2 Data caching, updating and searching

`dataUpdate()` creates (if first time use), syncs and updates the local cache for curated datasets. It finds and reads all the `.yml` files recursively in the provided data folder, creates a cache record for each dataset that is associated (including newly generated ones with `getData()`), and updates the local cache for later data searching and reuse.

IMPORTANT: It is recommended that users create a specified folder for data archival (e.g., `file/path/to/SharedData`) that other group members have access to, and use sub-folders for different kinds of datasets (e.g., those generated from same recipe).

    (dh <- dataUpdate(dir = outdir))
    #>
    #> Updating data record...
    #> outfile.txt added
    #> dataHub with 1 records
    #> cache path:  /home/biocbuild/.cache/R/ReUseData
    #> # dataUpdate() to update the local data cache
    #> # dataSearch() to query a specific dataset
    #> # Additional information can be retrieved using:
    #> # dataNames(), dataParams(), dataNotes(), dataPaths(), dataTag() or mcols()
    #>
    #>              name        Path
    #>   BFC38659 | outfile.txt /tmp/Rtmp0ZLHwn/SharedData/outfile.txt

`dataUpdate` and `dataSearch` return a `dataHub` object with a list of all available or matching datasets.

One can subset the list with `[` and use getter functions to retrieve the annotation information about the data, e.g., data names, parameters values to the recipe, notes, tags, and the corresponding yaml file.

    dh[1]
    #> dataHub with 1 records
    #> cache path:  /home/biocbuild/.cache/R/ReUseData
    #> # dataUpdate() to update the local data cache
    #> # dataSearch() to query a specific dataset
    #> # Additional information can be retrieved using:
    #> # dataNames(), dataParams(), dataNotes(), dataPaths(), dataTag() or mcols()
    #>
    #>              name        Path
    #>   BFC38659 | outfile.txt /tmp/Rtmp0ZLHwn/SharedData/outfile.txt
    ## dh["BFC1"]
    dh[dataNames(dh) == "outfile.txt"]
    #> dataHub with 1 records
    #> cache path:  /home/biocbuild/.cache/R/ReUseData
    #> # dataUpdate() to update the local data cache
    #> # dataSearch() to query a specific dataset
    #> # Additional information can be retrieved using:
    #> # dataNames(), dataParams(), dataNotes(), dataPaths(), dataTag() or mcols()
    #>
    #>              name        Path
    #>   BFC38659 | outfile.txt /tmp/Rtmp0ZLHwn/SharedData/outfile.txt
    dataNames(dh)
    #> [1] "outfile.txt"
    dataParams(dh)
    #> [1] "input: Hello World!; outfile: outfile"
    dataNotes(dh)
    #> [1] "echo hello world txt"
    dataTags(dh)
    #> [1] ""
    dataYml(dh)
    #> [1] "/tmp/Rtmp0ZLHwn/SharedData/echo_out_Hello_World!_outfile.yml"

`ReUseData`, as the name suggests, commits to promoting the data reuse. Data can be prepared in standard input formats (`toList`), e.g., YAML and JSON, to be easily integrated in workflow methods that are locally or cloud-hosted.

    (dh1 <- dataSearch(c("echo", "hello", "world")))
    #> dataHub with 1 records
    #> cache path:  /home/biocbuild/.cache/R/ReUseData
    #> # dataUpdate() to update the local data cache
    #> # dataSearch() to query a specific dataset
    #> # Additional information can be retrieved using:
    #> # dataNames(), dataParams(), dataNotes(), dataPaths(), dataTag() or mcols()
    #>
    #>              name        Path
    #>   BFC38659 | outfile.txt /tmp/Rtmp0ZLHwn/SharedData/outfile.txt
    toList(dh1)
    #> $outfile.txt
    #> [1] "/tmp/Rtmp0ZLHwn/SharedData/outfile.txt"
    toList(dh1, format = "yaml")
    #> [1] "outfile.txt: /tmp/Rtmp0ZLHwn/SharedData/outfile.txt"
    toList(dh1, format = "json", file = file.path(tempdir(), "data.json"))
    #> File is saved as: "/tmp/Rtmp0ZLHwn/data.json"
    #> {
    #>   "outfile.txt": "/tmp/Rtmp0ZLHwn/SharedData/outfile.txt"
    #> }

Data can also be aggregated from different resources by tagging with specific software tools.

    dataSearch()
    #> dataHub with 1 records
    #> cache path:  /home/biocbuild/.cache/R/ReUseData
    #> # dataUpdate() to update the local data cache
    #> # dataSearch() to query a specific dataset
    #> # Additional information can be retrieved using:
    #> # dataNames(), dataParams(), dataNotes(), dataPaths(), dataTag() or mcols()
    #>
    #>              name        Path
    #>   BFC38659 | outfile.txt /tmp/Rtmp0ZLHwn/SharedData/outfile.txt
    dataTags(dh[1]) <- "#gatk"
    dataSearch("#gatk")
    #> dataHub with 1 records
    #> cache path:  /home/biocbuild/.cache/R/ReUseData
    #> # dataUpdate() to update the local data cache
    #> # dataSearch() to query a specific dataset
    #> # Additional information can be retrieved using:
    #> # dataNames(), dataParams(), dataNotes(), dataPaths(), dataTag() or mcols()
    #>
    #>              name        Path
    #>   BFC38659 | outfile.txt /tmp/Rtmp0ZLHwn/SharedData/outfile.txt

NOTE: if the argument `cloud=TRUE` is enabled, `dataUpdate()` will also cache the pregenerated data sets (from evaluation of public ReUseData recipes) that are available on ReUseData google bucket and return in the `dataHub` object that are fully searchable. Please see the following section for details.

# 3 Cloud data resources

With the prebuilt data recipes for curation (e.g., downloading, unzipping, indexing) of commonly used public data resources we have pregenerated some data sets and put them on the cloud space for direct use.

Before searching, one need to use `dataUpdate(cloud=TRUE)` to sync the existing data sets on cloud, then `dataSearch()` can be used to search any available data set either in local cache and on the cloud.

    gcpdir <- file.path(tempdir(), "gcpData")
    dataUpdate(gcpdir, cloud=TRUE)
    #>
    #> Updating data record...
    #> 1d01161f5960af_GRCh38.primary_assembly.genome.fa.1.bt2 added
    #> 1d01166a72dac8_GRCh38.primary_assembly.genome.fa.2.bt2 added
    #> 1d01162da8bc58_GRCh38.primary_assembly.genome.fa.3.bt2 added
    #> 1d0116d714215_GRCh38.primary_assembly.genome.fa.4.bt2 added
    #> 1d0116667b0cbb_GRCh38.primary_assembly.genome.fa.rev.1.bt2 added
    #> 1d011644017ed8_GRCh38.primary_assembly.genome.fa.rev.2.bt2 added
    #> 1d01164dd05530_outfile.txt added
    #> 1d011676da26be_GRCh37_to_GRCh38.chain added
    #> 1d01161de86325_GRCh37_to_NCBI34.chain added
    #> 1d011677045d91_GRCh37_to_NCBI35.chain added
    #> 1d01166c473db7_GRCh37_to_NCBI36.chain added
    #> 1d01165f2f6ae3_GRCh38_to_GRCh37.chain added
    #> 1d0116462dff44_GRCh38_to_NCBI34.chain added
    #> 1d011656758e6e_GRCh38_to_NCBI35.chain added
    #> 1d0116325c89a0_GRCh38_to_NCBI36.chain added
    #> 1d01166c47057a_NCBI34_to_GRCh37.chain added
    #> 1d01167e7c1363_NCBI34_to_GRCh38.chain added
    #> 1d0116211bfc78_NCBI35_to_GRCh37.chain added
    #> 1d0116330e1b5d_NCBI35_to_GRCh38.chain added
    #> 1d0116535044a7_NCBI36_to_GRCh37.chain added
    #> 1d01162c29c137_NCBI36_to_GRCh38.chain added
    #> 1d011618b9bbee_GRCm38_to_NCBIM36.chain added
    #> 1d01164949b517_GRCm38_to_NCBIM37.chain added
    #> 1d01163acd5382_NCBIM36_to_GRCm38.chain added
    #> 1d01161c7e8f6b_NCBIM37_to_GRCm38.chain added
    #> 1d0116333a568b_1000G_omni2.5.b37.vcf.gz added
    #> 1d011659bba147_1000G_omni2.5.b37.vcf.gz.tbi added
    #> 1d01166bbc5f75_Mills_and_1000G_gold_standard.indels.b37.vcf.gz added
    #> 1d01164c07fe9a_Mills_and_1000G_gold_standard.indels.b37.vcf.gz.tbi added
    #> 1d011664f5ea00_1000G_omni2.5.hg38.vcf.gz added
    #> 1d01164a15146_1000G_omni2.5.hg38.vcf.gz.tbi added
    #> 1d01166b615f4a_Mills_and_1000G_gold_standard.indels.hg38.vcf.gz added
    #> 1d01164f68c4c8_Mills_and_1000G_gold_standard.indels.hg38.vcf.gz.tbi added
    #> 1d0116324a0d9e_af-only-gnomad.raw.sites.vcf added
    #> 1d011678d2a15f_af-only-gnomad.raw.sites.vcf.idx added
    #> 1d011635e3d184_Mutect2-exome-panel.vcf.idx added
    #> 1d0116764b8c76_Mutect2-WGS-panel-b37.vcf added
    #> 1d011646a2f68f_Mutect2-WGS-panel-b37.vcf.idx added
    #> 1d01162cbdf842_small_exac_common_3.vcf added
    #> 1d01161433ef9b_small_exac_common_3.vcf.idx added
    #> 1d01163da75420_1000g_pon.hg38.vcf.gz added
    #> 1d0116190535fa_1000g_pon.hg38.vcf.gz.tbi added
    #> 1d011673635a7f_af-only-gnomad.hg38.vcf.gz added
    #> 1d01163d55365_af-only-gnomad.hg38.vcf.gz.tbi added
    #> 1d01166f7ac468_small_exac_common_3.hg38.vcf.gz added
    #> 1d011625bfe41f_small_exac_common_3.hg38.vcf.gz.tbi added
    #> 1d0116701c58df_gencode.v41.annotation.gtf added
    #> 1d01166df6d7cb_gencode.v42.annotation.gtf added
    #> 1d011646dbe097_gencode.vM30.annotation.gtf added
    #> 1d0116232a743c_gencode.vM31.annotation.gtf added
    #> 1d011641471c73_gencode.v41.transcripts.fa added
    #> 1d01167305a1ce_gencode.v41.transcripts.fa.fai added
    #> 1d01163be4302a_gencode.v42.transcripts.fa added
    #> 1d0116a90d18a_gencode.v42.transcripts.fa.fai added
    #> 1d01162dd2f550_gencode.vM30.pc_transcripts.fa added
    #> 1d01165862bf95_gencode.vM30.pc_transcripts.fa.fai added
    #> 1d01163dcb2815_gencode.vM31.pc_transcripts.fa added
    #> 1d011678e9697_gencode.vM31.pc_transcripts.fa.fai added
    #> 1d0116441f1f0a_GRCh38.primary_assembly.genome.fa.1.ht2 added
    #> 1d01169d326b0_GRCh38.primary_assembly.genome.fa.2.ht2 added
    #> 1d01166c848098_GRCh38.primary_assembly.genome.fa.3.ht2 added
    #> 1d011648c07050_GRCh38.primary_assembly.genome.fa.4.ht2 added
    #> 1d0116753485fa_GRCh38.primary_assembly.genome.fa.5.ht2 added
    #> 1d01163bed4560_GRCh38.primary_assembly.genome.fa.6.ht2 added
    #> 1d01167b0a7dee_GRCh38.primary_assembly.genome.fa.7.ht2 added
    #> 1d01166e072759_GRCh38.primary_assembly.genome.fa.8.ht2 added
    #> 1d011671d116e4_GRCh38_full_analysis_set_plus_decoy_hla.fa.fai added
    #> 1d011671560a64_GRCh38_full_analysis_set_plus_decoy_hla.fa.amb added
    #> 1d011634aa1de8_GRCh38_full_analysis_set_plus_decoy_hla.fa.ann added
    #> 1d01161e8f0f27_GRCh38_full_analysis_set_plus_decoy_hla.fa.bwt added
    #> 1d0116589fa00_GRCh38_full_analysis_set_plus_decoy_hla.fa.pac added
    #> 1d011672517208_GRCh38_full_analysis_set_plus_decoy_hla.fa.sa added
    #> 1d011637944521_GRCh38_full_analysis_set_plus_decoy_hla.fa added
    #> 1d011678ed547f_GRCh38.primary_assembly.genome.fa.fai added
    #> 1d01167626c56d_GRCh38.primary_assembly.genome.fa.amb added
    #> 1d0116270f0989_GRCh38.primary_assembly.genome.fa.ann added
    #> 1d01161ead389e_GRCh38.primary_assembly.genome.fa.bwt added
    #> 1d011666431e4d_GRCh38.primary_assembly.genome.fa.pac added
    #> 1d01161505e154_GRCh38.primary_assembly.genome.fa.sa added
    #> 1d011665891936_GRCh38.primary_assembly.genome.fa added
    #> 1d011696d9289_hs37d5.fa.fai added
    #> 1d0116564cfdc7_hs37d5.fa.amb added
    #> 1d0116588ebb04_hs37d5.fa.ann added
    #> 1d01164551c2b4_hs37d5.fa.bwt added
    #> 1d011660ddcf51_hs37d5.fa.pac added
    #> 1d0116661b055_hs37d5.fa.sa added
    #> 1d01161db48249_hs37d5.fa added
    #> 1d01161ea8f767_complete_ref_lens.bin added
    #> 1d0116df046ec_ctable.bin added
    #> 1d011661d3a154_ctg_offsets.bin added
    #> 1d0116287c1e17_duplicate_clusters.tsv added
    #> 1d01167a74c784_info.json added
    #> 1d01162a9411a4_mphf.bin added
    #> 1d01161db0a411_pos.bin added
    #> 1d011636620ce5_pre_indexing.log added
    #> 1d0116259e8f93_rank.bin added
    #> 1d0116bb7cb6a_ref_indexing.log added
    #> 1d0116283323c9_refAccumLengths.bin added
    #> 1d011616f499f7_reflengths.bin added
    #> 1d01164061e952_refseq.bin added
    #> 1d011646c232f0_seq.bin added
    #> 1d01161c7e93f7_versionInfo.json added
    #> 1d011632b35b5a_salmon_index added
    #> 1d01167e567811_chrLength.txt added
    #> 1d0116156be876_chrName.txt added
    #> 1d011628da20c8_chrNameLength.txt added
    #> 1d01162565819a_chrStart.txt added
    #> 1d011634192115_exonGeTrInfo.tab added
    #> 1d0116f1d3f15_exonInfo.tab added
    #> 1d01163a6b62ef_geneInfo.tab added
    #> 1d011619a23a4b_Genome added
    #> 1d0116188ad19e_genomeParameters.txt added
    #> 1d011610b860b6_Log.out added
    #> 1d01167230f54f_SA added
    #> 1d01165ddc9452_SAindex added
    #> 1d011671963008_sjdbInfo.txt added
    #> 1d01167892a5a4_sjdbList.fromGTF.out.tab added
    #> 1d01167b91169c_sjdbList.out.tab added
    #> 1d0116103f276f_transcriptInfo.tab added
    #> 1d0116682ec91_GRCh38.GENCODE.v42_100 added
    #> 1d01165d64b7f0_knownGene_hg38.sql added
    #> 1d011638bb4586_knownGene_hg38.txt added
    #> 1d0116f7b415_refGene_hg38.sql added
    #> 1d01167f8c994_refGene_hg38.txt added
    #> 1d0116566be997_knownGene_mm39.sql added
    #> 1d01163759c0fa_knownGene_mm39.txt added
    #> 1d01162d975927_refGene_mm39.sql added
    #> 1d01166223b501_refGene_mm39.txt added
    #> dataHub with 128 records
    #> cache path:  /home/biocbuild/.cache/R/ReUseData
    #> # dataUpdate() to update the local data cache
    #> # dataSearch() to query a specific dataset
    #> # Additional information can be retrieved using:
    #> # dataNames(), dataParams(), dataNotes(), dataPaths(), dataTag() or mcols()
    #>
    #>              name
    #>   BFC38660 | GRCh38.primary_assembly.genome.fa.1.bt2
    #>   BFC38661 | GRCh38.primary_assembly.genome.fa.2.bt2
    #>   BFC38662 | GRCh38.primary_assembly.genome.fa.3.bt2
    #>   BFC38663 | GRCh38.primary_assembly.genome.fa.4.bt2
    #>   BFC38664 | GRCh38.primary_assembly.genome.fa.rev.1.bt2
    #>   ...        ...
    #>   BFC38783 | refGene_hg38.txt
    #>   BFC38784 | knownGene_mm39.sql
    #>   BFC38785 | knownGene_mm39.txt
    #>   BFC38786 | refGene_mm39.sql
    #>   BFC38787 | refGene_mm39.txt
    #>            Path
    #>   BFC38660 https://storage.googleapis.com/reusedata/bowtie2_index/GRCh38.pr...
    #>   BFC38661 https://storage.googleapis.com/reusedata/bowtie2_index/GRCh38.pr...
    #>   BFC38662 https://storage.googleapis.com/reusedata/bowtie2_index/GRCh38.pr...
    #>   BFC38663 https://storage.googleapis.com/reusedata/bowtie2_index/GRCh38.pr...
    #>   BFC38664 https://storage.googleapis.com/reusedata/bowtie2_index/GRCh38.pr...
    #>   ...      ...
    #>   BFC38783 https://storage.googleapis.com/reusedata/ucsc_database/refGene_h...
    #>   BFC38784 https://storage.googleapis.com/reusedata/ucsc_database/knownGene...
    #>   BFC38785 https://storage.googleapis.com/reusedata/ucsc_database/knownGene...
    #>   BFC38786 https://storage.googleapis.com/reusedata/ucsc_database/refGene_m...
    #>   BFC38787 https://storage.googleapis.com/reusedata/ucsc_database/refGene_m...

If the data of interest already exist on the cloud, then `getCloudData` will directly download the data to your computer. Add it to the local caching system using `dataUpdate()` for later use.

    (dh <- dataSearch(c("ensembl", "GRCh38")))
    #> dataHub with 8 records
    #> cache path:  /home/biocbuild/.cache/R/ReUseData
    #> # dataUpdate() to update the local data cache
    #> # dataSearch() to query a specific dataset
    #> # Additional information can be retrieved using:
    #> # dataNames(), dataParams(), dataNotes(), dataPaths(), dataTag() or mcols()
    #>
    #>              name
    #>   BFC38667 | GRCh37_to_GRCh38.chain
    #>   BFC38671 | GRCh38_to_GRCh37.chain
    #>   BFC38672 | GRCh38_to_NCBI34.chain
    #>   BFC38673 | GRCh38_to_NCBI35.chain
    #>   BFC38674 | GRCh38_to_NCBI36.chain
    #>   BFC38676 | NCBI34_to_GRCh38.chain
    #>   BFC38678 | NCBI35_to_GRCh38.chain
    #>   BFC38680 | NCBI36_to_GRCh38.chain
    #>            Path
    #>   BFC38667 https://storage.googleapis.com/reusedata/ensembl_liftover/GRCh37...
    #>   BFC38671 https://storage.googleapis.com/reusedata/ensembl_liftover/GRCh38...
    #>   BFC38672 https://storage.googleapis.com/reusedata/ensembl_liftover/GRCh38...
    #>   BFC38673 https://storage.googleapis.com/reusedata/ensembl_liftover/GRCh38...
    #>   BFC38674 https://storage.googleapis.com/reusedata/ensembl_liftover/GRCh38...
    #>   BFC38676 https://storage.googleapis.com/reusedata/ensembl_liftover/NCBI34...
    #>   BFC38678 https://storage.googleapis.com/reusedata/ensembl_liftover/NCBI35...
    #>   BFC38680 https://storage.googleapis.com/reusedata/ensembl_liftover/NCBI36...
    getCloudData(dh[1], outdir = gcpdir)
    #> Data is downloaded:
    #> /tmp/Rtmp0ZLHwn/gcpData/GRCh37_to_GRCh38.chain

Now we create the data cache with only local data files, and we can see that the downloaded data is available.

    dataUpdate(gcpdir)  ## Update local data cache (without cloud data)
    #>
    #> Updating data record...
    #> GRCh37_to_GRCh38.chain added
    #> Warning in dm$tag[idx] <- value: number of items to replace is not a multiple
    #> of replacement length
    #> dataHub with 1 records
    #> cache path:  /home/biocbuild/.cache/R/ReUseData
    #> # dataUpdate() to update the local data cache
    #> # dataSearch() to query a specific dataset
    #> # Additional information can be retrieved using:
    #> # dataNames(), dataParams(), dataNotes(), dataPaths(), dataTag() or mcols()
    #>
    #>              name
    #>   BFC38788 | GRCh37_to_GRCh38.chain
    #>            Path
    #>   BFC38788 /tmp/Rtmp0ZLHwn/gcpData/GRCh37_to_GRCh38.chain
    dataSearch()  ## data is available locally!!!
    #> dataHub with 1 records
    #> cache path:  /home/biocbuild/.cache/R/ReUseData
    #> # dataUpdate() to update the local data cache
    #> # dataSearch() to query a specific dataset
    #> # Additional information can be retrieved using:
    #> # dataNames(), dataParams(), dataNotes(), dataPaths(), dataTag() or mcols()
    #>
    #>              name
    #>   BFC38788 | GRCh37_to_GRCh38.chain
    #>            Path
    #>   BFC38788 /tmp/Rtmp0ZLHwn/gcpData/GRCh37_to_GRCh38.chain

The data supports user-friendly discovery and access through the `ReUseData` portal, where detailed instructions are provided for straight-forward incorporation into data analysis pipelines run on local computing nodes, web resources, and cloud computing platforms (e.g., Terra, CGC).

# 4 Know your data

Here we provide a function `meta_data()` to create a data frame that contains all information about the data sets in the specified file path (recursively), including the annotation file (`$yml` column), parameter values for the recipe (`$params` column), data file path (`$output` column), keywords for data file (`notes` columns), date of data generation (`date` column), and any tag if available (`tag` column).

Use `cleanup = TRUE` to cleanup any invalid or expired/older intermediate files.

    mt <- meta_data(outdir)
    head(mt)
    #>                                                            yml
    #> 1 /tmp/Rtmp0ZLHwn/SharedData/echo_out_Hello_World!_outfile.yml
    #>                                  params                                 output
    #> 1 input: Hello World!; outfile: outfile /tmp/Rtmp0ZLHwn/SharedData/outfile.txt
    #>                  notes                       date
    #> 1 echo hello world txt 2023-04-25 18:25:50.207455

# 5 SessionInfo

    sessionInfo()
    #> R version 4.3.0 RC (2023-04-13 r84269)
    #> Platform: x86_64-pc-linux-gnu (64-bit)
    #> Running under: Ubuntu 22.04.2 LTS
    #>
    #> Matrix products: default
    #> BLAS:   /home/biocbuild/bbs-3.17-bioc/R/lib/libRblas.so
    #> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
    #>
    #> locale:
    #>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
    #>  [3] LC_TIME=en_GB              LC_COLLATE=C
    #>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
    #>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
    #>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
    #> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
    #>
    #> time zone: America/New_York
    #> tzcode source: system (glibc)
    #>
    #> attached base packages:
    #> [1] stats4    stats     graphics  grDevices utils     datasets  methods
    #> [8] base
    #>
    #> other attached packages:
    #> [1] ReUseData_1.0.0     Rcwl_1.16.0         S4Vectors_0.38.0
    #> [4] BiocGenerics_0.46.0 yaml_2.3.7          BiocStyle_2.28.0
    #>
    #> loaded via a namespace (and not attached):
    #>  [1] tidyselect_1.2.0      dplyr_1.1.2           blob_1.2.4
    #>  [4] filelock_1.0.2        R.utils_2.12.2        fastmap_1.1.1
    #>  [7] BiocFileCache_2.8.0   promises_1.2.0.1      digest_0.6.31
    #> [10] base64url_1.4         mime_0.12             lifecycle_1.0.3
    #> [13] ellipsis_0.3.2        RSQLite_2.3.1         magrittr_2.0.3
    #> [16] compiler_4.3.0        rlang_1.1.0           sass_0.4.5
    #> [19] progress_1.2.2        tools_4.3.0           utf8_1.2.3
    #> [22] data.table_1.14.8     knitr_1.42            prettyunits_1.1.1
    #> [25] brew_1.0-8            htmlwidgets_1.6.2     bit_4.0.5
    #> [28] curl_5.0.0            reticulate_1.28       RColorBrewer_1.1-3
    #> [31] batchtools_0.9.17     BiocParallel_1.34.0   purrr_1.0.1
    #> [34] withr_2.5.0           R.oo_1.25.0           grid_4.3.0
    #> [37] fansi_1.0.4           git2r_0.32.0          xtable_1.8-4
    #> [40] debugme_1.1.0         cli_3.6.1             rmarkdown_2.21
    #> [43] DiagrammeR_1.0.9      crayon_1.5.2          generics_0.1.3
    #> [46] httr_1.4.5            visNetwork_2.1.2      DBI_1.1.3
    #> [49] cachem_1.0.7          parallel_4.3.0        BiocManager_1.30.20
    #> [52] basilisk_1.12.0       vctrs_0.6.2           Matrix_1.5-4
    #> [55] jsonlite_1.8.4        dir.expiry_1.8.0      bookdown_0.33
    #> [58] hms_1.1.3             bit64_4.0.5           jquerylib_0.1.4
    #> [61] RcwlPipelines_1.16.0  glue_1.6.2            codetools_0.2-19
    #> [64] stringi_1.7.12        later_1.3.0           tibble_3.2.1
    #> [67] pillar_1.9.0          basilisk.utils_1.12.0 rappdirs_0.3.3
    #> [70] htmltools_0.5.5       R6_2.5.1              dbplyr_2.3.2
    #> [73] evaluate_0.20         shiny_1.7.4           lattice_0.21-8
    #> [76] R.methodsS3_1.8.2     png_0.1-8             backports_1.4.1
    #> [79] memoise_2.0.1         httpuv_1.6.9          bslib_0.4.2
    #> [82] Rcpp_1.0.10           checkmate_2.1.0       xfun_0.39
    #> [85] pkgconfig_2.0.3