diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 1989570..8eae874 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -24,7 +24,7 @@ jobs: - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - {os: ubuntu-latest, r: 'release'} - {os: ubuntu-latest, r: 'oldrel-1'} - - {os: ubuntu-latest, r: '4.2.0'} + - {os: ubuntu-latest, r: '4.5.0'} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} diff --git a/DESCRIPTION b/DESCRIPTION index 7ca59f2..d4d1507 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -31,6 +31,7 @@ Roxygen: list(markdown = TRUE) Suggests: BiocStyle, knitr, + magick, rmarkdown, IlluminaHumanMethylation450kanno.ilmn12.hg19, IlluminaHumanMethylationEPICanno.ilm10b4.hg19, @@ -53,7 +54,7 @@ Imports: stats VignetteBuilder: knitr Depends: - R (>= 4.2.0) + R (>= 4.5.0) LazyData: true URL: https://ericknavarrod.github.io/RAMEN/ , diff --git a/NEWS.md b/NEWS.md index 68e2ce7..31b1500 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# RAMEN 2.1.0 +# RAMEN 2.1.0 - July 14, 2026 This minor version presents a couple of changes that improve the integration of RAMEN with GenomicRanges objects and Bioconductor: diff --git a/R/findVML.R b/R/findVML.R index cff6c71..06d1a32 100644 --- a/R/findVML.R +++ b/R/findVML.R @@ -154,8 +154,8 @@ map_revmap_names <- function(positions, manifest_hvp) { #' #' @export #' @examples -#' # Set the parallel backend to use 2 workers -#' doParallel::registerDoParallel(2) +#' # Evaluate sequentially +#' foreach::registerDoSEQ() #' VML <- RAMEN::findVML( #' methylation_data = RAMEN::test_methylation_data, #' array_manifest = "IlluminaHumanMethylationEPICv1", diff --git a/R/lmGE.R b/R/lmGE.R index ca4e2de..33638ed 100644 --- a/R/lmGE.R +++ b/R/lmGE.R @@ -121,8 +121,8 @@ #' @importFrom foreach %do% #' @export #' @examples -#' # Set the parallel backend to use 2 workers -#' doParallel::registerDoParallel(2) +#' # Evaluate sequentially +#' foreach::registerDoSEQ() #' ## Find VML in test data #' VML <- RAMEN::findVML( #' methylation_data = RAMEN::test_methylation_data, @@ -215,7 +215,8 @@ lmGE <- function(selected_variables, selected_genot %in% empty_lists)) # Select the winning model winning_models <- foreach::foreach(i = seq_len(nrow(selected_variables)), - .combine = "rbind") %dopar% { # For every VML + .combine = "rbind", + .export = "empty_lists") %dopar% { # For every VML #### Prepare data sets #### # Create the data frame with all the information for each VML VML_i <- selected_variables[i, ] diff --git a/R/medCorVMR.R b/R/medCorVMR.R index 2e42653..bc6b798 100644 --- a/R/medCorVMR.R +++ b/R/medCorVMR.R @@ -23,8 +23,8 @@ #' @export #' #' @examples -#' # Set the parallel backend to use 2 workers -#' doParallel::registerDoParallel(2) +#' # Evaluate sequentially +#' foreach::registerDoSEQ() #' # Create a VML object #' VML <- GenomicRanges::GRanges(seqnames = c("chr21", "chr21"), #' ranges = IRanges::IRanges(start = c(10861376, 10862171), diff --git a/R/nullDistGE.R b/R/nullDistGE.R index 322ca20..d2722b3 100644 --- a/R/nullDistGE.R +++ b/R/nullDistGE.R @@ -54,8 +54,8 @@ #' @importFrom foreach %do% #' @export #' @examples -#' # Set the parallel backend to use 2 workers -#' doParallel::registerDoParallel(2) +#' # Evaluate sequentially +#' foreach::registerDoSEQ() #' ## Find VML in test data #' VML <- findVML( #' methylation_data = test_methylation_data, @@ -166,7 +166,7 @@ nullDistGE <- function(VML_wSNPs, environmental_matrix = permutated_environment, covariates = covariates, summarized_methyl_VML = summarized_methyl_VML, - seed = 1 + seed = seed ) message("Starting lmGE in permutation ", i, " of ", permutations) diff --git a/R/selectVariables.R b/R/selectVariables.R index 93ba630..2bfcaf1 100644 --- a/R/selectVariables.R +++ b/R/selectVariables.R @@ -107,8 +107,8 @@ #' #' @examples #' ## Find VML in test data -#' # Set the parallel backend to use 2 workers -#' doParallel::registerDoParallel(2) +#' # Evaluate sequentially +#' foreach::registerDoSEQ() #' VML <- RAMEN::findVML( #' methylation_data = RAMEN::test_methylation_data, #' array_manifest = "IlluminaHumanMethylationEPICv1", @@ -176,7 +176,12 @@ selectVariables <- function(VML_wSNPs, i <- NULL # To avoid R CMD check note about undefined global variable #### Run LASSO #### lasso_results <- foreach::foreach(i = VML_wSNPs$VML_index, - .combine = "rbind") %dorng% { + .combine = "rbind", + .packages = c("GenomicRanges", + "S4Vectors", + "IRanges", + "glmnet"), + .export = "empty_lists") %dorng% { #### Prepare data sets #### VML_i <- VML_wSNPs[VML_wSNPs$VML_index == i] # Select summarized VML information diff --git a/R/summarizeVML.R b/R/summarizeVML.R index 61c423f..3196b2d 100644 --- a/R/summarizeVML.R +++ b/R/summarizeVML.R @@ -22,8 +22,8 @@ #' #' @examples #' ## Find VML in test data -#' # Set the parallel backend to use 2 workers -#' doParallel::registerDoParallel(2) +#' # Evaluate sequentially +#' foreach::registerDoSEQ() #' VML <- findVML( #' methylation_data = test_methylation_data, #' array_manifest = "IlluminaHumanMethylationEPICv1", @@ -50,7 +50,6 @@ summarizeVML <- function(VML, if (!"VML_index" %in% colnames(S4Vectors::mcols(VML))) { S4Vectors::mcols(VML)$VML_index <- paste0("VML", seq_len(length(VML))) } - if (!all(unique(unlist(VML$probes)) %in% rownames(methylation_data))) { warning(paste("Some probes listed in the VML data frame are not found in", "the methylation data. Please check that all probes listed in the 'probes'", @@ -61,14 +60,12 @@ summarizeVML <- function(VML, if (!is.list(VML$probes)) { stop("Please make sure the 'probes' column in the VML object is a list") } - - VML_index <- i <- NULL # To avoid R CMD check notes - + mcols_vml <- S4Vectors::mcols(VML) + VML_1 <- i <- NULL # To avoid R CMD check notes #### Summarize VML #### - summarized_VML <- foreach::foreach(i = VML$VML_index, + summarized_VML <- foreach::foreach(i = mcols_vml$VML_index, .combine = "cbind") %dopar% { - probes <- VML[VML$VML_index == i]$probes |> - unlist() + probes <- unlist(mcols_vml$probes[mcols_vml$VML_index == i]) subset_meth <- methylation_data[probes, , drop = FALSE] median <- apply(subset_meth, 2, median, na.rm = TRUE) matrix(median, ncol = 1, dimnames = list(NULL, i)) diff --git a/README.Rmd b/README.Rmd index 23166ca..c19f601 100644 --- a/README.Rmd +++ b/README.Rmd @@ -76,8 +76,11 @@ BiocManager::install("ErickNavarroD/RAMEN") ## Usage -For a detailed tutorial on how to use RAMEN, please check the package's vignette -or [website](https://ericknavarrod.github.io/RAMEN/articles/RAMEN.html). +For a detailed tutorial on how to use RAMEN, please check the package's vignette, +which you can build locally by running +` BiocManager::install("ErickNavarroD/RAMEN", build_vignettes = TRUE)` +or see externally in its +[website](https://ericknavarrod.github.io/RAMEN/articles/RAMEN.html). Altogether, RAMEN provides a workflow that takes a set of individuals with genome, exposome and DNA methylome information, and generates an estimation of the contribution of genetic variants and environmental exposures to its DNA diff --git a/README.md b/README.md index eb9e13e..f6b8f40 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,9 @@ BiocManager::install("ErickNavarroD/RAMEN") ## Usage For a detailed tutorial on how to use RAMEN, please check the package’s -vignette or +vignette, which you can build locally by running +`BiocManager::install("ErickNavarroD/RAMEN", build_vignettes = TRUE)` +or see externally in its [website](https://ericknavarrod.github.io/RAMEN/articles/RAMEN.html). Altogether, RAMEN provides a workflow that takes a set of individuals with genome, exposome and DNA methylome information, and generates an @@ -234,6 +236,60 @@ selected_variables <- RAMEN::selectVariables( summarized_methyl_VML = summarized_methyl_VML, seed = 1 ) +#> Loading required package: stats4 +#> Loading required package: BiocGenerics +#> Loading required package: generics +#> +#> Attaching package: 'generics' +#> The following object is masked from 'package:dplyr': +#> +#> explain +#> The following objects are masked from 'package:base': +#> +#> as.difftime, as.factor, as.ordered, intersect, is.element, setdiff, +#> setequal, union +#> +#> Attaching package: 'BiocGenerics' +#> The following object is masked from 'package:dplyr': +#> +#> combine +#> The following objects are masked from 'package:stats': +#> +#> IQR, mad, sd, var, xtabs +#> The following objects are masked from 'package:base': +#> +#> anyDuplicated, aperm, append, as.data.frame, basename, cbind, +#> colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find, +#> get, grep, grepl, is.unsorted, lapply, Map, mapply, match, mget, +#> order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank, +#> rbind, Reduce, rownames, sapply, saveRDS, table, tapply, unique, +#> unsplit, which.max, which.min +#> Loading required package: S4Vectors +#> +#> Attaching package: 'S4Vectors' +#> The following objects are masked from 'package:dplyr': +#> +#> first, rename +#> The following object is masked from 'package:utils': +#> +#> findMatches +#> The following objects are masked from 'package:base': +#> +#> expand.grid, I, unname +#> Loading required package: IRanges +#> +#> Attaching package: 'IRanges' +#> The following objects are masked from 'package:dplyr': +#> +#> collapse, desc, slice +#> Loading required package: Seqinfo +#> Loading required package: Matrix +#> +#> Attaching package: 'Matrix' +#> The following object is masked from 'package:S4Vectors': +#> +#> expand +#> Loaded glmnet 5.0 #> Loading required package: rngtools head(selected_variables) diff --git a/man/findVML.Rd b/man/findVML.Rd index 5629a4f..0f3d8d9 100644 --- a/man/findVML.Rd +++ b/man/findVML.Rd @@ -147,8 +147,8 @@ them, you can do so in the methylation_data object before running the function. } \examples{ -# Set the parallel backend to use 2 workers -doParallel::registerDoParallel(2) +# Evaluate sequentially +foreach::registerDoSEQ() VML <- RAMEN::findVML( methylation_data = RAMEN::test_methylation_data, array_manifest = "IlluminaHumanMethylationEPICv1", diff --git a/man/lmGE.Rd b/man/lmGE.Rd index 7cf36de..0b50150 100644 --- a/man/lmGE.Rd +++ b/man/lmGE.Rd @@ -166,8 +166,8 @@ further information, we suggest the users to read the documentation and publication of the relaimpo R package (Grömping, 2006). } \examples{ -# Set the parallel backend to use 2 workers -doParallel::registerDoParallel(2) +# Evaluate sequentially +foreach::registerDoSEQ() ## Find VML in test data VML <- RAMEN::findVML( methylation_data = RAMEN::test_methylation_data, diff --git a/man/medCorVMR.Rd b/man/medCorVMR.Rd index c812003..1e79535 100644 --- a/man/medCorVMR.Rd +++ b/man/medCorVMR.Rd @@ -34,8 +34,8 @@ function can be run as usual. It is recommended to also set options(future.globals.maxSize= +Inf). } \examples{ -# Set the parallel backend to use 2 workers -doParallel::registerDoParallel(2) +# Evaluate sequentially +foreach::registerDoSEQ() # Create a VML object VML <- GenomicRanges::GRanges(seqnames = c("chr21", "chr21"), ranges = IRanges::IRanges(start = c(10861376, 10862171), diff --git a/man/nullDistGE.Rd b/man/nullDistGE.Rd index afb91ed..458a386 100644 --- a/man/nullDistGE.Rd +++ b/man/nullDistGE.Rd @@ -114,8 +114,8 @@ distribution and reduces the computational time. For further information please read the RAMEN paper (https://doi.org/10.1186/s13059-025-03864-4). } \examples{ -# Set the parallel backend to use 2 workers -doParallel::registerDoParallel(2) +# Evaluate sequentially +foreach::registerDoSEQ() ## Find VML in test data VML <- findVML( methylation_data = test_methylation_data, diff --git a/man/selectVariables.Rd b/man/selectVariables.Rd index 37c80f6..a15a49c 100644 --- a/man/selectVariables.Rd +++ b/man/selectVariables.Rd @@ -127,8 +127,8 @@ Note: If you want to conduct the variable selection step only in one data set } \examples{ ## Find VML in test data -# Set the parallel backend to use 2 workers -doParallel::registerDoParallel(2) +# Evaluate sequentially +foreach::registerDoSEQ() VML <- RAMEN::findVML( methylation_data = RAMEN::test_methylation_data, array_manifest = "IlluminaHumanMethylationEPICv1", diff --git a/man/summarizeVML.Rd b/man/summarizeVML.Rd index 45a4db4..4f4bca8 100644 --- a/man/summarizeVML.Rd +++ b/man/summarizeVML.Rd @@ -35,8 +35,8 @@ function can be run as usual. } \examples{ ## Find VML in test data -# Set the parallel backend to use 2 workers -doParallel::registerDoParallel(2) +# Evaluate sequentially +foreach::registerDoSEQ() VML <- findVML( methylation_data = test_methylation_data, array_manifest = "IlluminaHumanMethylationEPICv1", diff --git a/vignettes/RAMEN.Rmd b/vignettes/RAMEN.Rmd index a1a2703..c1a53d9 100644 --- a/vignettes/RAMEN.Rmd +++ b/vignettes/RAMEN.Rmd @@ -201,6 +201,13 @@ design and the plataform, but the steps generally follow this structure: can be done using the ComBat function from the [sva package](https://bioconductor.org/packages/release/bioc/html/sva.html). +We recommend using M values over Beta values, since M value distributions +provide more statistically valid properties for linear modelling, such as being +approximately homoscedastic, unbounded, and with a lower compression at the +methylated and unmethylated values (for more details see +[Pan Du, *et al.*, BMC Bioinformatics, 2010](https://doi.org/10.1186/1471-2105-11-587)). + + ### Exposome data The exposome is a highly heterogeneous data set, as it can encompass variables