Back to Multiple platform build/check report for BioC 3.21:   simplified   long
ABCDEFGHIJKLMNOPQRS[T]UVWXYZ

This page was generated on 2025-03-17 11:38 -0400 (Mon, 17 Mar 2025).

HostnameOSArch (*)R versionInstalled pkgs
palomino7Windows Server 2022 Datacenterx64R Under development (unstable) (2025-03-01 r87860 ucrt) -- "Unsuffered Consequences" 4545
lconwaymacOS 12.7.1 Montereyx86_64R Under development (unstable) (2025-03-02 r87868) -- "Unsuffered Consequences" 4576
kjohnson3macOS 13.7.1 Venturaarm64R Under development (unstable) (2025-03-02 r87868) -- "Unsuffered Consequences" 4528
kunpeng2Linux (openEuler 24.03 LTS)aarch64R Under development (unstable) (2025-02-19 r87757) -- "Unsuffered Consequences" 4459
Click on any hostname to see more info about the system (e.g. compilers)      (*) as reported by 'uname -p', except on Windows and Mac OS X

Package 2150/2313HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
terapadog 0.99.6  (landing page)
Gionmattia Carancini
Snapshot Date: 2025-03-16 13:40 -0400 (Sun, 16 Mar 2025)
git_url: https://git.bioconductor.org/packages/terapadog
git_branch: devel
git_last_commit: edf72ce
git_last_commit_date: 2025-03-05 12:59:38 -0400 (Wed, 05 Mar 2025)
palomino7Windows Server 2022 Datacenter / x64  OK    OK    OK    OK  UNNEEDED, same version is already published
lconwaymacOS 12.7.1 Monterey / x86_64  OK    OK    OK    OK  UNNEEDED, same version is already published
kjohnson3macOS 13.7.1 Ventura / arm64  OK    OK    OK    OK  UNNEEDED, same version is already published
kunpeng2Linux (openEuler 24.03 LTS) / aarch64  OK    OK    OK  


CHECK results for terapadog on palomino7

To the developers/maintainers of the terapadog package:
- Allow up to 24 hours (and sometimes 48 hours) for your latest push to git@git.bioconductor.org:packages/terapadog.git to reflect on this report. See Troubleshooting Build Report for more information.
- Use the following Renviron settings to reproduce errors and warnings.
- If 'R CMD check' started to fail recently on the Linux builder(s) over a missing dependency, add the missing dependency to 'Suggests:' in your DESCRIPTION file. See Renviron.bioc for more information.

raw results


Summary

Package: terapadog
Version: 0.99.6
Command: E:\biocbuild\bbs-3.21-bioc\R\bin\R.exe CMD check --no-multiarch --install=check:terapadog.install-out.txt --library=E:\biocbuild\bbs-3.21-bioc\R\library --no-vignettes --timings terapadog_0.99.6.tar.gz
StartedAt: 2025-03-17 06:15:27 -0400 (Mon, 17 Mar 2025)
EndedAt: 2025-03-17 06:25:32 -0400 (Mon, 17 Mar 2025)
EllapsedTime: 605.2 seconds
RetCode: 0
Status:   OK  
CheckDir: terapadog.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   E:\biocbuild\bbs-3.21-bioc\R\bin\R.exe CMD check --no-multiarch --install=check:terapadog.install-out.txt --library=E:\biocbuild\bbs-3.21-bioc\R\library --no-vignettes --timings terapadog_0.99.6.tar.gz
###
##############################################################################
##############################################################################


* using log directory 'E:/biocbuild/bbs-3.21-bioc/meat/terapadog.Rcheck'
* using R Under development (unstable) (2025-03-01 r87860 ucrt)
* using platform: x86_64-w64-mingw32
* R was compiled by
    gcc.exe (GCC) 13.3.0
    GNU Fortran (GCC) 13.3.0
* running under: Windows Server 2022 x64 (build 20348)
* using session charset: UTF-8
* using option '--no-vignettes'
* checking for file 'terapadog/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'terapadog' version '0.99.6'
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking whether package 'terapadog' can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking 'build' directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking code files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... NOTE
There are ::: calls to the package's namespace in its code. A package
  almost never needs to use ::: for its own objects:
  'generate_permutation_matrix' 'gsScoreFun' 'prepareGeneSets'
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking files in 'vignettes' ... OK
* checking examples ... OK
Examples with CPU (user + system) or elapsed time > 5s
              user system elapsed
get_FCs      58.42   1.08   63.08
id_converter  1.30   0.14    6.37
* checking for unstated dependencies in 'tests' ... OK
* checking tests ...
  Running 'test-assign_Regmode.R'
  Running 'test-get_FCs.R'
  Running 'test-id_converter.R'
  Running 'test-plotDTA.R'
  Running 'test-prepareTerapadogData.R'
  Running 'test-preprocessing_helpers.R'
  Running 'test-terapadog.R'
  Running 'test-terapadogBricks.R'
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes ... OK
* checking running R code from vignettes ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

Status: 1 NOTE
See
  'E:/biocbuild/bbs-3.21-bioc/meat/terapadog.Rcheck/00check.log'
for details.


Installation output

terapadog.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   E:\biocbuild\bbs-3.21-bioc\R\bin\R.exe CMD INSTALL terapadog
###
##############################################################################
##############################################################################


* installing to library 'E:/biocbuild/bbs-3.21-bioc/R/library'
* installing *source* package 'terapadog' ...
** this is package 'terapadog' version '0.99.6'
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (terapadog)

Tests output

terapadog.Rcheck/tests/test-assign_Regmode.Rout

R Under development (unstable) (2025-03-01 r87860 ucrt) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(testthat)
> library(terapadog)
> 
> # Test how function handles empty dataframe
> test_that("assign_Regmode handles empty dataframe", {
+   # Create an empty dataframe with the required columns
+   empty_df <- data.frame(
+     Identifier = character(0),
+     log2FoldChange = numeric(0),
+     padj = numeric(0),
+     RIBO_FC = numeric(0),
+     RIBO_padj = numeric(0),
+     RNA_FC = numeric(0),
+     RNA_padj = numeric(0)
+   )
+   # test a dataframe with no genes (nrows = 0)
+   expect_error(terapadog:::assign_Regmode(empty_df), "Input dataframe has no rows.", fixed = TRUE)
+ })
Test passed 😸
> 
> # Test behavior if columns are missing
> test_that("assign_Regmode handles missing dataframe columns", {
+   expect_error(terapadog:::assign_Regmode(data.frame()), "Input is missing required columns: .*")
+   })
Test passed 🥳
> 
> # Test for "Undeterminable" RegMode -> where at least one padj is NA
> test_that("assign_Regmode assigns 'Undeterminable' correctly", {
+   df <-  data.frame(
+     Identifier = c("NA_test1", "NA_test2", "NA_test3", "NA_test4"),
+     log2FoldChange = c(0,0,0,0),
+     padj = c(NA, 0.02, 0.03, NA),
+     RIBO_FC = c(0,0,0, 0),
+     RIBO_padj = c(0.3, NA, 0.03, NA),
+     RNA_FC = c(0,0,0,0),
+     RNA_padj = c(0.3, 0.2, NA, NA)
+   )
+   result <- terapadog:::assign_Regmode(df)
+   expect_true(all(result$RegMode == "Undeterminable"))
+ })
Test passed 😸
> 
> # Test for "Undetermined" RegMode -> as per defined by Chotani et al 2019
> test_that("assign_Regmode assigns 'Undetermined' correctly", {
+   df <-  data.frame(
+     Identifier = c("Un_test1", "Un_test2", "Un_test3"),
+     log2FoldChange = c(0,0,0),
+     padj = c(0.6, 0.6, 0.01),
+     RIBO_FC = c(0,0,0),
+     RIBO_padj = c(0.6, 0.01, 0.06),
+     RNA_FC = c(0,0,0),
+     RNA_padj = c(0.01, 0.06, 0.06)
+   )
+   result <- terapadog:::assign_Regmode(df)
+   expect_true(all(result$RegMode == "Undetermined"))
+ })
Test passed 🎉
> 
> # Test for the "No Change" Regmode
> test_that("assign_Regmode assigns 'No Change' correctly", {
+   df <-  data.frame(
+     Identifier = c("NC_test"),
+     log2FoldChange = c(0),
+     padj = c(0.6),
+     RIBO_FC = c(0),
+     RIBO_padj = c(0.6),
+     RNA_FC = c(0),
+     RNA_padj = c(0.06)
+   )
+   result <- terapadog:::assign_Regmode(df)
+   expect_true(all(result$RegMode == "No Change"))
+ })
Test passed 🎉
> 
> # Test for the "Intensified" Regmode. This condition requires all padj to be <0.05
> # and log2FoldChange * RNA_FC > 1  (aka same directionality of change)
> test_that("assign_Regmode assigns the 'Intensified' cases correctly", {
+   df <-  data.frame(
+     Identifier = c("Intensified_test1", "Intensified_test2"),
+     log2FoldChange = c(1, -1),
+     padj = c(0.01, 0.01),
+     RIBO_FC = c(0, 0),
+     RIBO_padj = c(0.01, 0.01),
+     RNA_FC = c(1, -1),
+     RNA_padj = c(0.01, 0.01)
+   )
+   result <- terapadog:::assign_Regmode(df)
+   expect_true(all(result$RegMode == "Intensified"))
+ })
Test passed 🎉
> 
> # Test for the "Buffered" Regmode.
> test_that("assign_Regmode assigns the 'Buffered' cases correctly", {
+   df <-  data.frame(
+     Identifier = c("Buffered_test1", "Buffered_test2", "Buffered_test3"),
+     log2FoldChange = c(1, -1, 1),
+     padj = c(0.01, 0.01, 0.01),
+     RIBO_FC = c(1, 1, 1),
+     RIBO_padj = c(0.01, 0.01, 0.6),
+     RNA_FC = c(-1, 1, 1),
+     RNA_padj = c(0.01, 0.01, 0.01)
+   )
+   result <- terapadog:::assign_Regmode(df)
+   expect_true(all(result$RegMode == "Buffered"))
+ })
Test passed 🥇
> 
> # Test for the "Exclusive" Regmode.
> test_that("assign_Regmode assigns the 'Exclusive' cases correctly", {
+   df <-  data.frame(
+     Identifier = c("Exclusive_test"),
+     log2FoldChange = c(1),
+     padj = c(0.01),
+     RIBO_FC = c(1),
+     RIBO_padj = c(0.01),
+     RNA_FC = c(0),
+     RNA_padj = c(0.6)
+   )
+   result <- terapadog:::assign_Regmode(df)
+   expect_true(all(result$RegMode == "Exclusive"))
+ })
Test passed 😸
> 
> # Test for the "Forwarded" Regmode.
> test_that("assign_Regmode assigns the 'Forwarded' cases correctly", {
+   df <-  data.frame(
+     Identifier = c("Forwarded_test"),
+     log2FoldChange = c(0),
+     padj = c(0.6),
+     RIBO_FC = c(1),
+     RIBO_padj = c(0.01),
+     RNA_FC = c(1),
+     RNA_padj = c(0.01)
+   )
+   result <- terapadog:::assign_Regmode(df)
+   expect_true(all(result$RegMode == "Forwarded"))
+ })
Test passed 🎊
> 
> proc.time()
   user  system elapsed 
  12.34    1.01   13.35 

terapadog.Rcheck/tests/test-get_FCs.Rout

R Under development (unstable) (2025-03-01 r87860 ucrt) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> # Unit tests for get_FCs
> library(testthat)
> library(terapadog)
> 
> test_that("get_FCs raises an error for NULL inputs", {
+   expect_error(get_FCs(NULL, data.frame()), "expression.data or exp_de cannot be NULL.")
+   expect_error(get_FCs(matrix(), NULL), "expression.data or exp_de cannot be NULL.")
+ })
Test passed 🌈
> 
> # Input Check - exp_de required columns
> test_that("Input validation for exp_de", {
+   expression.data <- matrix(1:9, nrow = 3, dimnames = list(NULL, c("S1", "S2", "S3")))
+   # Check if required columns are present
+   expect_error(get_FCs(expression.data, data.frame(Sample = c("S1", "S2", "S3"))), "exp_de is missing required columns: .*")
+ })
Test passed 🌈
> 
> test_that("get_FCs raises an error if exp_de is empty after Samples with Group = NA are removed", {
+             # create a dataframe with Group = NA for everything in exp_de.
+             exp_de <- data.frame(
+               SampleID = c("S1", "S2"),
+               Group = c(NA, NA),
+               SeqType = c("RNA", "RIBO")
+             )
+             # create a df where SampleID is the column name
+             expression.data <- data.frame(
+               S1 = c(1,2),
+               S2 = c(2,1)
+             )
+ 
+   expect_error(get_FCs(expression.data, exp_de), "exp_de cannot be empty.")
+ })
Test passed 🥇
> 
> test_that("get_FCs raises an error if samples in expression.data do not match with the ones from exp_de", {
+   # Create a matrix with 3 columns
+   expression.data <- matrix(1:9, nrow = 3, dimnames = list(NULL, c("S1", "S2", "S3")))
+ 
+   # Create a data frame with 2 rows instead of 3
+   exp_de <- data.frame(
+     SampleID = c("S1", "S2"),
+     Group = c("A", "B"),
+     SeqType = c("RNA", "RIBO")
+   )
+ 
+   # Expect an error
+   expect_error(
+     get_FCs(expression.data, exp_de),
+     "The SampleID (colnames(expression.data)) must match the SampleID values in exp_de.",
+     fixed = TRUE
+   )
+ })
Test passed 🎊
> 
> 
> test_that("get_FCs checks for 2 comaprison groups (2 levels in Group) and multiple
+           blocks (more than 1 level for Block) in exp_de after NA removal", {
+   expression.data <- matrix(1:9, nrow = 3, dimnames = list(NULL, c("S1", "S2", "S3")))
+ 
+   # Case 1: Single comparison group in exp_de
+   exp_de_single_group <- data.frame(
+     SampleID = c("S1", "S2", "S3"),
+     Group = c("A", "A", "A"),
+     SeqType = c("RNA", "RIBO", "RNA"),
+     Block = c(1, 1, 1)
+   )
+   expect_error(
+     get_FCs(expression.data, exp_de_single_group),
+     "exp_de must contain two levels for Group - The differential analysis requires to compare two groups only, not more nor less."
+   )
+ 
+   # Case 2: Single block with paired = TRUE
+   exp_de_single_block <- data.frame(
+     SampleID = c("S1", "S2", "S3"),
+     Group = c("A", "B", "A"),
+     SeqType = c("RNA", "RIBO", "RNA"),
+     Block = c(1, 1, 1)
+   )
+   expect_error(
+     get_FCs(expression.data, exp_de_single_block, paired = TRUE),
+     "When paired = TRUE, exp_de must contain more than one level for Block."
+   )
+ })
Test passed 🌈
> 
> 
> proc.time()
   user  system elapsed 
  12.23    0.84   13.04 

terapadog.Rcheck/tests/test-id_converter.Rout

R Under development (unstable) (2025-03-01 r87860 ucrt) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> # Unit tests for get_FCs
> library(testthat)
> library(terapadog)
> 
> test_that("unsupported geneID types are not processed", {
+   gene_ids <- c('ENSG00000103197', 'ENSG00000008710', 'ENSG00000167964'
+                 , 'ENSG00000167964')
+                 esetm <- matrix(c(
+                 2.5, 3.1, 5.2, 0.1,
+                 4.1, 2.9, 6.3, 0.5,
+                 1.5, 3.7, 4.8, 0.1), nrow = 4, byrow = FALSE)
+                 rownames(esetm) <- gene_ids
+                 colnames(esetm) <- c("Sample 1", "Sample 2", "Sample 3")
+ 
+   expect_error(id_converter(esetm, "a_wrong_id"), "Error: the conversion script only works with
+          'hgnc_symbol' or 'ensembl_gene_id'")
+ })
Test passed 🥇
> 
> # Checks the existance of terapadog's gene mapping file. This is a .csv containing a
> # conversion table between geneIDs, to use if the Ensembl server is down. More info in the extdata_info.md file
> test_that("Terapadog's gene mapping file (to use if ensembl is down) exists within the package", {
+   data_path <- system.file("extdata", "hsapiens_GRCh38.p14_gene_mapping.csv.gz", package = "terapadog")
+   expect_true(file.exists(data_path), info = "Local gene mapping file is missing. ")
+ })
Test passed 🥳
> 
> proc.time()
   user  system elapsed 
  11.09    0.95   12.03 

terapadog.Rcheck/tests/test-plotDTA.Rout

R Under development (unstable) (2025-03-01 r87860 ucrt) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> # Unit tests for plotDTA
> library(testthat)
> library(terapadog)
> 
> # Input Check - FC_results
> test_that("Input validation for FC_results", {
+   # Check if NULL
+   expect_error(plotDTA(NULL), "FC_results must be a dataframe")
+   # Check if required columns are present
+   expect_error(plotDTA(data.frame()), "FC_results is missing required columns: .*")
+ })
Test passed 🌈
> 
> # Checks output
> test_that("plotDTA filters out 'Undeterminable' and 'Undetermined' RegModes before plotting", {
+   df <- data.frame(
+     Identifier = c("Gene A", "Gene B", "Gene C"),
+     RegMode = c("Buffered", "Undeterminable", "No Change"),
+     RNA_FC = c(-0.4, 0.3, 0.1),
+     RIBO_FC = c(0.2, -0.1, 0.3)
+   )
+   result <- plotDTA(df)
+ 
+   # Extract the data used for the plot
+   plot_data <- result$x$data[[1]]$text
+ 
+   # Ensure "Undeterminable" and "Undetermined" are not in the plot
+   expect_false(any(grepl("Undeterminable", plot_data)))
+   expect_false(any(grepl("Undetermined", plot_data)))
+ 
+   # tests on saving conditions
+   # Test 1: Error is raised when directory does not exist
+   expect_error(
+     plotDTA(df, save_plot = TRUE, path = "fake/path"),
+     regexp = "The specified directory does not exist: .*"
+   )
+ 
+   # Test 2: No error is raised when save_plot = FALSE
+   expect_silent(
+     plotDTA(df, save_plot = FALSE, path = "fake/path")
+   )
+ 
+   # Test 3: No error is raised when the directory exists (in this case, temp_dir)
+   expect_silent(
+     plotDTA(df, save_plot = TRUE)
+   )
+ })
Test passed 🥳
> 
> 
> proc.time()
   user  system elapsed 
  12.03    0.87   14.81 

terapadog.Rcheck/tests/test-prepareTerapadogData.Rout

R Under development (unstable) (2025-03-01 r87860 ucrt) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(testthat)
> library(terapadog)
> # tests/testthat/test-prepareTerapadogData.R
> 
> test_that("Fails if RNA counts file does not exist", {
+   rna_file <- system.file("extdata", "not_rna_counts.tsv", package = "terapadog")
+   ribo_file <- system.file("extdata", "ribo_counts.tsv", package = "terapadog")
+   meta_file <- system.file("extdata", "sample_info.tsv", package = "terapadog")
+ 
+   expect_error(
+     terapadog:::prepareTerapadogData(
+       path_to_RNA_counts = rna_file,
+       path_to_RIBO_counts = ribo_file,
+       path_to_metadata = meta_file,
+       analysis.group.1 = "1",
+       analysis.group.2 = "2"
+     ),
+     regexp = "does not exist"
+   )
+ })
Test passed 🎊
> 
> test_that("Fails if RIBO counts file does not exist", {
+   rna_file <- system.file("extdata", "rna_counts.tsv", package = "terapadog")
+   ribo_file <- system.file("extdata", "not_ribo_counts.tsv", package = "terapadog")
+   meta_file <- system.file("extdata", "sample_info.tsv", package = "terapadog")
+ 
+   expect_error(
+     terapadog:::prepareTerapadogData(
+       path_to_RNA_counts = rna_file,
+       path_to_RIBO_counts = ribo_file,
+       path_to_metadata = meta_file,
+       analysis.group.1 = "1",
+       analysis.group.2 = "2"
+     ),
+     regexp = "does not exist"
+   )
+ })
Test passed 🥳
> 
> test_that("Fails if sample info file does not exist", {
+   rna_file <- system.file("extdata", "rna_counts.tsv", package = "terapadog")
+   ribo_file <- system.file("extdata", "ribo_counts.tsv", package = "terapadog")
+   meta_file <- system.file("extdata", "not_sample_info.tsv", package = "terapadog")
+ 
+   expect_error(
+     terapadog:::prepareTerapadogData(
+       path_to_RNA_counts = rna_file,
+       path_to_RIBO_counts = ribo_file,
+       path_to_metadata = meta_file,
+       analysis.group.1 = "1",
+       analysis.group.2 = "2"
+     ),
+     regexp = "does not exist"
+   )
+ })
Test passed 🎉
> 
> 
> test_that("Fails if sample_info file is missing required columns", {
+   rna_file <- system.file("extdata", "rna_counts.tsv", package = "terapadog")
+   ribo_file <- system.file("extdata", "ribo_counts.tsv", package = "terapadog")
+   meta_file <- system.file("extdata", "test_sample_info_wrong.tsv", package = "terapadog")
+ 
+   expect_error(
+     terapadog:::prepareTerapadogData(
+       path_to_RNA_counts = rna_file,
+       path_to_RIBO_counts = ribo_file,
+       path_to_metadata = meta_file,
+       analysis.group.1 = "1",
+       analysis.group.2 = "2"
+     ),
+     regexp = "Metadata file is missing required columns: "
+   )
+ })
Test passed 😸
> 
> 
> test_that("Fails if analysis.group.1 and analysis.group.2 are not in metadata Conditions", {
+   rna_file <- system.file("extdata", "rna_counts.tsv", package = "terapadog")
+   ribo_file <- system.file("extdata", "ribo_counts.tsv", package = "terapadog")
+   meta_file <- system.file("extdata", "test_sample_info_wrong_2.tsv", package = "terapadog")
+ 
+   expect_error(
+     terapadog:::prepareTerapadogData(
+       path_to_RNA_counts = rna_file,
+       path_to_RIBO_counts = ribo_file,
+       path_to_metadata = meta_file,
+       analysis.group.1 = "1",
+       analysis.group.2 = "2"
+     ),
+     regexp = "do not match Condition values"
+   )
+ })
Test passed 🎉
> 
> 
> test_that("Successful run returns a list with expression.data and exp_de", {
+   rna_file <- system.file("extdata", "rna_counts.tsv", package = "terapadog")
+   ribo_file <- system.file("extdata", "ribo_counts.tsv", package = "terapadog")
+   meta_file <- system.file("extdata", "sample_info.tsv", package = "terapadog")
+ 
+   out <- terapadog:::prepareTerapadogData(
+     path_to_RNA_counts = rna_file,
+     path_to_RIBO_counts = ribo_file,
+     path_to_metadata = meta_file,
+     analysis.group.1 = "1",
+     analysis.group.2 = "2"
+   )
+ 
+   # Check it returns a list with two elements named "expression.data" and "exp_de"
+   expect_type(out, "list")
+   expect_named(out, c("expression.data", "exp_de"))
+ 
+   # Optionally check dimensions (should not be necessary, but better safe than sorry)
+   expect_equal(ncol(out$expression.data), 16) # Check no samples were left behind
+   expect_equal(nrow(out$exp_de), 16) # Checks exp_de has all samples
+   expect_true(all(c("SampleID", "SampleName", "SeqType", "Condition", "Group") %in% names(out$exp_de)))
+ })
Test passed 🥇
> 
> 
> proc.time()
   user  system elapsed 
  12.21    0.96   13.17 

terapadog.Rcheck/tests/test-preprocessing_helpers.Rout

R Under development (unstable) (2025-03-01 r87860 ucrt) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> # Unit tests for get_FCs
> library(testthat)
> library(terapadog)
> 
> # Tests for detect_separator()
> test_that("detect_separator works correctly for .csv files", {
+   expect_equal(terapadog:::detect_separator("example.csv"), ",")
+ })
Test passed 🎉
> 
> test_that("detect_separator works correctly for .tsv files", {
+   expect_equal(terapadog:::detect_separator("example.tsv"), "\t")
+ })
Test passed 🎊
> 
> test_that("detect_separator throws an error for unsupported file formats", {
+   expect_error(terapadog:::detect_separator("example.txt"),
+                "Unsupported file format. Please provide a .csv or .tsv file.")
+ })
Test passed 🎉
> 
> test_that("detect_separator throws an error for files with no extension", {
+   expect_error(terapadog:::detect_separator("example"),
+                "Unsupported file format. Please provide a .csv or .tsv file.")
+ })
Test passed 🎊
> 
> 
> # Test for empty or NULL data frames
> 
> test_that("check_input_df should throw an error if given a NULL input", {
+   expect_error(
+     terapadog:::check_input_df(NULL),
+     "One of the input dataframes is NULL. Check again inputs")
+   })
Test passed 🎊
> 
> test_that("check_input_df throws an error for an empty dataframe", {
+   df1 <- data.frame()
+   expect_error(
+     terapadog:::check_input_df(df1),
+     fixed = TRUE,
+     "One of input dataframes is empty (no rows or columns)")
+ })
Test passed 🎊
> 
> # Tests for check_matching_colnames()
> 
> test_that("check_matching_colnames works for matching column names", {
+   df1 <- data.frame(A = 1, B = 2, C = 3)
+   df2 <- data.frame(C = 3, B = 2, A = 1) # Same column names, different order
+   expect_no_error(terapadog:::check_matching_colnames(df1, df2))
+ })
Test passed 🎊
> 
> test_that("check_matching_colnames throws an error for mismatched column names", {
+   df1 <- data.frame(A = 1, B = 2, C = 3)
+   df2 <- data.frame(A = 1, B = 2, D = 3) # D instead of C
+   expect_error(
+     terapadog:::check_matching_colnames(df1, df2),
+     "SampleNames do not match between the RNA and RIBO/POLY count files."
+   )
+ })
Test passed 😀
> 
> test_that("check_matching_colnames throws an error for partially matching column names", {
+   df1 <- data.frame(A = 1, B = 2)
+   df2 <- data.frame(A = 1, B = 2, C = 3) # Extra column C
+   expect_error(
+     terapadog:::check_matching_colnames(df1, df2),
+     "SampleNames do not match between the RNA and RIBO/POLY count files."
+   )
+ })
Test passed 🥇
> 
> test_that("check_matching_colnames works for dataframes with reordered columns", {
+   df1 <- data.frame(A = 1, B = 2, C = 3)
+   df2 <- data.frame(C = 3, A = 1, B = 2) # Same columns, different order
+   expect_no_error(terapadog:::check_matching_colnames(df1, df2))
+ })
Test passed 🥳
> 
> # Tests for check_value_range()
> 
> test_that("check_value_range throws an error for values between 0 and 1", {
+   df <- data.frame(A = runif(10, 0, 1), B = runif(10, 0, 1))  # Create dataframe with values in [0, 1]
+   expect_error(
+     terapadog:::check_value_range(df),
+     "Value range in the data is between 0 and 1. Data submitted must be RAW COUNT DATA, not normalised or scaled!"
+   )
+ })
Test passed 🥇
> 
> 
> proc.time()
   user  system elapsed 
  11.60    0.78   12.37 

terapadog.Rcheck/tests/test-terapadog.Rout

R Under development (unstable) (2025-03-01 r87860 ucrt) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(testthat)
> library(terapadog)
> 
> # Test: esetm is a matrix
> test_that("esetm must be a matrix", {
+   # load data
+   rna_file <- system.file("extdata", "rna_counts.tsv", package = "terapadog")
+   ribo_file <- system.file("extdata", "ribo_counts.tsv", package = "terapadog")
+   sample_file <- system.file("extdata", "sample_info.tsv", package = "terapadog")
+  # Use the paths to load the files.
+   prepared_data <- prepareTerapadogData(rna_file, ribo_file, sample_file, "1", "2")
+   # Unpacks the expression.data and exp_de from the output
+   esetm <- "not_a_matrix"
+   exp_de <- prepared_data$exp_de
+   # create fake esetm
+ 
+   expect_error(terapadog(esetm = esetm, exp_de = exp_de), "Error: esetm must be a matrix")
+ })
Test passed 😸
> 
> # Test: esetm has dimensions greater than 4
> test_that("esetm must have dimensions greater than 4", {
+   rna_file <- system.file("extdata", "rna_counts.tsv", package = "terapadog")
+   ribo_file <- system.file("extdata", "ribo_counts.tsv", package = "terapadog")
+   sample_file <- system.file("extdata", "sample_info.tsv", package = "terapadog")
+   # Use the paths to load the files.
+   prepared_data <- prepareTerapadogData(rna_file, ribo_file, sample_file, "1", "2")
+   # Unpacks the expression.data and exp_de from the output
+   esetm <- matrix(1:16, nrow=4, ncol=4)
+   exp_de <- prepared_data$exp_de
+   expect_error(terapadog(esetm = esetm, exp_de = exp_de),
+                "Error: esetm must have dimensions greater than 4")
+ })
Test passed 🥳
> 
> # Test: NI must be numeric
> test_that("NI must be numeric", {
+   rna_file <- system.file("extdata", "rna_counts.tsv", package = "terapadog")
+   ribo_file <- system.file("extdata", "ribo_counts.tsv",package = "terapadog")
+   sample_file <- system.file("extdata", "sample_info.tsv", package = "terapadog")
+   # Use the paths to load the files.
+   prepared_data <- prepareTerapadogData(rna_file, ribo_file, sample_file, "1", "2")
+   # Unpacks the expression.data and exp_de from the output
+   esetm <- prepared_data$expression.data
+   exp_de <- prepared_data$exp_de
+   NI <- "ten"
+   expect_error(terapadog(esetm = esetm, exp_de = exp_de, NI = NI),
+                "Error: NI must be numeric")
+ })
Test passed 😀
> 
> # Test: NI must be greater than 5
> test_that("NI must be numeric", {
+   rna_file <- system.file("extdata", "rna_counts.tsv", package = "terapadog")
+   ribo_file <- system.file("extdata", "ribo_counts.tsv",package = "terapadog")
+   sample_file <- system.file("extdata", "sample_info.tsv", package = "terapadog")
+   # Use the paths to load the files.
+   prepared_data <- prepareTerapadogData(rna_file, ribo_file, sample_file, "1", "2")
+   # Unpacks the expression.data and exp_de from the output
+   esetm <- prepared_data$expression.data
+   exp_de <- prepared_data$exp_de
+   NI <- 5
+   expect_error(terapadog(esetm = esetm, exp_de = exp_de, NI = NI),
+                "Error: NI must be greater than 5")
+ })
Test passed 🎉
> 
> # Test: nno dupicate genes are in esetm
> test_that("esetm must not have duplicate row names", {
+   rna_file <- system.file("extdata", "rna_counts.tsv", package = "terapadog")
+   ribo_file <- system.file("extdata", "ribo_counts.tsv",package = "terapadog")
+   sample_file <- system.file("extdata", "sample_info.tsv", package = "terapadog")
+   # Use the paths to load the files.
+   prepared_data <- prepareTerapadogData(rna_file, ribo_file, sample_file, "1", "2")
+   # Unpacks the expression.data and exp_de from the output
+   esetm <- prepared_data$expression.data
+   exp_de <- prepared_data$exp_de
+   # Adding duplicate genes to esetm
+   esetm <- rbind(esetm, esetm[c(2, 4), , drop = FALSE])
+   expect_error(terapadog(esetm = esetm, exp_de = exp_de), "Error: Duplicate row names found in esetm")
+ })
Test passed 🎊
> 
> # Test: terapadog runs without raising errors
> test_that("terapadog runs without errors", {
+   rna_file <- system.file("extdata", "rna_counts.tsv", package = "terapadog")
+   ribo_file <- system.file("extdata", "ribo_counts.tsv",package = "terapadog")
+   sample_file <- system.file("extdata", "sample_info.tsv", package = "terapadog")
+   # Use the paths to load the files.
+   prepared_data <- prepareTerapadogData(rna_file, ribo_file, sample_file, "1", "2")
+   # Unpacks the expression.data and exp_de from the output
+   esetm <- prepared_data$expression.data
+   # Slices the data to reduce the computational costs of testing terapadog.
+   exp_de <- prepared_data$exp_de
+   # converts ids
+   esetm <- id_converter(esetm, "ensembl_gene_id")
+   # runs terapadog with reduced genes, iterations, and thresholds
+   # To evade bioconductor's timeout issues.
+   expect_silent(terapadog(esetm = esetm, exp_de = exp_de, NI = 7, Nmin = 2, verbose = FALSE))
+ })
Test passed 🥇
> 
> proc.time()
   user  system elapsed 
 140.43    3.54  198.26 

terapadog.Rcheck/tests/test-terapadogBricks.Rout

R Under development (unstable) (2025-03-01 r87860 ucrt) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(testthat)
> library(KEGGREST)
> library(terapadog) # Adjust this path
> 
> ##### Tests for prepareGeneSets() #####
> 
> set.seed(42)
> mock_esetm <- matrix(runif(100), nrow = 20, dimnames = list(paste0("Gene", 1:20), NULL))
> 
> mock_gslist <- list(
+   Pathway1 = paste0("Gene", 1:10),
+   Pathway2 = paste0("Gene", 5:15),
+   Pathway3 = paste0("Gene", 10:20)
+ )
> mock_gs.names <- c("Pathway 1", "Pathway 2", "Pathway 3")
> 
> # Test: Organism KEGG ID must be three characters
> test_that("Organism ID must be three characters", {
+   expect_error(terapadog:::prepareGeneSets(mock_esetm, organism = "hs"),
+                "Error: 'organism' must be a three-letter string.")
+ })
Test passed 🥳
> 
> # Test: gslist must be a list or compatible structure
> test_that("gslist must be a list", {
+   expect_error(terapadog:::prepareGeneSets(mock_esetm, gslist = "not_a_list"),
+                "Error: 'gslist' must be a list or compatible structure.")
+ })
Test passed 😀
> 
> # Test: Custom gslist requires gs.names
> test_that("Custom gslist requires gs.names", {
+   expect_error(terapadog:::prepareGeneSets(mock_esetm, gslist = mock_gslist, gs.names = NULL),
+                "For a custom gslist, you must provide gs.names!")
+ })
Test passed 🥳
> 
> # Test: gs.names length must match gslist
> test_that("gs.names length must match gslist", {
+   expect_error(terapadog:::prepareGeneSets(mock_esetm, gslist = mock_gslist,
+                                gs.names = c("Only one name")),
+                "Error: Length of 'gslist' and 'gs.names' must be the same.")
+ })
Test passed 🥇
> 
> # Test: all genes have their weight
> test_that("Gene frequency weighting factor calculation is correct", {
+   result <- terapadog:::prepareGeneSets(mock_esetm, gslist = mock_gslist,
+                             gs.names = mock_gs.names)
+   expect_true(all(names(result$gf) %in% rownames(mock_esetm)))
+ })
Test passed 🎉
> 
> # Test: At least 10 genes from esetm must be in gslist
> test_that("At least 10 genes from esetm must be in gslist and no duplicates in rownames", {
+   expect_error(terapadog:::prepareGeneSets(mock_esetm[1:5, , drop = FALSE],
+                                gslist = mock_gslist, gs.names = mock_gs.names),
+                "Error: Less than 10 genes in 'esetm' match the gene set list.")})
Test passed 🎊
> 
> # Test: Gene sets smaller than Nmin are removed
> test_that("Gene sets smaller than Nmin are removed", {
+ 
+   valid_gslist <- list(
+     Pathway1 = paste0("Gene", 1:5),
+     Pathway2 = paste0("Gene", 6:7),
+     Pathway3 = paste0("Gene", 9:12),
+     Pathway4 = paste0("Gene", 13:20)
+   )
+   result <- terapadog:::prepareGeneSets(mock_esetm, gslist = valid_gslist, gs.names = c("P1", "P2", "P3", "P4"), Nmin = 3)
+ 
+   # Check that small gene sets were removed
+   expect_false("Pathway2" %in% names(result$gslist))
+   expect_true(length(result$gslist) >= 3)
+ })
Test passed 🥇
> 
> 
> ##### Tests for generate_permutation_matrix() ######
> 
> # Test: the matrix of permutations is not empty
> test_that("combidx is not empty", {
+   G <- factor(rep(c("A", "B"), each = 3))
+   block <- factor(rep(1:3, 2))
+   res <- terapadog:::generate_permutation_matrix(G, NI = 10, paired = FALSE, block = block, verbose = FALSE)
+ 
+   combidx <- res$combidx
+   expect_true(!is.null(combidx) && nrow(combidx) > 0 && ncol(combidx) > 0)
+ })
Test passed 🥳
> 
> # Test: no duplicated permutations are kept
> test_that("No duplicated combinations exist in combidx", {
+   G <- factor(rep(c("A", "B"), each = 3))
+   block <- factor(rep(1:3, 2))
+   res <- terapadog:::generate_permutation_matrix(G, NI = 10, paired = FALSE, block = block, verbose = FALSE)
+ 
+   combidx <- res$combidx
+   expect_equal(ncol(combidx), length(unique(apply(combidx, 2, paste, collapse = ","))))
+ })
Test passed 🌈
> 
> # Test: the code handles an incorrect number of permutations
> test_that("Invalid number of permutations handled correctly", {
+   G <- factor(rep(c("A", "B"), each = 3))
+   block <- factor(rep(1:3, 2))
+   res <- terapadog:::generate_permutation_matrix(G, NI = 5, paired = FALSE, block = block, verbose = FALSE)
+ 
+   combidx <- res$combidx
+   expect_true(ncol(combidx) == 5) # Ensure `NI` permutations are returned
+ })
Test passed 😀
> 
> # CTest: permutations respect "block" values, in paired experimental designs
> test_that("Permutations respect block assignments", {
+   G <- factor(rep(c("Wt", "Mut"), each = 3))
+   block <- factor(rep(c("Pat1", "Pat2", "Pat3", "Pat1", "Pat2", "Pat3")))
+   res <- terapadog:::generate_permutation_matrix(G, NI = 10, paired = TRUE, block = block, verbose = FALSE)
+ 
+   combidx <- res$combidx
+ 
+   # Define forbidden index pairs (which would happen if "block" not respected)
+   forbidden_pairs <- list(c(1, 4), c(2, 5), c(3, 6))
+ 
+   # Iterate through each permutation (column in combidx)
+   for (i in seq_len(ncol(combidx))) {
+     permuted_indices <- combidx[, i]
+ 
+     # Check if any forbidden pair appears in this permutation
+     for (pair in forbidden_pairs) {
+       if (all(pair %in% permuted_indices)) {
+         fail(paste("Permutation", i, "contains forbidden pair", pair[1], "and", pair[2]))
+       }
+     }
+   }
+ 
+   # If no forbidden pairs were found, the test passes
+   expect_true(TRUE)
+ })
Test passed 🥇
> 
> ##### Tests for gsScoreFun() ######
> 
> # This internal function has internal checks (if ()...{stop()}).
> 
> proc.time()
   user  system elapsed 
  12.03    0.93   12.95 

Example timings

terapadog.Rcheck/terapadog-Ex.timings

nameusersystemelapsed
assign_Regmode000
check_input_df000
check_integer_values000
check_matching_colnames000
check_value_range000
detect_separator000
generate_permutation_matrix0.010.000.02
get_FCs58.42 1.0863.08
id_converter1.300.146.37
plotDTA0.020.000.02
prepareGeneSets000
prepareTerapadogData0.250.010.26