# ReUseData: Reusable and Reproducible Data Management

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

1Roswell Park Comprehensive Cancer Center

#### 2024-10-29

`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.

    ## set cache in tempdir for test
    Sys.setenv(cachePath = file.path(tempdir(), "cache"))

    recipeUpdate()
    #> Updating recipes...
    #> STAR_index.R added
    #> bowtie2_index.R added
    #> echo_out.R added
    #> ensembl_liftover.R added
    #> gcp_broad_gatk_hg19.R added
    #> gcp_broad_gatk_hg38.R added
    #> gcp_gatk_mutect2_b37.R added
    #> gcp_gatk_mutect2_hg38.R added
    #> gencode_annotation.R added
    #> gencode_genome_grch38.R added
    #> gencode_transcripts.R added
    #> hisat2_index.R added
    #> reference_genome.R added
    #> salmon_index.R added
    #> ucsc_database.R added
    #>
    #> recipeHub with 15 records
    #> cache path:  /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/cache/ReUseDataRecipe
    #> # recipeSearch() to query specific recipes using multipe keywords
    #> # recipeUpdate() to update the local recipe cache
    #>
    #>           name
    #>   BFC1  | STAR_index
    #>   BFC2  | bowtie2_index
    #>   BFC3  | echo_out
    #>   BFC4  | ensembl_liftover
    #>   BFC5  | gcp_broad_gatk_hg19
    #>   ...     ...
    #>   BFC11 | gencode_transcripts
    #>   BFC12 | hisat2_index
    #>   BFC13 | reference_genome
    #>   BFC14 | salmon_index
    #>   BFC15 | ucsc_database
    recipeSearch("echo")
    #> recipeHub with 1 records
    #> cache path:  /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/cache/ReUseDataRecipe
    #> # recipeSearch() to query specific recipes using multipe keywords
    #> # recipeUpdate() to update the local recipe cache
    #>
    #>          name
    #>   BFC3 | 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.

We can install cwltool first to make sure a cwl-runner is available.

    invisible(Rcwl::install_cwltool())

    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] "/home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/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: /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/SharedData/outfile.txt"
    #> [4] "# notes: echo hello world txt"
    #> [5] "# date: 2024-10-29 22:26:05.24568"

## 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/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/cache/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
    #>   BFC1 | outfile.txt
    #>        Path
    #>   BFC1 /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/SharedData/outfi...

`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/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/cache/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
    #>   BFC1 | outfile.txt
    #>        Path
    #>   BFC1 /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/SharedData/outfi...
    ## dh["BFC1"]
    dh[dataNames(dh) == "outfile.txt"]
    #> dataHub with 1 records
    #> cache path:  /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/cache/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
    #>   BFC1 | outfile.txt
    #>        Path
    #>   BFC1 /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/SharedData/outfi...
    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] "/home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/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/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/cache/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
    #>   BFC1 | outfile.txt
    #>        Path
    #>   BFC1 /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/SharedData/outfi...
    toList(dh1, listNames = c("input_file"))
    #> $input_file
    #> [1] "/home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/SharedData/outfile.txt"
    toList(dh1, format = "yaml", listNames = c("input_file"))
    #> [1] "input_file: /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/SharedData/outfile.txt"
    toList(dh1, format = "json", file = file.path(tempdir(), "data.json"))
    #> File is saved as: "/home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/data.json"
    #> {
    #>   "outfile.txt": "/home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/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/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/cache/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
    #>   BFC1 | outfile.txt
    #>        Path
    #>   BFC1 /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/SharedData/outfi...
    dataTags(dh[1]) <- "#gatk"
    dataSearch("#gatk")
    #> dataHub with 1 records
    #> cache path:  /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/cache/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
    #>   BFC1 | outfile.txt
    #>        Path
    #>   BFC1 /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/SharedData/outfi...

## 2.3 Existing data annotation

The package can also be used to add annotation and notes to existing data resources or experiment data for management. Here we add exisiting “exp_data” to local data repository.

    exp_data <- file.path(tempdir(), "exp_data")
    dir.create(exp_data)

We first add notes to the data, and then update data repository with information from the new dataset.

    annData(exp_data, notes = c("experiment data"))
    #> meta.yml added
    #> [1] "/home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/exp_data/meta.yml"
    dataUpdate(exp_data)
    #>
    #> Updating data record...
    #> exp_data added
    #> dataHub with 2 records
    #> cache path:  /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/cache/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
    #>   BFC1 | outfile.txt
    #>   BFC2 | exp_data
    #>        Path
    #>   BFC1 /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/SharedData/outfi...
    #>   BFC2 /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/exp_data

Now our data hub cached meta information from two different directories, one from data recipe and one from exisiting data. Data can be retrieved by keywords.

    dataSearch("experiment")
    #> dataHub with 1 records
    #> cache path:  /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/cache/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
    #>   BFC2 | exp_data /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/exp_data

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...
    #> a8b93786043cc_GRCh38.primary_assembly.genome.fa.1.bt2 added
    #> a8b9367bf8466_GRCh38.primary_assembly.genome.fa.2.bt2 added
    #> a8b931164f296_GRCh38.primary_assembly.genome.fa.3.bt2 added
    #> a8b9323bf2d8b_GRCh38.primary_assembly.genome.fa.4.bt2 added
    #> a8b93617c173f_GRCh38.primary_assembly.genome.fa.rev.1.bt2 added
    #> a8b9314a5a0d0_GRCh38.primary_assembly.genome.fa.rev.2.bt2 added
    #> a8b934f9afe22_outfile.txt added
    #> a8b9375643b52_GRCh37_to_GRCh38.chain added
    #> a8b93297c9c1b_GRCh37_to_NCBI34.chain added
    #> a8b9366f4066_GRCh37_to_NCBI35.chain added
    #> a8b9360f69c68_GRCh37_to_NCBI36.chain added
    #> a8b937bbb5397_GRCh38_to_GRCh37.chain added
    #> a8b936ae3d7ac_GRCh38_to_NCBI34.chain added
    #> a8b9347c46fc3_GRCh38_to_NCBI35.chain added
    #> a8b93360f5651_GRCh38_to_NCBI36.chain added
    #> a8b935c11268a_NCBI34_to_GRCh37.chain added
    #> a8b9329b12111_NCBI34_to_GRCh38.chain added
    #> a8b935cd5ba6c_NCBI35_to_GRCh37.chain added
    #> a8b933a649950_NCBI35_to_GRCh38.chain added
    #> a8b93566da99d_NCBI36_to_GRCh37.chain added
    #> a8b93627397f9_NCBI36_to_GRCh38.chain added
    #> a8b9349068bb5_GRCm38_to_NCBIM36.chain added
    #> a8b93520ae4df_GRCm38_to_NCBIM37.chain added
    #> a8b93e4367ed_NCBIM36_to_GRCm38.chain added
    #> a8b934898a69f_NCBIM37_to_GRCm38.chain added
    #> a8b935ee635b0_1000G_omni2.5.b37.vcf.gz added
    #> a8b935ea2bdf6_1000G_omni2.5.b37.vcf.gz.tbi added
    #> a8b936a40d65f_Mills_and_1000G_gold_standard.indels.b37.vcf.gz added
    #> a8b9354da2f07_Mills_and_1000G_gold_standard.indels.b37.vcf.gz.tbi added
    #> a8b931bd3ae7c_1000G_omni2.5.hg38.vcf.gz added
    #> a8b935f519210_1000G_omni2.5.hg38.vcf.gz.tbi added
    #> a8b934d3a72d3_Mills_and_1000G_gold_standard.indels.hg38.vcf.gz added
    #> a8b9339332e3_Mills_and_1000G_gold_standard.indels.hg38.vcf.gz.tbi added
    #> a8b9370b684a6_af-only-gnomad.raw.sites.vcf added
    #> a8b9370f9a05e_af-only-gnomad.raw.sites.vcf.idx added
    #> a8b93650f4a22_Mutect2-exome-panel.vcf.idx added
    #> a8b9355c2576_Mutect2-WGS-panel-b37.vcf added
    #> a8b9340949e81_Mutect2-WGS-panel-b37.vcf.idx added
    #> a8b935a738574_small_exac_common_3.vcf added
    #> a8b932ed8c191_small_exac_common_3.vcf.idx added
    #> a8b934703dee7_1000g_pon.hg38.vcf.gz added
    #> a8b933b6a21dd_1000g_pon.hg38.vcf.gz.tbi added
    #> a8b932a941529_af-only-gnomad.hg38.vcf.gz added
    #> a8b9331e7b693_af-only-gnomad.hg38.vcf.gz.tbi added
    #> a8b9332e91a0_small_exac_common_3.hg38.vcf.gz added
    #> a8b9360a36b7a_small_exac_common_3.hg38.vcf.gz.tbi added
    #> a8b93df8dd1e_gencode.v41.annotation.gtf added
    #> a8b932cdfb2b1_gencode.v42.annotation.gtf added
    #> a8b933d7925e7_gencode.vM30.annotation.gtf added
    #> a8b93485d766e_gencode.vM31.annotation.gtf added
    #> a8b9334d5c4e_gencode.v41.transcripts.fa added
    #> a8b931fecbde0_gencode.v41.transcripts.fa.fai added
    #> a8b9311640223_gencode.v42.transcripts.fa added
    #> a8b935558412d_gencode.v42.transcripts.fa.fai added
    #> a8b932e3025ce_gencode.vM30.pc_transcripts.fa added
    #> a8b9359fca8c2_gencode.vM30.pc_transcripts.fa.fai added
    #> a8b93343e76de_gencode.vM31.pc_transcripts.fa added
    #> a8b93cd2e3c4_gencode.vM31.pc_transcripts.fa.fai added
    #> a8b93443d7f21_GRCh38.primary_assembly.genome.fa.1.ht2 added
    #> a8b93918a5e5_GRCh38.primary_assembly.genome.fa.2.ht2 added
    #> a8b9328a69240_GRCh38.primary_assembly.genome.fa.3.ht2 added
    #> a8b93238f1131_GRCh38.primary_assembly.genome.fa.4.ht2 added
    #> a8b93565318b9_GRCh38.primary_assembly.genome.fa.5.ht2 added
    #> a8b932c39c523_GRCh38.primary_assembly.genome.fa.6.ht2 added
    #> a8b93144595d8_GRCh38.primary_assembly.genome.fa.7.ht2 added
    #> a8b93474cb917_GRCh38.primary_assembly.genome.fa.8.ht2 added
    #> a8b9311490f46_GRCh38_full_analysis_set_plus_decoy_hla.fa.fai added
    #> a8b9319a1bb4e_GRCh38_full_analysis_set_plus_decoy_hla.fa.amb added
    #> a8b937e15798_GRCh38_full_analysis_set_plus_decoy_hla.fa.ann added
    #> a8b936bbc94ba_GRCh38_full_analysis_set_plus_decoy_hla.fa.bwt added
    #> a8b93487a7ce0_GRCh38_full_analysis_set_plus_decoy_hla.fa.pac added
    #> a8b934ee53680_GRCh38_full_analysis_set_plus_decoy_hla.fa.sa added
    #> a8b932726b697_GRCh38_full_analysis_set_plus_decoy_hla.fa added
    #> a8b93730e9209_GRCh38.primary_assembly.genome.fa.fai added
    #> a8b93cced13_GRCh38.primary_assembly.genome.fa.amb added
    #> a8b932a554838_GRCh38.primary_assembly.genome.fa.ann added
    #> a8b9353b1fd83_GRCh38.primary_assembly.genome.fa.bwt added
    #> a8b93ec5ca31_GRCh38.primary_assembly.genome.fa.pac added
    #> a8b935734fae9_GRCh38.primary_assembly.genome.fa.sa added
    #> a8b93112b236a_GRCh38.primary_assembly.genome.fa added
    #> a8b935723409f_hs37d5.fa.fai added
    #> a8b935a825738_hs37d5.fa.amb added
    #> a8b933117e14b_hs37d5.fa.ann added
    #> a8b93688742c2_hs37d5.fa.bwt added
    #> a8b932fda9865_hs37d5.fa.pac added
    #> a8b935f480719_hs37d5.fa.sa added
    #> a8b934283eb84_hs37d5.fa added
    #> a8b9364190f43_complete_ref_lens.bin added
    #> a8b936c1aeadd_ctable.bin added
    #> a8b936c16aa6_ctg_offsets.bin added
    #> a8b936d31b529_duplicate_clusters.tsv added
    #> a8b9314c17d1d_info.json added
    #> a8b932a507bd7_mphf.bin added
    #> a8b934384cde2_pos.bin added
    #> a8b9340fb4241_pre_indexing.log added
    #> a8b933e9611af_rank.bin added
    #> a8b93ad186f9_ref_indexing.log added
    #> a8b9352445187_refAccumLengths.bin added
    #> a8b935837ccfe_reflengths.bin added
    #> a8b9312b2de92_refseq.bin added
    #> a8b933e00e641_seq.bin added
    #> a8b9320b249de_versionInfo.json added
    #> a8b9361981512_salmon_index added
    #> a8b9365279cd9_chrLength.txt added
    #> a8b9313c0dbe7_chrName.txt added
    #> a8b9362650225_chrNameLength.txt added
    #> a8b93f7ce511_chrStart.txt added
    #> a8b936772d96a_exonGeTrInfo.tab added
    #> a8b93712acc57_exonInfo.tab added
    #> a8b9366b1dffa_geneInfo.tab added
    #> a8b93789dfcd5_Genome added
    #> a8b93484e0cf6_genomeParameters.txt added
    #> a8b9341343732_Log.out added
    #> a8b9329b5de20_SA added
    #> a8b9330d54fb9_SAindex added
    #> a8b93710ecf98_sjdbInfo.txt added
    #> a8b938fde539_sjdbList.fromGTF.out.tab added
    #> a8b9373593b3d_sjdbList.out.tab added
    #> a8b935527dedb_transcriptInfo.tab added
    #> a8b937518d016_GRCh38.GENCODE.v42_100 added
    #> a8b937a1aa5e3_knownGene_hg38.sql added
    #> a8b9342599404_knownGene_hg38.txt added
    #> a8b939da4d33_refGene_hg38.sql added
    #> a8b93246b21bb_refGene_hg38.txt added
    #> a8b935de61e6_knownGene_mm39.sql added
    #> a8b934ad58f74_knownGene_mm39.txt added
    #> a8b936301336a_refGene_mm39.sql added
    #> a8b9310afe8e0_refGene_mm39.txt added
    #> dataHub with 130 records
    #> cache path:  /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/cache/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
    #>   BFC1   | outfile.txt
    #>   BFC2   | exp_data
    #>   BFC3   | GRCh38.primary_assembly.genome.fa.1.bt2
    #>   BFC4   | GRCh38.primary_assembly.genome.fa.2.bt2
    #>   BFC5   | GRCh38.primary_assembly.genome.fa.3.bt2
    #>   ...      ...
    #>   BFC126 | refGene_hg38.txt
    #>   BFC127 | knownGene_mm39.sql
    #>   BFC128 | knownGene_mm39.txt
    #>   BFC129 | refGene_mm39.sql
    #>   BFC130 | refGene_mm39.txt
    #>          Path
    #>   BFC1   /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/SharedData/outfi...
    #>   BFC2   /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/exp_data
    #>   BFC3   https://storage.googleapis.com/reusedata/bowtie2_index/GRCh38.pr...
    #>   BFC4   https://storage.googleapis.com/reusedata/bowtie2_index/GRCh38.pr...
    #>   BFC5   https://storage.googleapis.com/reusedata/bowtie2_index/GRCh38.pr...
    #>   ...    ...
    #>   BFC126 https://storage.googleapis.com/reusedata/ucsc_database/refGene_h...
    #>   BFC127 https://storage.googleapis.com/reusedata/ucsc_database/knownGene...
    #>   BFC128 https://storage.googleapis.com/reusedata/ucsc_database/knownGene...
    #>   BFC129 https://storage.googleapis.com/reusedata/ucsc_database/refGene_m...
    #>   BFC130 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/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/cache/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
    #>   BFC10 | GRCh37_to_GRCh38.chain
    #>   BFC14 | GRCh38_to_GRCh37.chain
    #>   BFC15 | GRCh38_to_NCBI34.chain
    #>   BFC16 | GRCh38_to_NCBI35.chain
    #>   BFC17 | GRCh38_to_NCBI36.chain
    #>   BFC19 | NCBI34_to_GRCh38.chain
    #>   BFC21 | NCBI35_to_GRCh38.chain
    #>   BFC23 | NCBI36_to_GRCh38.chain
    #>         Path
    #>   BFC10 https://storage.googleapis.com/reusedata/ensembl_liftover/GRCh37...
    #>   BFC14 https://storage.googleapis.com/reusedata/ensembl_liftover/GRCh38...
    #>   BFC15 https://storage.googleapis.com/reusedata/ensembl_liftover/GRCh38...
    #>   BFC16 https://storage.googleapis.com/reusedata/ensembl_liftover/GRCh38...
    #>   BFC17 https://storage.googleapis.com/reusedata/ensembl_liftover/GRCh38...
    #>   BFC19 https://storage.googleapis.com/reusedata/ensembl_liftover/NCBI34...
    #>   BFC21 https://storage.googleapis.com/reusedata/ensembl_liftover/NCBI35...
    #>   BFC23 https://storage.googleapis.com/reusedata/ensembl_liftover/NCBI36...
    getCloudData(dh[1], outdir = gcpdir)
    #> Data is downloaded:
    #> /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/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
    #> dataHub with 131 records
    #> cache path:  /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/cache/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
    #>   BFC1   | outfile.txt
    #>   BFC2   | exp_data
    #>   BFC3   | GRCh38.primary_assembly.genome.fa.1.bt2
    #>   BFC4   | GRCh38.primary_assembly.genome.fa.2.bt2
    #>   BFC5   | GRCh38.primary_assembly.genome.fa.3.bt2
    #>   ...      ...
    #>   BFC127 | knownGene_mm39.sql
    #>   BFC128 | knownGene_mm39.txt
    #>   BFC129 | refGene_mm39.sql
    #>   BFC130 | refGene_mm39.txt
    #>   BFC131 | GRCh37_to_GRCh38.chain
    #>          Path
    #>   BFC1   /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/SharedData/outfi...
    #>   BFC2   /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/exp_data
    #>   BFC3   https://storage.googleapis.com/reusedata/bowtie2_index/GRCh38.pr...
    #>   BFC4   https://storage.googleapis.com/reusedata/bowtie2_index/GRCh38.pr...
    #>   BFC5   https://storage.googleapis.com/reusedata/bowtie2_index/GRCh38.pr...
    #>   ...    ...
    #>   BFC127 https://storage.googleapis.com/reusedata/ucsc_database/knownGene...
    #>   BFC128 https://storage.googleapis.com/reusedata/ucsc_database/knownGene...
    #>   BFC129 https://storage.googleapis.com/reusedata/ucsc_database/refGene_m...
    #>   BFC130 https://storage.googleapis.com/reusedata/ucsc_database/refGene_m...
    #>   BFC131 /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/gcpData/GRCh37_t...
    dataSearch()  ## data is available locally!!!
    #> dataHub with 131 records
    #> cache path:  /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/cache/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
    #>   BFC1   | outfile.txt
    #>   BFC2   | exp_data
    #>   BFC3   | GRCh38.primary_assembly.genome.fa.1.bt2
    #>   BFC4   | GRCh38.primary_assembly.genome.fa.2.bt2
    #>   BFC5   | GRCh38.primary_assembly.genome.fa.3.bt2
    #>   ...      ...
    #>   BFC127 | knownGene_mm39.sql
    #>   BFC128 | knownGene_mm39.txt
    #>   BFC129 | refGene_mm39.sql
    #>   BFC130 | refGene_mm39.txt
    #>   BFC131 | GRCh37_to_GRCh38.chain
    #>          Path
    #>   BFC1   /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/SharedData/outfi...
    #>   BFC2   /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/exp_data
    #>   BFC3   https://storage.googleapis.com/reusedata/bowtie2_index/GRCh38.pr...
    #>   BFC4   https://storage.googleapis.com/reusedata/bowtie2_index/GRCh38.pr...
    #>   BFC5   https://storage.googleapis.com/reusedata/bowtie2_index/GRCh38.pr...
    #>   ...    ...
    #>   BFC127 https://storage.googleapis.com/reusedata/ucsc_database/knownGene...
    #>   BFC128 https://storage.googleapis.com/reusedata/ucsc_database/knownGene...
    #>   BFC129 https://storage.googleapis.com/reusedata/ucsc_database/refGene_m...
    #>   BFC130 https://storage.googleapis.com/reusedata/ucsc_database/refGene_m...
    #>   BFC131 /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/gcpData/GRCh37_t...

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 /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/SharedData/echo_out_Hello_World!_outfile.yml
    #>                                  params
    #> 1 input: Hello World!; outfile: outfile
    #>                                                                   output
    #> 1 /home/biocbuild/bbs-3.20-bioc/tmpdir/Rtmpaov2HA/SharedData/outfile.txt
    #>                  notes                      date
    #> 1 echo hello world txt 2024-10-29 22:26:05.24568

# 5 SessionInfo

    sessionInfo()
    #> R version 4.4.1 (2024-06-14)
    #> Platform: x86_64-pc-linux-gnu
    #> Running under: Ubuntu 24.04.1 LTS
    #>
    #> Matrix products: default
    #> BLAS:   /home/biocbuild/bbs-3.20-bioc/R/lib/libRblas.so
    #> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.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.6.0     Rcwl_1.22.0         S4Vectors_0.44.0
    #> [4] BiocGenerics_0.52.0 yaml_2.3.10         BiocStyle_2.34.0
    #>
    #> loaded via a namespace (and not attached):
    #>  [1] tidyselect_1.2.1      dplyr_1.1.4           blob_1.2.4
    #>  [4] filelock_1.0.3        R.utils_2.12.3        fastmap_1.2.0
    #>  [7] BiocFileCache_2.14.0  promises_1.3.0        digest_0.6.37
    #> [10] base64url_1.4         mime_0.12             lifecycle_1.0.4
    #> [13] RSQLite_2.3.7         magrittr_2.0.3        compiler_4.4.1
    #> [16] rlang_1.1.4           sass_0.4.9            progress_1.2.3
    #> [19] tools_4.4.1           utf8_1.2.4            data.table_1.16.2
    #> [22] knitr_1.48            prettyunits_1.2.0     brew_1.0-10
    #> [25] htmlwidgets_1.6.4     bit_4.5.0             curl_5.2.3
    #> [28] reticulate_1.39.0     RColorBrewer_1.1-3    batchtools_0.9.17
    #> [31] BiocParallel_1.40.0   purrr_1.0.2           withr_3.0.2
    #> [34] R.oo_1.26.0           grid_4.4.1            fansi_1.0.6
    #> [37] git2r_0.35.0          xtable_1.8-4          debugme_1.2.0
    #> [40] cli_3.6.3             rmarkdown_2.28        DiagrammeR_1.0.11
    #> [43] crayon_1.5.3          generics_0.1.3        httr_1.4.7
    #> [46] visNetwork_2.1.2      DBI_1.2.3             cachem_1.1.0
    #> [49] parallel_4.4.1        BiocManager_1.30.25   basilisk_1.18.0
    #> [52] vctrs_0.6.5           Matrix_1.7-1          jsonlite_1.8.9
    #> [55] dir.expiry_1.14.0     bookdown_0.41         hms_1.1.3
    #> [58] bit64_4.5.2           jquerylib_0.1.4       RcwlPipelines_1.22.0
    #> [61] glue_1.8.0            codetools_0.2-20      stringi_1.8.4
    #> [64] later_1.3.2           tibble_3.2.1          pillar_1.9.0
    #> [67] basilisk.utils_1.18.0 rappdirs_0.3.3        htmltools_0.5.8.1
    #> [70] R6_2.5.1              dbplyr_2.5.0          evaluate_1.0.1
    #> [73] shiny_1.9.1           lattice_0.22-6        R.methodsS3_1.8.2
    #> [76] png_0.1-8             backports_1.5.0       memoise_2.0.1
    #> [79] httpuv_1.6.15         bslib_0.8.0           Rcpp_1.0.13
    #> [82] checkmate_2.3.2       xfun_0.48             pkgconfig_2.0.3