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` 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..0e1185ae --- /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 + drugs_id <- gDRutils::get_env_identifiers("drug_name") + utils::assignInNamespace(".drugNameRegex", sprintf("^%s$|^%s_[[:digit:]]+$", drugs_id, drugs_id), ns = pkgname) + + untreated_tag_patterns <- vapply( + gDRutils::get_env_identifiers("untreated_tag"), + sprintf, + fmt = "^%s$", + character(1) + ) + utils::assignInNamespace(".untreated_tag_patterns", untreated_tag_patterns, ns = pkgname) + utils::assignInNamespace(".untreatedDrugNameRegex", paste(untreated_tag_patterns, collapse = "|"), ns = pkgname) + + # data.table compatible + utils::assignInNamespace("patterns", data.table:::patterns, ns = pkgname) + 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) +} diff --git a/vignettes/gDR-annotation.Rmd b/vignettes/gDR-annotation.Rmd index cd9f86bf..7078f851 100644 --- a/vignettes/gDR-annotation.Rmd +++ b/vignettes/gDR-annotation.Rmd @@ -8,7 +8,7 @@ vignette: > %\VignetteEncoding{UTF-8} --- -```{r, 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, 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, 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, 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 cb31f1dc..65678f5b 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} --- @@ -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 4216ce5f..c9415b22 100644 --- a/vignettes/gDRcore.Rmd +++ b/vignettes/gDRcore.Rmd @@ -8,14 +8,14 @@ vignette: > %\VignetteEncoding{UTF-8} --- -```{r, 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} +```{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, 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, message = FALSE, results = FALSE, warning = FALSE} +```{r execute-processing-pipeline, message = FALSE, results = FALSE, warning = FALSE} mae <- runDrugResponseProcessingPipeline(input_df) ``` -```{r} +```{r inspect-mae-output} mae ``` And we can subset the MultiAssayExperiment to receive the SummarizedExperiment specific to any data type, e.g. -```{r} +```{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() ```