diff --git a/CITATION.cff b/CITATION.cff index 491b5a2..14482ca 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -12,8 +12,8 @@ authors: given-names: Irem B. email: irembgunduz@gmail.com orcid: "https://orcid.org/0000-0003-2641-0916" -version: 0.99.10 -date-released: "2026-09-29" +version: 0.99.12 +date-released: "2026-10-02" doi: 10.18129/B9.bioc.methylTFRAnnotationMm10 license: Artistic-2.0 repository-code: "https://github.com/EpigenomeInformatics/methylTFRAnnotationMm10" diff --git a/DESCRIPTION b/DESCRIPTION index 089a9db..c50bf31 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -19,8 +19,8 @@ Authors@R: c( ) License: Artistic-2.0 Encoding: UTF-8 -Version: 0.99.10 -Depends: R (>= 4.3.0) +Version: 0.99.12 +Depends: R (>= 4.6.0) Imports: AnnotationHub, GenomicRanges, stats Suggests: knitr, rmarkdown, testthat (>= 3.0.0), BiocStyle VignetteBuilder: knitr diff --git a/NEWS.md b/NEWS.md index 8329e6b..a16cb42 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,25 @@ +# methylTFRAnnotationMm10 0.99.12 + +Changes in response to the second review: + +* Depends on R (>= 4.6.0). +* Input checking: an invalid `methylTFRAnnotationMm10.datadir` option or + `METHYL_TFRANNOTATION_Mm10_DIR` value (not a single string, or a directory + that does not exist) now gives an informative error. Tests + added. +* Added `inst/extdata/README.md` describing `metadata.csv` and + each AnnotationHub resource. +* The vignette's Installation section also installs methylTFR. + +# methylTFRAnnotationMm10 0.99.11 + +* BiocCheck fixes: the data help pages (`?motif_gcfreq`, + `?tf_bindsites`, `?genomewide_GC`) have a `\value` section, and + their examples run (reading `metadata.csv`) instead of using + `\dontrun`. +* Shortened vignette lines to at most 80 characters. +* Added `CITATION.cff`. + # methylTFRAnnotationMm10 0.99.10 Changes in response to the Bioconductor review: diff --git a/R/aaa-utils.R b/R/aaa-utils.R index b41698d..aa863e6 100644 --- a/R/aaa-utils.R +++ b/R/aaa-utils.R @@ -9,7 +9,24 @@ "methylTFRAnnotationMm10.datadir", Sys.getenv("METHYL_TFRANNOTATION_Mm10_DIR", "") ) - if (is.character(d) && length(d) == 1L && nzchar(d)) d else NULL + if (is.null(d) || identical(d, "")) { + return(NULL) + } + if (!is.character(d) || length(d) != 1L || is.na(d)) { + stop( + "The option methylTFRAnnotationMm10.datadir must be a single ", + "character string (a directory path)." + ) + } + if (!dir.exists(d)) { + stop( + "Local annotation directory does not exist: ", d, + "\nUnset options(methylTFRAnnotationMm10.datadir) and the ", + "METHYL_TFRANNOTATION_Mm10_DIR environment variable ", + "to use AnnotationHub." + ) + } + d } #' @keywords internal diff --git a/R/resources.R b/R/resources.R index aab262e..acc95b5 100644 --- a/R/resources.R +++ b/R/resources.R @@ -42,14 +42,18 @@ #' and \code{system.file("extdata", "metadata.csv", package = #' "methylTFRAnnotationMm10")} for the exact sources and versions. #' @seealso \code{\link{getGCfreq}}, \code{\link{methylTFRAnnotationMm10}} +#' @return This page documents a data resource rather than a +#' function; the object is returned by \code{\link{getGCfreq}}. #' @examples -#' ## On first use this downloads the resource from AnnotationHub: -#' \dontrun{ -#' gcfreqs <- getGCfreq("jaspar2020") -#' length(gcfreqs) # number of motifs -#' dim(gcfreqs[[1]]) # 5 x number of window positions -#' colSums(gcfreqs[[1]]) # all 1 -#' } +#' # AnnotationHub records of this resource and their descriptions +#' md <- utils::read.csv(system.file("extdata", "metadata.csv", +#' package = "methylTFRAnnotationMm10" +#' )) +#' md[grepl("_motif_gcfreq", md$Title), c("Title", "RDataClass")] +#' +#' # Loading the resource downloads it from AnnotationHub on first use: +#' # gcfreqs <- getGCfreq("jaspar2020") +#' # length(gcfreqs); dim(gcfreqs[[1]]); colSums(gcfreqs[[1]]) #' @keywords datasets NULL @@ -75,14 +79,18 @@ NULL #' } #' @source See \code{\link{motif_gcfreq}}. #' @seealso \code{\link{getTFbindsites}}, \code{\link{methylTFRAnnotationMm10}} +#' @return This page documents a data resource rather than a +#' function; the object is returned by \code{\link{getTFbindsites}}. #' @examples -#' ## On first use this downloads the resource from AnnotationHub: -#' \dontrun{ -#' tfbs <- getTFbindsites("jaspar2020") -#' length(tfbs) # number of motifs -#' head(lengths(tfbs)) # binding sites per motif -#' tfbs[[1]] -#' } +#' # AnnotationHub records of this resource and their descriptions +#' md <- utils::read.csv(system.file("extdata", "metadata.csv", +#' package = "methylTFRAnnotationMm10" +#' )) +#' md[grepl("_tf_bindsites", md$Title), c("Title", "RDataClass")] +#' +#' # Loading the resource downloads it from AnnotationHub on first use: +#' # tfbs <- getTFbindsites("jaspar2020") +#' # length(tfbs); head(lengths(tfbs)); tfbs[[1]] #' @keywords datasets NULL @@ -110,13 +118,17 @@ NULL #' \code{system.file("scripts", "make-data.R", package = #' "methylTFRAnnotationMm10")}. #' @seealso \code{\link{getGenomeGC}}, \code{\link{methylTFRAnnotationMm10}} +#' @return This page documents a data resource rather than a +#' function; the object is returned by \code{\link{getGenomeGC}}. #' @examples -#' ## On first use this downloads the resource from AnnotationHub: -#' \dontrun{ -#' gc <- getGenomeGC() -#' gc -#' table(gc$GC_bin) -#' S4Vectors::metadata(gc)$gc_breaks -#' } +#' # AnnotationHub records of this resource and their descriptions +#' md <- utils::read.csv(system.file("extdata", "metadata.csv", +#' package = "methylTFRAnnotationMm10" +#' )) +#' md[grepl("genomewide_GC", md$Title), c("Title", "RDataClass")] +#' +#' # Loading the resource downloads it from AnnotationHub on first use: +#' # gc <- getGenomeGC() +#' # table(gc$GC_bin); S4Vectors::metadata(gc)$gc_breaks #' @keywords datasets NULL diff --git a/inst/extdata/README.md b/inst/extdata/README.md new file mode 100644 index 0000000..7704997 --- /dev/null +++ b/inst/extdata/README.md @@ -0,0 +1,55 @@ +# methylTFRAnnotationMm10: `inst/extdata` + +This directory contains `metadata.csv`, the AnnotationHub metadata for +the resources served by methylTFRAnnotationMm10. The data files themselves +are hosted on AnnotationHub (they are too large to ship with the +package) and are downloaded on first use by the accessor functions. + +## Resources + +| Title | R class | Accessor | Help page | +|---|---|---|---| +| `altius_motif_gcfreq.rds` | `list` | `getGCfreq("altius")` | `?motif_gcfreq` | +| `altius_tf_bindsites.rds` | `GRangesList` | `getTFbindsites("altius")` | `?tf_bindsites` | +| `cisbpv2_motif_gcfreq.rds` | `list` | `getGCfreq("cisbpv2")` | `?motif_gcfreq` | +| `cisbpv2_tf_bindsites.rds` | `GRangesList` | `getTFbindsites("cisbpv2")` | `?tf_bindsites` | +| `genomewide_GC_mm10.rds` | `GRanges` | `getGenomeGC()` | `?genomewide_GC` | +| `jaspar2020_motif_gcfreq.rds` | `list` | `getGCfreq("jaspar2020")` | `?motif_gcfreq` | +| `jaspar2020_tf_bindsites.rds` | `GRangesList` | `getTFbindsites("jaspar2020")` | `?tf_bindsites` | + +* `_tf_bindsites.rds`: genome-wide motif matches for one motif set, + one `GRanges` per motif, each range extended by 200 bp on either side + of the match. +* `_motif_gcfreq.rds`: one 5 x n numeric matrix per motif. Rows are + genome-wide GC quintiles (lowest first), columns are positions of a + 30 nt window along the binding site; each column gives the fraction of + the motif's sites in each quintile and sums to one. +* `genomewide_GC_mm10.rds`: non-overlapping 30 nt windows across the + primary chromosomes with their GC fraction (`GC_bias`) and quintile + (`GC_bin`); the quintile boundaries are stored in the object's metadata. + +## Columns of `metadata.csv` + +| Column | Meaning | +|---|---| +| `Title` | Resource name; also the file name on AnnotationHub | +| `Description` | What the resource contains | +| `BiocVersion` | Bioconductor version the resource was added in | +| `Genome` | Genome assembly (`mm10`) | +| `SourceType` | Format of the source file (`RDS`) | +| `SourceUrl` | Where the input data (motifs, genome) come from | +| `SourceVersion` | Version of the motif collection or genome | +| `Species`, `TaxonomyId` | Organism and NCBI taxonomy ID | +| `Coordinate_1_based` | Coordinates are 1-based (`TRUE`) | +| `DataProvider` | Provider of the motif collection or genome | +| `Maintainer` | Maintainer of the resource | +| `RDataClass` | R class of the object (`GRangesList`, `list`, `GRanges`) | +| `DispatchClass` | How AnnotationHub loads the file (`Rds`) | +| `Location_Prefix`, `RDataPath` | Where the file is stored; joined, they give the download URL | +| `Tags` | Search tags for `AnnotationHub::query()` | + +## How the data were made + +* `inst/scripts/make-data.R` builds every resource with + [methylTFRAnnotationBuilder](https://github.com/EpigenomeInformatics/methylTFRAnnotationBuilder). +* `inst/scripts/make-metadata.R` writes this `metadata.csv`. diff --git a/man/genomewide_GC.Rd b/man/genomewide_GC.Rd index d6e1cef..fa487e2 100644 --- a/man/genomewide_GC.Rd +++ b/man/genomewide_GC.Rd @@ -22,6 +22,10 @@ Computed from the UCSC mm10 BSgenome package; see \code{system.file("scripts", "make-data.R", package = "methylTFRAnnotationMm10")}. } +\value{ +This page documents a data resource rather than a +function; the object is returned by \code{\link{getGenomeGC}}. +} \description{ GC content of the mm10 genome in non-overlapping 30 nt windows. Returned by \code{\link{getGenomeGC}}; the AnnotationHub @@ -33,13 +37,15 @@ windows to assign it a GC bin; the motif tables in \code{\link{motif_gcfreq}} use the same boundaries. } \examples{ -## On first use this downloads the resource from AnnotationHub: -\dontrun{ -gc <- getGenomeGC() -gc -table(gc$GC_bin) -S4Vectors::metadata(gc)$gc_breaks -} +# AnnotationHub records of this resource and their descriptions +md <- utils::read.csv(system.file("extdata", "metadata.csv", + package = "methylTFRAnnotationMm10" +)) +md[grepl("genomewide_GC", md$Title), c("Title", "RDataClass")] + +# Loading the resource downloads it from AnnotationHub on first use: +# gc <- getGenomeGC() +# table(gc$GC_bin); S4Vectors::metadata(gc)$gc_breaks } \seealso{ \code{\link{getGenomeGC}}, \code{\link{methylTFRAnnotationMm10}} diff --git a/man/motif_gcfreq.Rd b/man/motif_gcfreq.Rd index ff8ecd2..2cb5393 100644 --- a/man/motif_gcfreq.Rd +++ b/man/motif_gcfreq.Rd @@ -32,6 +32,10 @@ from BSgenome sequences; see and \code{system.file("extdata", "metadata.csv", package = "methylTFRAnnotationMm10")} for the exact sources and versions. } +\value{ +This page documents a data resource rather than a +function; the object is returned by \code{\link{getGCfreq}}. +} \description{ Per-motif tables describing the GC composition around each motif's binding sites on mm10. Returned by @@ -55,13 +59,15 @@ Available motif sets: } } \examples{ -## On first use this downloads the resource from AnnotationHub: -\dontrun{ -gcfreqs <- getGCfreq("jaspar2020") -length(gcfreqs) # number of motifs -dim(gcfreqs[[1]]) # 5 x number of window positions -colSums(gcfreqs[[1]]) # all 1 -} +# AnnotationHub records of this resource and their descriptions +md <- utils::read.csv(system.file("extdata", "metadata.csv", + package = "methylTFRAnnotationMm10" +)) +md[grepl("_motif_gcfreq", md$Title), c("Title", "RDataClass")] + +# Loading the resource downloads it from AnnotationHub on first use: +# gcfreqs <- getGCfreq("jaspar2020") +# length(gcfreqs); dim(gcfreqs[[1]]); colSums(gcfreqs[[1]]) } \seealso{ \code{\link{getGCfreq}}, \code{\link{methylTFRAnnotationMm10}} diff --git a/man/tf_bindsites.Rd b/man/tf_bindsites.Rd index 1e941b3..e50b873 100644 --- a/man/tf_bindsites.Rd +++ b/man/tf_bindsites.Rd @@ -17,6 +17,10 @@ are no metadata columns. Coordinates are 1-based. \source{ See \code{\link{motif_gcfreq}}. } +\value{ +This page documents a data resource rather than a +function; the object is returned by \code{\link{getTFbindsites}}. +} \description{ Genome-wide predicted transcription factor binding sites on mm10. Returned by \code{\link{getTFbindsites}}; the @@ -33,13 +37,15 @@ Available motif sets: } } \examples{ -## On first use this downloads the resource from AnnotationHub: -\dontrun{ -tfbs <- getTFbindsites("jaspar2020") -length(tfbs) # number of motifs -head(lengths(tfbs)) # binding sites per motif -tfbs[[1]] -} +# AnnotationHub records of this resource and their descriptions +md <- utils::read.csv(system.file("extdata", "metadata.csv", + package = "methylTFRAnnotationMm10" +)) +md[grepl("_tf_bindsites", md$Title), c("Title", "RDataClass")] + +# Loading the resource downloads it from AnnotationHub on first use: +# tfbs <- getTFbindsites("jaspar2020") +# length(tfbs); head(lengths(tfbs)); tfbs[[1]] } \seealso{ \code{\link{getTFbindsites}}, \code{\link{methylTFRAnnotationMm10}} diff --git a/tests/testthat/test-local-resources.R b/tests/testthat/test-local-resources.R index 00a0f5d..4a9856f 100644 --- a/tests/testthat/test-local-resources.R +++ b/tests/testthat/test-local-resources.R @@ -94,3 +94,16 @@ test_that("no local directory is used when neither option nor env var is set", { ) expect_null(methylTFRAnnotationMm10:::.local_dir()) }) + +test_that("an invalid local directory setting gives an informative error", { + old <- options(methylTFRAnnotationMm10.datadir = c("a", "b")) + on.exit(options(old), add = TRUE) + expect_error(getGenomeGC(), "single character string") + + options(methylTFRAnnotationMm10.datadir = 1) + expect_error(getGCfreq("altius"), "single character string") + + missing_dir <- file.path(tempdir(), "does_not_exist") + options(methylTFRAnnotationMm10.datadir = missing_dir) + expect_error(getTFbindsites("altius"), "does not exist") +}) diff --git a/vignettes/methylTFRAnnotationMm10.Rmd b/vignettes/methylTFRAnnotationMm10.Rmd index 52e3e97..b33d2fb 100644 --- a/vignettes/methylTFRAnnotationMm10.Rmd +++ b/vignettes/methylTFRAnnotationMm10.Rmd @@ -18,9 +18,9 @@ mm10. It contains three kinds of resources, each with its own accessor: | Accessor | Returns | Help page | |---|---|---| -| `getTFbindsites()` | TF binding sites, one `GRanges` per motif | `?tf_bindsites` | -| `getGCfreq()` | motif GC frequency tables, one matrix per motif | `?motif_gcfreq` | -| `getGenomeGC()` | genome-wide GC content in 30 nt windows | `?genomewide_GC` | +| `getTFbindsites()` | TF binding sites (a `GRangesList`) | `?tf_bindsites` | +| `getGCfreq()` | GC frequency tables, one per motif | `?motif_gcfreq` | +| `getGenomeGC()` | GC content in 30 nt windows | `?genomewide_GC` | The GC tables are what make the deviation score bias-corrected. A motif whose binding sites sit in GC-rich sequence overlaps CpG islands more @@ -40,6 +40,9 @@ if (!requireNamespace("BiocManager", quietly = TRUE)) { install.packages("BiocManager") } BiocManager::install("methylTFRAnnotationMm10") + +# methylTFR, which uses these annotations +BiocManager::install("methylTFR") ``` # Example data used in this vignette