From 834e53216ccfcd045a06b59f26ce35ddd9bf57fe Mon Sep 17 00:00:00 2001 From: Dariusz Scigocki Date: Mon, 16 Feb 2026 12:09:39 +0000 Subject: [PATCH 1/8] docs: fix vignette index entry and add missing chunk labels --- vignettes/gDR-annotation.Rmd | 8 ++++---- vignettes/gDR-data-model.Rmd | 2 +- vignettes/gDRcore.Rmd | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/vignettes/gDR-annotation.Rmd b/vignettes/gDR-annotation.Rmd index cd9f86bf..1f9e57bb 100644 --- a/vignettes/gDR-annotation.Rmd +++ b/vignettes/gDR-annotation.Rmd @@ -8,7 +8,7 @@ vignette: > %\VignetteEncoding{UTF-8} --- -```{r, include = FALSE} +```{r init, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" @@ -36,7 +36,7 @@ Alternatively, users can use other annotation files stored outside of this packa - `GDR_CELLLINE_ANNOTATION`: Represents the path to the cell line annotation CSV file. - `GDR_DRUG_ANNOTATION`: Represents the path to the drug annotation CSV file. -```{r, eval=FALSE} +```{r set_envvar, eval=FALSE} Sys.setenv(GDR_CELLLINE_ANNOTATION = "some/path/to/cell_line_annotation.csv") Sys.setenv(GDR_DRUG_ANNOTATION = "some/path/to/drug_annotation.csv") ``` @@ -45,7 +45,7 @@ Sys.setenv(GDR_DRUG_ANNOTATION = "some/path/to/drug_annotation.csv") To turn off the usage of external paths for data annotation, please set these two environmental variables to empty. -```{r, eval=FALSE} +```{r set_envvar_2, eval=FALSE} Sys.setenv(GDR_CELLLINE_ANNOTATION = "") Sys.setenv(GDR_DRUG_ANNOTATION = "") ``` @@ -76,7 +76,7 @@ If some information is not known for the cell line or drug, the corresponding fi To annotate `SummarizedExperiment` and `MultiAssayExperiment` objects, use the functions `annotate_se_with_drug`, `annotate_mae_with_drug`, `annotate_se_with_cell_line`, and `annotate_mae_with_cell_line`. These functions take the experiment objects and the corresponding annotation tables as input and return the annotated objects. -```{r, eval=FALSE} +```{r annotation, eval=FALSE} # Example for SummarizedExperiment se <- SummarizedExperiment::SummarizedExperiment( rowData = data.table::data.table(Gnumber = c("D1", "D2", "D3")) diff --git a/vignettes/gDR-data-model.Rmd b/vignettes/gDR-data-model.Rmd index cb31f1dc..4d379174 100644 --- a/vignettes/gDR-data-model.Rmd +++ b/vignettes/gDR-data-model.Rmd @@ -9,7 +9,7 @@ output: abstract: | This vignette comprehensively describes the data model used in the gDRsuite. vignette: | - %\VignetteIndexEntry{Vignette Title} + %\VignetteIndexEntry{gDRcore} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- diff --git a/vignettes/gDRcore.Rmd b/vignettes/gDRcore.Rmd index 4216ce5f..5288584d 100644 --- a/vignettes/gDRcore.Rmd +++ b/vignettes/gDRcore.Rmd @@ -8,7 +8,7 @@ vignette: > %\VignetteEncoding{UTF-8} --- -```{r, include = FALSE} +```{r init, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" @@ -87,13 +87,13 @@ Please familiarize yourself with the `gDRimport` package, which contains a varie This example is based on the artificial dataset called `data1` available within the `gDRimport` package. `gDR` requires three types of data that should be used as the raw input: Template, Manifest, and RawData. More information about these three types of data can be found in our general documentation. -```{r} +```{r get_testdata} td <- gDRimport::get_test_data() ``` The provided dataset needs to be merged into one `data.table` object to be able to run the gDR pipeline. This process can be done using two functions: `gDRimport::load_data()` and `gDRcore::merge_data()`. -```{r, include=FALSE} +```{r load_data, include=FALSE} loaded_data <- suppressMessages( gDRimport::load_data( @@ -110,16 +110,16 @@ head(input_df) We provide an all-in-one function that splits data into appropriate data types, creates the SummarizedExperiment object for each data type, splits data into treatment and control assays, normalizes, averages, calculates gDR metrics, and finally, creates the MultiAssayExperiment object. This function is called `runDrugResponseProcessingPipeline`. -```{r, message = FALSE, results = FALSE, warning = FALSE} +```{r run_pipeline, message = FALSE, results = FALSE, warning = FALSE} mae <- runDrugResponseProcessingPipeline(input_df) ``` -```{r} +```{r mae} mae ``` And we can subset the MultiAssayExperiment to receive the SummarizedExperiment specific to any data type, e.g. -```{r} +```{r single-agent} mae[["single-agent"]] ``` From 2fd7d89ec57d2151f409c41939bc702bd076f8dc Mon Sep 17 00:00:00 2001 From: Dariusz Scigocki Date: Mon, 16 Feb 2026 12:28:57 +0000 Subject: [PATCH 2/8] fix: move global logic to .onLoad and resolve stack imbalance --- R/constants.R | 11 -------- R/packages.R | 54 --------------------------------------- R/zzz.R | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 65 deletions(-) delete mode 100644 R/constants.R create mode 100644 R/zzz.R diff --git a/R/constants.R b/R/constants.R deleted file mode 100644 index 8a0b9372..00000000 --- a/R/constants.R +++ /dev/null @@ -1,11 +0,0 @@ -.drugNameRegex <- sprintf("^%s$|^%s_[[:digit:]]+$", - gDRutils::get_env_identifiers("drug_name"), - gDRutils::get_env_identifiers("drug_name")) - -.untreated_tag_patterns <- vapply( - gDRutils::get_env_identifiers("untreated_tag"), - sprintf, - fmt = "^%s$", - character(1) -) -.untreatedDrugNameRegex <- paste(.untreated_tag_patterns, collapse = "|") diff --git a/R/packages.R b/R/packages.R index 9da7c36c..63a43774 100644 --- a/R/packages.R +++ b/R/packages.R @@ -4,58 +4,4 @@ # data.table awareness .datatable.aware <- TRUE -patterns <- data.table:::patterns - -#' onload function -#' -#' @param libname library name -#' @param pkgname package name -#' @noRd -.onLoad <- function(libname, pkgname) { - # scientific notation was disabled due to the problem with unit tests - options(scipen = 999) - - cores <- Sys.getenv("NUM_CORES") - # based on https://github.com/Bioconductor/BiocParallel/issues/98 - if (.Platform$OS.type != "windows" && cores != "") { - BiocParallel::register( - BiocParallel::MulticoreParam(workers = as.numeric(cores)), - default = TRUE - ) - } else { - BiocParallel::register( - BiocParallel::SerialParam(), - default = TRUE - ) - } -} - -# Prevent R CMD check from complaining about the use of pipe expressions -# standard data.table variables -if (getRversion() >= "2.15.1") { - utils::globalVariables( - c( - "normalization_type", - ".", - "rn", - "column", - "CorrectedReadout", - "cotrt_value", - "x", - "Duration", - "isDay0", - "record_id", - "ratio", - "smooth", - "priority1", - "priority2", - "x.N", - "..cotrt_var", - "..present_ref_cols", - "..y", - "LogFoldChange", - "ReadoutValue" - ), - utils::packageName()) -} diff --git a/R/zzz.R b/R/zzz.R new file mode 100644 index 00000000..86af8108 --- /dev/null +++ b/R/zzz.R @@ -0,0 +1,71 @@ + +.drugNameRegex <- NULL +.untreated_tag_patterns <- NULL +.untreatedDrugNameRegex <- NULL +patterns <- NULL + +#' onload function +#' +#' @param libname library name +#' @param pkgname package name +#' @noRd +.onLoad <- function(libname, pkgname) { + # scientific notation was disabled due to the problem with unit tests + options(scipen = 999) + + cores <- Sys.getenv("NUM_CORES") + # based on https://github.com/Bioconductor/BiocParallel/issues/98 + if (.Platform$OS.type != "windows" && cores != "") { + BiocParallel::register( + BiocParallel::MulticoreParam(workers = as.numeric(cores)), + default = TRUE + ) + } else { + BiocParallel::register( + BiocParallel::SerialParam(), + default = TRUE + ) + } + # CONS + .drugNameRegex <<- sprintf("^%s$|^%s_[[:digit:]]+$", + gDRutils::get_env_identifiers("drug_name"), + gDRutils::get_env_identifiers("drug_name")) + + .untreated_tag_patterns <<- vapply( + gDRutils::get_env_identifiers("untreated_tag"), + sprintf, + fmt = "^%s$", + character(1) + ) + .untreatedDrugNameRegex <<- paste(.untreated_tag_patterns, collapse = "|") + + # data.table compatible + patterns <<- data.table:::patterns + utils::globalVariables( + c( + ".", + "..cotrt_var", + "..present_ref_cols", + "..y", + "bliss_score", + "column", + "CorrectedReadout", + "cotrt_value", + "Duration", + "hsa_score", + "isDay0", + "LogFoldChange", + "normalization_type", + "priority1", + "priority2", + "ratio", + "ReadoutValue", + "ReadoutValue_T0", + "record_id", + "rn", + "smooth", + "x", + "x.N" + ), + pkgname) +} From a5456b0d4d77c7292bee96f62273d0253022fa66 Mon Sep 17 00:00:00 2001 From: Dariusz Scigocki Date: Mon, 16 Feb 2026 17:11:04 +0000 Subject: [PATCH 3/8] fix: resolve stack imbalance in sprintf by decoupling env identifier calls --- R/zzz.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/R/zzz.R b/R/zzz.R index 86af8108..eac2a7e4 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -27,9 +27,8 @@ patterns <- NULL ) } # CONS - .drugNameRegex <<- sprintf("^%s$|^%s_[[:digit:]]+$", - gDRutils::get_env_identifiers("drug_name"), - gDRutils::get_env_identifiers("drug_name")) + drugs_id <- gDRutils::get_env_identifiers("drug_name") + .drugNameRegex <<- sprintf("^%s$|^%s_[[:digit:]]+$", drugs_id, drugs_id) .untreated_tag_patterns <<- vapply( gDRutils::get_env_identifiers("untreated_tag"), From cb29ae0d3e9729c8480d1d061a10f2d3d010b2c9 Mon Sep 17 00:00:00 2001 From: Dariusz Scigocki Date: Mon, 16 Feb 2026 18:19:56 +0000 Subject: [PATCH 4/8] bump version --- DESCRIPTION | 4 ++-- NEWS.md | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index efb2c098..b60dca14 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,8 @@ Type: Package Package: gDRcore Title: Processing functions and interface to process and analyze drug dose-response data -Version: 1.9.4 -Date: 2026-02-02 +Version: 1.9.5 +Date: 2026-02-16 Authors@R: c( person("Bartosz", "Czech", , "bartosz.czech@contractors.roche.com", role = "aut", comment = c(ORCID = "0000-0002-9908-3007")), diff --git a/NEWS.md b/NEWS.md index e2957313..ee3e6f20 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +## gDRcore 1.9.5 - 2026-02-16 +* fix stack imbalance warnings during byte-compilation + ## gDRcore 1.9.4 - 2026-02-02 * remove duplicated code from `map_references` in `map_untreated` From b77e73303699749e722582a991fdf872be059772 Mon Sep 17 00:00:00 2001 From: Dariusz Scigocki Date: Mon, 16 Feb 2026 19:58:34 +0000 Subject: [PATCH 5/8] refactor: use assignInNamespace for explicit package variable initialization --- R/zzz.R | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/R/zzz.R b/R/zzz.R index eac2a7e4..6e198c30 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,9 +1,3 @@ - -.drugNameRegex <- NULL -.untreated_tag_patterns <- NULL -.untreatedDrugNameRegex <- NULL -patterns <- NULL - #' onload function #' #' @param libname library name @@ -28,18 +22,19 @@ patterns <- NULL } # CONS drugs_id <- gDRutils::get_env_identifiers("drug_name") - .drugNameRegex <<- sprintf("^%s$|^%s_[[:digit:]]+$", drugs_id, drugs_id) + assignInNamespace(".drugNameRegex", sprintf("^%s$|^%s_[[:digit:]]+$", drugs_id, drugs_id), ns = pkgname) - .untreated_tag_patterns <<- vapply( + untreated_tag_patterns <- vapply( gDRutils::get_env_identifiers("untreated_tag"), sprintf, fmt = "^%s$", character(1) ) - .untreatedDrugNameRegex <<- paste(.untreated_tag_patterns, collapse = "|") + assignInNamespace(".untreated_tag_patterns", untreated_tag_patterns, ns = pkgname) + assignInNamespace(".untreatedDrugNameRegex", paste(untreated_tag_patterns, collapse = "|"), ns = pkgname) # data.table compatible - patterns <<- data.table:::patterns + assignInNamespace("patterns", data.table:::patterns, ns = pkgname) utils::globalVariables( c( ".", From ca6d3ae67dbd64683ec7dfba85e10d4997e21ff4 Mon Sep 17 00:00:00 2001 From: Dariusz Scigocki Date: Mon, 16 Feb 2026 20:35:11 +0000 Subject: [PATCH 6/8] revert changes --- R/zzz.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/R/zzz.R b/R/zzz.R index 6e198c30..5a339eda 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,3 +1,9 @@ + +.drugNameRegex <- NULL +.untreated_tag_patterns <- NULL +.untreatedDrugNameRegex <- NULL +patterns <- NULL + #' onload function #' #' @param libname library name From 26c0e80f0b9870bc74ed6ba1b8a31652effb2863 Mon Sep 17 00:00:00 2001 From: Dariusz Scigocki Date: Mon, 16 Feb 2026 21:28:30 +0000 Subject: [PATCH 7/8] fix: added prefixes in zzz.R --- R/zzz.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/zzz.R b/R/zzz.R index 5a339eda..0e1185ae 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -28,7 +28,7 @@ patterns <- NULL } # CONS drugs_id <- gDRutils::get_env_identifiers("drug_name") - assignInNamespace(".drugNameRegex", sprintf("^%s$|^%s_[[:digit:]]+$", drugs_id, drugs_id), ns = pkgname) + utils::assignInNamespace(".drugNameRegex", sprintf("^%s$|^%s_[[:digit:]]+$", drugs_id, drugs_id), ns = pkgname) untreated_tag_patterns <- vapply( gDRutils::get_env_identifiers("untreated_tag"), @@ -36,11 +36,11 @@ patterns <- NULL fmt = "^%s$", character(1) ) - assignInNamespace(".untreated_tag_patterns", untreated_tag_patterns, ns = pkgname) - assignInNamespace(".untreatedDrugNameRegex", paste(untreated_tag_patterns, collapse = "|"), ns = pkgname) + utils::assignInNamespace(".untreated_tag_patterns", untreated_tag_patterns, ns = pkgname) + utils::assignInNamespace(".untreatedDrugNameRegex", paste(untreated_tag_patterns, collapse = "|"), ns = pkgname) # data.table compatible - assignInNamespace("patterns", data.table:::patterns, ns = pkgname) + utils::assignInNamespace("patterns", data.table:::patterns, ns = pkgname) utils::globalVariables( c( ".", From 373d4e68577380a5a933f1f1d8a815ade689b76e Mon Sep 17 00:00:00 2001 From: Dariusz Scigocki Date: Tue, 17 Feb 2026 09:22:30 +0000 Subject: [PATCH 8/8] docs: add descriptive and unique chunk labels to all vignettes --- vignettes/gDR-annotation.Rmd | 10 +++++----- vignettes/gDR-data-model.Rmd | 2 +- vignettes/gDRcore.Rmd | 16 ++++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/vignettes/gDR-annotation.Rmd b/vignettes/gDR-annotation.Rmd index 1f9e57bb..7078f851 100644 --- a/vignettes/gDR-annotation.Rmd +++ b/vignettes/gDR-annotation.Rmd @@ -8,7 +8,7 @@ vignette: > %\VignetteEncoding{UTF-8} --- -```{r init, include = FALSE} +```{r knitr-setup, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" @@ -36,7 +36,7 @@ Alternatively, users can use other annotation files stored outside of this packa - `GDR_CELLLINE_ANNOTATION`: Represents the path to the cell line annotation CSV file. - `GDR_DRUG_ANNOTATION`: Represents the path to the drug annotation CSV file. -```{r set_envvar, eval=FALSE} +```{r set-external-annotations, eval=FALSE} Sys.setenv(GDR_CELLLINE_ANNOTATION = "some/path/to/cell_line_annotation.csv") Sys.setenv(GDR_DRUG_ANNOTATION = "some/path/to/drug_annotation.csv") ``` @@ -45,7 +45,7 @@ Sys.setenv(GDR_DRUG_ANNOTATION = "some/path/to/drug_annotation.csv") To turn off the usage of external paths for data annotation, please set these two environmental variables to empty. -```{r set_envvar_2, eval=FALSE} +```{r unset-external-annotations, eval=FALSE} Sys.setenv(GDR_CELLLINE_ANNOTATION = "") Sys.setenv(GDR_DRUG_ANNOTATION = "") ``` @@ -76,7 +76,7 @@ If some information is not known for the cell line or drug, the corresponding fi To annotate `SummarizedExperiment` and `MultiAssayExperiment` objects, use the functions `annotate_se_with_drug`, `annotate_mae_with_drug`, `annotate_se_with_cell_line`, and `annotate_mae_with_cell_line`. These functions take the experiment objects and the corresponding annotation tables as input and return the annotated objects. -```{r annotation, eval=FALSE} +```{r annotate-experiment-objects, eval=FALSE} # Example for SummarizedExperiment se <- SummarizedExperiment::SummarizedExperiment( rowData = data.table::data.table(Gnumber = c("D1", "D2", "D3")) @@ -104,6 +104,6 @@ Proper annotation of drug and cell line data is crucial for running the gDR pipe # SessionInfo {-} -```{r sessionInfo} +```{r session-info} sessionInfo() ``` diff --git a/vignettes/gDR-data-model.Rmd b/vignettes/gDR-data-model.Rmd index 4d379174..65678f5b 100644 --- a/vignettes/gDR-data-model.Rmd +++ b/vignettes/gDR-data-model.Rmd @@ -110,6 +110,6 @@ In gDR `r Biocpkg("BumpyMatrix")` objects can be easily transformed into the `r # Session info {.unnumbered} -```{r sessionInfo, echo=FALSE} +```{r session-info, echo=FALSE} sessionInfo() ``` diff --git a/vignettes/gDRcore.Rmd b/vignettes/gDRcore.Rmd index 5288584d..c9415b22 100644 --- a/vignettes/gDRcore.Rmd +++ b/vignettes/gDRcore.Rmd @@ -8,14 +8,14 @@ vignette: > %\VignetteEncoding{UTF-8} --- -```{r init, include = FALSE} +```{r knitr-config, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` -```{r setup, echo = FALSE} +```{r load-gdr-libraries, echo = FALSE} library(gDRtestData) library(gDRcore) log_level <- futile.logger::flog.threshold("ERROR") @@ -87,13 +87,13 @@ Please familiarize yourself with the `gDRimport` package, which contains a varie This example is based on the artificial dataset called `data1` available within the `gDRimport` package. `gDR` requires three types of data that should be used as the raw input: Template, Manifest, and RawData. More information about these three types of data can be found in our general documentation. -```{r get_testdata} +```{r fetch-import-test-data} td <- gDRimport::get_test_data() ``` The provided dataset needs to be merged into one `data.table` object to be able to run the gDR pipeline. This process can be done using two functions: `gDRimport::load_data()` and `gDRcore::merge_data()`. -```{r load_data, include=FALSE} +```{r merge-manifest-templates-results, include=FALSE} loaded_data <- suppressMessages( gDRimport::load_data( @@ -110,16 +110,16 @@ head(input_df) We provide an all-in-one function that splits data into appropriate data types, creates the SummarizedExperiment object for each data type, splits data into treatment and control assays, normalizes, averages, calculates gDR metrics, and finally, creates the MultiAssayExperiment object. This function is called `runDrugResponseProcessingPipeline`. -```{r run_pipeline, message = FALSE, results = FALSE, warning = FALSE} +```{r execute-processing-pipeline, message = FALSE, results = FALSE, warning = FALSE} mae <- runDrugResponseProcessingPipeline(input_df) ``` -```{r mae} +```{r inspect-mae-output} mae ``` And we can subset the MultiAssayExperiment to receive the SummarizedExperiment specific to any data type, e.g. -```{r single-agent} +```{r subset-single-agent-experiment} mae[["single-agent"]] ``` @@ -128,6 +128,6 @@ Extraction of the data from either `MultiAssayExperiment` or `SummarizedExperime # SessionInfo {-} -```{r sessionInfo} +```{r session-info} sessionInfo() ```