Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
19 changes: 18 additions & 1 deletion R/aaa-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
54 changes: 33 additions & 21 deletions R/resources.R
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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
55 changes: 55 additions & 0 deletions inst/extdata/README.md
Original file line number Diff line number Diff line change
@@ -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` |

* `<set>_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.
* `<set>_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`.
20 changes: 13 additions & 7 deletions man/genomewide_GC.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 13 additions & 7 deletions man/motif_gcfreq.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 13 additions & 7 deletions man/tf_bindsites.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions tests/testthat/test-local-resources.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
})
9 changes: 6 additions & 3 deletions vignettes/methylTFRAnnotationMm10.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading