Title: | Utilities to create and use Bioconductor Hubs |
---|---|
Description: | 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 package metadata files as well as publish data to the Bioconductor S3 bucket. |
Authors: | Kayla Interdonato [aut, cre], Martin Morgan [aut] |
Maintainer: | Kayla Interdonato <[email protected]> |
License: | Artistic-2.0 |
Version: | 1.15.0 |
Built: | 2024-10-30 07:31:09 UTC |
Source: | https://github.com/bioc/HubPub |
This function adds a hub resource to the AH or EH package metadata.csv file. It can be used while creating a new hub package or for adding data to an existing package.
add_resource(package, fields, metafile = "metadata.csv")
add_resource(package, fields, metafile = "metadata.csv")
package |
A |
fields |
A named list with the data to be added to the
resource. Elements and content of the list are described in |
metafile |
A |
Path to metadata file where resource was added
## create a mock package pkgdir <- tempdir() create_pkg(file.path(pkgdir, "recordPkg"), "ExperimentHub") ## create a metadata record meta <- hub_metadata( Title = "ENCODE", Description = "a test entry", BiocVersion = "4.1", Genome = NA_character_, SourceType = "JSON", SourceUrl = "https://www.encodeproject.org", SourceVersion = "x.y.z", Species = NA_character_, TaxonomyId = as.integer(9606), Coordinate_1_based = NA, DataProvider = "ENCODE Project", Maintainer = "tst person <[email protected]>", RDataClass = "data.table", DispatchClass = "Rda", Location_Prefix = "s3://annotationhub/", RDataPath = "ENCODExplorerData/encode_df_lite.rda", Tags = "ENCODE:Homo sapiens" ) ## add the record to the metadata add_resource(file.path(pkgdir, "recordPkg"), meta)
## create a mock package pkgdir <- tempdir() create_pkg(file.path(pkgdir, "recordPkg"), "ExperimentHub") ## create a metadata record meta <- hub_metadata( Title = "ENCODE", Description = "a test entry", BiocVersion = "4.1", Genome = NA_character_, SourceType = "JSON", SourceUrl = "https://www.encodeproject.org", SourceVersion = "x.y.z", Species = NA_character_, TaxonomyId = as.integer(9606), Coordinate_1_based = NA, DataProvider = "ENCODE Project", Maintainer = "tst person <[email protected]>", RDataClass = "data.table", DispatchClass = "Rda", Location_Prefix = "s3://annotationhub/", RDataPath = "ENCODExplorerData/encode_df_lite.rda", Tags = "ENCODE:Homo sapiens" ) ## add the record to the metadata add_resource(file.path(pkgdir, "recordPkg"), meta)
This function creates the skeleton of a package that follow the guidelines for Bioconductor type packages. It is expected of the user to go through and make any necessary changes or improvements once the package begins to take shape. For examples, the DESCRIPTION contains very basic requirements, but the developer should go back and fill in the 'Title:' and 'Description:' fields.
create_pkg(package, type = c("AnnotationHub", "ExperimentHub"), use_git = TRUE)
create_pkg(package, type = c("AnnotationHub", "ExperimentHub"), use_git = TRUE)
package |
A |
type |
A |
use_git |
A |
Path to package location
fl <- tempdir() create_pkg(file.path(fl, "tstPkg"), "AnnotationHub")
fl <- tempdir() create_pkg(file.path(fl, "tstPkg"), "AnnotationHub")
This functions makes a list of values that can be used to add as a
resource to a 'metadata.csv' file in a Hub package. The type of
each argument indicates the expected value, e.g., Title = character(1)
indicates that it is expected to be a character
vector of length 1. See individual parameters for more information.
hub_metadata( Title = character(1), Description = character(1), BiocVersion = package_version("0.0"), Genome = character(1), SourceType = character(1), SourceUrl = character(1), SourceVersion = character(1), Species = character(1), TaxonomyId = integer(1), Coordinate_1_based = NA, DataProvider = character(1), Maintainer = character(1), RDataClass = character(1), DispatchClass = character(1), Location_Prefix = character(1), RDataPath = character(1), Tags = character() )
hub_metadata( Title = character(1), Description = character(1), BiocVersion = package_version("0.0"), Genome = character(1), SourceType = character(1), SourceUrl = character(1), SourceVersion = character(1), Species = character(1), TaxonomyId = integer(1), Coordinate_1_based = NA, DataProvider = character(1), Maintainer = character(1), RDataClass = character(1), DispatchClass = character(1), Location_Prefix = character(1), RDataPath = character(1), Tags = character() )
Title |
|
Description |
|
BiocVersion |
The two-digit version of Bioconductor the
resource is being introduced into. Could be a character vector
|
Genome |
|
SourceType |
|
SourceUrl |
|
SourceVersion |
|
Species |
|
TaxonomyId |
|
Coordinate_1_based |
|
DataProvider |
|
Maintainer |
|
RDataClass |
|
DispatchClass |
A number of dispatch classes are pre-defined in AnnotationHub/R/AnnotationHubResource-class.R with the suffix `Resource`. For example, if you have sqlite files, the AnnotationHubResource-class.R defines SQLiteFileResource so the DispatchClass would be SQLiteFile. Contact [email protected] if you are not sure which class to use. The function `AnnotationHub::DispatchClassList()` will output a matrix of currently implemented DispatchClass and brief description of utility. If a predefine class does not seem appropriate contact [email protected]. |
Location_Prefix |
|
RDataPath |
|
Tags |
|
None
hub_metadata() tst <- hub_metadata( Title = "ENCODE", Description = "a test entry", BiocVersion = package_version("3.9"), Genome = NA_character_, SourceType = "JSON", SourceUrl = "https://www.encodeproject.org", SourceVersion = package_version("0.0"), Species = NA_character_, TaxonomyId = NA_integer_, Coordinate_1_based = NA, DataProvider = "ENCODE Project", Maintainer = "tst person <[email protected]>", RDataClass = "data.table", DispatchClass = "Rda", Location_Prefix = NA_character_, RDataPath = "ENCODExplorerData/encode_df_lite.rda", Tags = c("ENCODE", "Homo sapiens") )
hub_metadata() tst <- hub_metadata( Title = "ENCODE", Description = "a test entry", BiocVersion = package_version("3.9"), Genome = NA_character_, SourceType = "JSON", SourceUrl = "https://www.encodeproject.org", SourceVersion = package_version("0.0"), Species = NA_character_, TaxonomyId = NA_integer_, Coordinate_1_based = NA, DataProvider = "ENCODE Project", Maintainer = "tst person <[email protected]>", RDataClass = "data.table", DispatchClass = "Rda", Location_Prefix = NA_character_, RDataPath = "ENCODExplorerData/encode_df_lite.rda", Tags = c("ENCODE", "Homo sapiens") )
This function uses functionality from the aws.s3 package to put files or directories on the Bioconductor's test hub S3 bucket. The user should have already contacted the hubs maintainers at [email protected] to get the necessary credentials to access the bucket. These credentials should be delcared in the system environment prior to running this function.
publish_resource(path, object, dry.run = TRUE)
publish_resource(path, object, dry.run = TRUE)
path |
A |
object |
A |
dry.run |
A boolean to indicate if the resource should in fact be published. The defalut is TRUE, meaning the resource won't be published. |
None
pkgdir <- tempfile() fl1 <- file.path(pkgdir, "mtcars1.csv") dir.create(dirname(fl1), recursive = TRUE) write.csv(mtcars, file = file.path(fl1)) fl2 <- file.path(pkgdir, "mtcars2.csv") write.csv(mtcars, file = file.path(fl2)) publish_resource(pkgdir, "test_dir") fl3 <- file.path(pkgdir, "mtcars3.csv") write.csv(mtcars, file = file.path(fl3)) publish_resource(fl3, "test_dir")
pkgdir <- tempfile() fl1 <- file.path(pkgdir, "mtcars1.csv") dir.create(dirname(fl1), recursive = TRUE) write.csv(mtcars, file = file.path(fl1)) fl2 <- file.path(pkgdir, "mtcars2.csv") write.csv(mtcars, file = file.path(fl2)) publish_resource(pkgdir, "test_dir") fl3 <- file.path(pkgdir, "mtcars3.csv") write.csv(mtcars, file = file.path(fl3)) publish_resource(fl3, "test_dir")