Date: 2026-05-22

# HubPub: Help with publication of Hub packages

Kayla Interdonato1 and Martin Morgan1

1Roswell Park Comprehensive Cancer Center, Buffalo, NY

#### 2026-05-22

#### Package

HubPub 1.21.1

# 1 Introduction

`HubPub` provides users with functionality to help with the Bioconductor Hub structures. The package provides the ability to create a skeleton of a Hub style package that the user can then populate with the necessary information. There are also functions to help add resources to the Hub pacakge metadata files as well as publish data to the Bioconductor S3 bucket.

# 2 Installation

Install the most recent version from Bioconductor:

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

Then load `HubPub`:

    library(HubPub)

# 3 HubPub

## 3.1 Creating a Hub styled package

The `create_pkg()` function creates the skeleton of a package that follows the guidelines for a Bioconductor Hub type package. More information about what are the requirements and content for a Hub style package the developer can look at the “Creating A Hub Package” vignette from this package.

`create_pkg()` requires a path to where the packages is to be created and the type of package that should be created (“AnnotationHub” or “ExperimentHub”). There is also a variable `use_git` that indicates if the package should be set up with git (default is `TRUE`).

NOTE: This function is intended for a developer that has not created the package yet. If the package has already been created, then this function will not benefit the developer. There are a couple other functions in this package that deal with resources that might be helpful, more on these later in the vignette.

    fl <- tempdir()
    create_pkg(file.path(fl, "examplePkg"), "ExperimentHub")
    #> ✔ Creating
    #>   '/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T/RtmpyxHDfx/examplePkg/'.
    #> ✔ Setting active project to
    #>   "/private/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T/RtmpyxHDfx/examplePkg".
    #> ✔ Creating 'R/'.
    #> ✔ Writing 'DESCRIPTION'.
    #> Package: examplePkg
    #> Title: What the Package Does (One Line, Title Case)
    #> Version: 0.99.0
    #> Date: 2026-05-22
    #> Authors@R (parsed):
    #>     * First Last <first.last@example.com> [aut, cre]
    #> Description: What the package does (one paragraph).
    #> License: Artistic-2.0
    #> BugReports: https://support.bioconductor.org/t/examplePkg
    #> Imports:
    #>     ExperimentHub
    #> Suggests:
    #>     ExperimentHubData
    #> Encoding: UTF-8
    #> Roxygen: list(markdown = TRUE)
    #> RoxygenNote: 8.0.0
    #> biocViews: ExperimentHub
    #> ✔ Writing 'NAMESPACE'.
    #> ✔ Setting active project to "<no active project>".
    #> ✔ Setting active project to
    #>   "/private/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T/RtmpyxHDfx/examplePkg".
    #> ✔ Initialising Git repo.
    #> ✔ Adding ".Rproj.user", ".Rhistory", ".RData", ".httr-oauth", ".DS_Store", and
    #>   ".quarto" to '.gitignore'.
    #> ✔ Writing 'R/examplePkg-package.R'.
    #> ✔ Writing 'NEWS.md'.
    #> ✔ Creating 'man/'.
    #> ✔ Creating 'inst/scripts/'.
    #> ✔ Writing 'inst/scripts/make-data.R'.
    #> ✔ Writing 'inst/scripts/make-metadata.R'.
    #> ✔ Writing 'R/zzz.R'.
    #> ✔ Creating 'inst/extdata/'.
    #> ✔ Adding testthat to 'Suggests' field in DESCRIPTION.
    #> ✔ Adding "3" to 'Config/testthat/edition'.
    #> ✔ Creating 'tests/testthat/'.
    #> ✔ Writing 'tests/testthat.R'.
    #> ☐ Call `usethis::use_test()` to initialize a basic test file and open it for
    #>   editing.
    #> ✔ Writing 'tests/testthat/test_metadata.R'.
    #> [1] "/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/examplePkg"

Once the package is created the developer can go through and make any changes to the package. For example, the DESCRIPTON file contains very basic requirements but the developer should go back and fill in the ‘Title:’ and ‘Description:’ fields.

## 3.2 Adding a resource to the metadata file

Another useful function in `HubPub` is `add_resource()`. This function can be useful for developers who are creating a new Hub related package or for developers who want to add a new resource to an existing Hub package. The purpose of this function is to add a hub resource to the package metadata.csv file. The function requires the name of the package (or the path to the newly created package) and a named list with the data to be added to the resource. To get the elements and content for this list look at `?hub_metadata`. There is also information in the “Creating A Hub Package” vignette from this package.

    metadata <- hub_metadata(
        Title = "ENCODE",
        Description = "a test entry",
        BiocVersion = "4.1",
        Genome = NA_character_,
        SourceType = "JSON",
        SourceUrl = "http://www.encodeproject.org",
        SourceVersion = "x.y.z",
        Species = NA_character_,
        TaxonomyId = as.integer(9606),
        Coordinate_1_based = NA,
        DataProvider = "ENCODE Project",
        Maintainer = "tst person <tst@email.com>",
        RDataClass = "Rda",
        DispatchClass = "Rda",
        Location_Prefix = "s3://experimenthub/",
        RDataPath = "ENCODExplorerData/encode_df_lite.rda",
        Tags = "ENCODE:Homo sapiens"
    )

    add_resource(file.path(fl, "examplePkg"), metadata)
    #> Warning: replacing previous import 'utils::data' by 'BiocGenerics::data' when
    #> loading 'ExperimentHubData'
    #> Warning: replacing previous import 'utils::findMatches' by
    #> 'S4Vectors::findMatches' when loading 'ExperimentHubData'
    #> Warning: replacing previous import 'utils::data' by 'BiocGenerics::data' when
    #> loading 'GenomeInfoDb'
    #> No methods found in package 'rtracklayer' for request: 'trackName<-' when loading 'AnnotationHubData'
    #> [1] "/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/examplePkg/inst/extdata/metadata.csv"

Then if you want to see what the metadata file looks like you can read in the csv file like the following.

    resource <- file.path(fl, "examplePkg", "inst", "extdata", "metadata.csv")
    tst <- read.csv(resource)
    tst
    #>    Title  Description BiocVersion Genome SourceType
    #> 1 ENCODE a test entry         4.1     NA       JSON
    #>                      SourceUrl SourceVersion Species TaxonomyId
    #> 1 http://www.encodeproject.org         x.y.z      NA       9606
    #>   Coordinate_1_based   DataProvider                 Maintainer RDataClass
    #> 1                 NA ENCODE Project tst person <tst@email.com>        Rda
    #>   DispatchClass     Location_Prefix                            RDataPath
    #> 1           Rda s3://experimenthub/ ENCODExplorerData/encode_df_lite.rda
    #>                  Tags
    #> 1 ENCODE:Homo sapiens

## 3.3 Publishing the resource to AWS S3

The final function in `HubPub` helps the developer with publishing data resources to an Bioconductor AWS S3. The function utilizes functions for the `aws.s3` package to place files or directories on S3. The developer should have already contacted the Bioconductor hubs maintainers to get the necessary credentials to access the bucket. Once the credentials are received the developer should declare them in the system environment before running this function. The function requires a path to the file or name of the directory to be added to the bucket and a name for how the object should be named on the bucket. If adding a directory be sure there are no nested directories and only files.

The below code chunk demonstrates the use of the function using a dummy dataset. It will only work if the necessary global environments have been declared with the hub credentials.

    ## For publishing directories with multiple files
    fl <- tempdir()
    utils::write.csv(mtcars, file = file.path(fl, "mtcars1.csv"))
    utils::write.csv(mtcars, file = file.path(fl, "mtcars2.csv"))
    publish_resource(fl, "test_dir")
    #> Warning in publish_resource(fl, "test_dir"): Not all system environment
    #> variables are set, do so and rerun function.
    #> copy '/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/BiocStyle' to 's3://annotation-contributor/test_dir/BiocStyle'
    #> copy '/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/examplePkg' to 's3://annotation-contributor/test_dir/examplePkg'
    #> copy '/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/fileda7b31edb9cb' to 's3://annotation-contributor/test_dir/fileda7b31edb9cb'
    #> copy '/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/mtcars1.csv' to 's3://annotation-contributor/test_dir/mtcars1.csv'
    #> copy '/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/mtcars2.csv' to 's3://annotation-contributor/test_dir/mtcars2.csv'
    #> copy '/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/repos_https%3A%2F%2Fbioconductor.org%2Fpackages%2F3.24%2Fbioc%2Fsrc%2Fcontrib.rds' to 's3://annotation-contributor/test_dir/repos_https%3A%2F%2Fbioconductor.org%2Fpackages%2F3.24%2Fbioc%2Fsrc%2Fcontrib.rds'
    #> copy '/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/repos_https%3A%2F%2Fbioconductor.org%2Fpackages%2F3.24%2Fbooks%2Fsrc%2Fcontrib.rds' to 's3://annotation-contributor/test_dir/repos_https%3A%2F%2Fbioconductor.org%2Fpackages%2F3.24%2Fbooks%2Fsrc%2Fcontrib.rds'
    #> copy '/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/repos_https%3A%2F%2Fbioconductor.org%2Fpackages%2F3.24%2Fdata%2Fannotation%2Fsrc%2Fcontrib.rds' to 's3://annotation-contributor/test_dir/repos_https%3A%2F%2Fbioconductor.org%2Fpackages%2F3.24%2Fdata%2Fannotation%2Fsrc%2Fcontrib.rds'
    #> copy '/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/repos_https%3A%2F%2Fbioconductor.org%2Fpackages%2F3.24%2Fdata%2Fexperiment%2Fsrc%2Fcontrib.rds' to 's3://annotation-contributor/test_dir/repos_https%3A%2F%2Fbioconductor.org%2Fpackages%2F3.24%2Fdata%2Fexperiment%2Fsrc%2Fcontrib.rds'
    #> copy '/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/repos_https%3A%2F%2Fbioconductor.org%2Fpackages%2F3.24%2Fworkflows%2Fsrc%2Fcontrib.rds' to 's3://annotation-contributor/test_dir/repos_https%3A%2F%2Fbioconductor.org%2Fpackages%2F3.24%2Fworkflows%2Fsrc%2Fcontrib.rds'
    #> copy '/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/repos_https%3A%2F%2Fcloud.r-project.org%2Fsrc%2Fcontrib.rds' to 's3://annotation-contributor/test_dir/repos_https%3A%2F%2Fcloud.r-project.org%2Fsrc%2Fcontrib.rds'
    #> $`/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/BiocStyle`
    #> NULL
    #>
    #> $`/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/examplePkg`
    #> NULL
    #>
    #> $`/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/fileda7b31edb9cb`
    #> NULL
    #>
    #> $`/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/mtcars1.csv`
    #> NULL
    #>
    #> $`/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/mtcars2.csv`
    #> NULL
    #>
    #> $`/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/repos_https%3A%2F%2Fbioconductor.org%2Fpackages%2F3.24%2Fbioc%2Fsrc%2Fcontrib.rds`
    #> NULL
    #>
    #> $`/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/repos_https%3A%2F%2Fbioconductor.org%2Fpackages%2F3.24%2Fbooks%2Fsrc%2Fcontrib.rds`
    #> NULL
    #>
    #> $`/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/repos_https%3A%2F%2Fbioconductor.org%2Fpackages%2F3.24%2Fdata%2Fannotation%2Fsrc%2Fcontrib.rds`
    #> NULL
    #>
    #> $`/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/repos_https%3A%2F%2Fbioconductor.org%2Fpackages%2F3.24%2Fdata%2Fexperiment%2Fsrc%2Fcontrib.rds`
    #> NULL
    #>
    #> $`/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/repos_https%3A%2F%2Fbioconductor.org%2Fpackages%2F3.24%2Fworkflows%2Fsrc%2Fcontrib.rds`
    #> NULL
    #>
    #> $`/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/repos_https%3A%2F%2Fcloud.r-project.org%2Fsrc%2Fcontrib.rds`
    #> NULL

    ## For publishing a single file
    utils::write.csv(mtcars, file = file.path(fl, "mtcars3.csv"))
    publish_resource(file.path(fl, "mtcars3.csv"), "test_dir")
    #> Warning in publish_resource(file.path(fl, "mtcars3.csv"), "test_dir"): Not all
    #> system environment variables are set, do so and rerun function.
    #> copy '/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/mtcars3.csv' to 's3://annotation-contributor/test_dir/mtcars3.csv'
    #> $`/var/folders/r0/l4fjk6cj5xj0j3brt4bplpl40000gt/T//RtmpyxHDfx/mtcars3.csv`
    #> NULL

# 4 Session Information

    sessionInfo()
    #> R version 4.6.0 Patched (2026-05-01 r89994)
    #> Platform: aarch64-apple-darwin23
    #> Running under: macOS Tahoe 26.3.1
    #>
    #> Matrix products: default
    #> BLAS:   /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRblas.0.dylib
    #> LAPACK: /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.1
    #>
    #> locale:
    #> [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
    #>
    #> time zone: America/New_York
    #> tzcode source: internal
    #>
    #> attached base packages:
    #> [1] stats     graphics  grDevices utils     datasets  methods   base
    #>
    #> other attached packages:
    #> [1] futile.logger_1.4.9 HubPub_1.21.1       BiocStyle_2.41.0
    #>
    #> loaded via a namespace (and not attached):
    #>   [1] DBI_1.3.0                   bitops_1.0-9
    #>   [3] RBGL_1.89.0                 formatR_1.14
    #>   [5] httr2_1.2.2                 testthat_3.3.2
    #>   [7] rlang_1.2.0                 magrittr_2.0.5
    #>   [9] otel_0.2.0                  matrixStats_1.5.0
    #>  [11] compiler_4.6.0              RSQLite_3.52.0
    #>  [13] GenomicFeatures_1.65.0      roxygen2_8.0.0
    #>  [15] png_0.1-9                   vctrs_0.7.3
    #>  [17] pkgconfig_2.0.3             crayon_1.5.3
    #>  [19] fastmap_1.2.0               dbplyr_2.5.2
    #>  [21] XVector_0.53.0              biocViews_1.81.0
    #>  [23] Rsamtools_2.29.0            rmarkdown_2.31
    #>  [25] UCSC.utils_1.9.0            graph_1.91.0
    #>  [27] purrr_1.2.2                 bit_4.6.0
    #>  [29] xfun_0.57                   gert_2.3.1
    #>  [31] AnnotationHubData_1.43.0    aws.s3_0.3.22
    #>  [33] cachem_1.1.0                cigarillo_1.3.0
    #>  [35] GenomeInfoDb_1.49.0         jsonlite_2.0.0
    #>  [37] blob_1.3.0                  DelayedArray_0.39.2
    #>  [39] styler_1.11.0               BiocParallel_1.47.0
    #>  [41] parallel_4.6.0              R6_2.6.1
    #>  [43] bslib_0.11.0                rtracklayer_1.73.0
    #>  [45] brio_1.1.5                  GenomicRanges_1.65.0
    #>  [47] jquerylib_0.1.4             Seqinfo_1.3.0
    #>  [49] bookdown_0.46               SummarizedExperiment_1.43.0
    #>  [51] knitr_1.51                  usethis_3.2.1
    #>  [53] base64enc_0.1-6             R.utils_2.13.0
    #>  [55] IRanges_2.47.1              BiocBaseUtils_1.15.1
    #>  [57] biocthis_1.23.0             Matrix_1.7-5
    #>  [59] R.cache_0.17.0              tidyselect_1.2.1
    #>  [61] abind_1.4-8                 rstudioapi_0.18.0
    #>  [63] stringdist_0.9.17           yaml_2.3.12
    #>  [65] codetools_0.2-20            RUnit_0.4.33.1
    #>  [67] curl_7.1.0                  lattice_0.22-9
    #>  [69] tibble_3.3.1                Biobase_2.73.1
    #>  [71] withr_3.0.2                 KEGGREST_1.53.0
    #>  [73] askpass_1.2.1               evaluate_1.0.5
    #>  [75] lambda.r_1.2.4              AnnotationForge_1.55.0
    #>  [77] desc_1.4.3                  BiocFileCache_3.3.0
    #>  [79] xml2_1.5.2                  ExperimentHub_3.3.0
    #>  [81] Biostrings_2.81.2           pillar_1.11.1
    #>  [83] BiocManager_1.30.27         filelock_1.0.3
    #>  [85] MatrixGenerics_1.25.0       whisker_0.4.1
    #>  [87] stats4_4.6.0                OrganismDbi_1.55.1
    #>  [89] generics_0.1.4              rprojroot_2.1.1
    #>  [91] credentials_2.0.3           RCurl_1.98-1.18
    #>  [93] BiocVersion_3.24.0          S4Vectors_0.51.2
    #>  [95] BiocCheck_1.49.6            glue_1.8.1
    #>  [97] tools_4.6.0                 ExperimentHubData_1.39.0
    #>  [99] AnnotationHub_4.3.0         BiocIO_1.23.3
    #> [101] sys_3.4.3                   GenomicAlignments_1.49.0
    #> [103] fs_2.1.0                    XML_3.99-0.23
    #> [105] grid_4.6.0                  AnnotationDbi_1.75.0
    #> [107] GenomeInfoDbData_1.2.15     available_1.1.0
    #> [109] restfulr_0.0.16             cli_3.6.6
    #> [111] rappdirs_0.3.4              futile.options_1.0.1
    #> [113] S4Arrays_1.13.0             dplyr_1.2.1
    #> [115] R.methodsS3_1.8.2           sass_0.4.10
    #> [117] digest_0.6.39               BiocGenerics_0.59.3
    #> [119] SparseArray_1.13.2          rjson_0.2.23
    #> [121] memoise_2.0.1               htmltools_0.5.9
    #> [123] R.oo_1.27.1                 lifecycle_1.0.5
    #> [125] httr_1.4.8                  aws.signature_0.6.0
    #> [127] openssl_2.4.1               bit64_4.8.2