Back to Long Tests report for BioC 3.22

This page was generated on 2025-11-01 23:55 -0400 (Sat, 01 Nov 2025).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 24.04.3 LTS)x86_644.5.1 Patched (2025-08-23 r88802) -- "Great Square Root" 4901
lconwaymacOS 12.7.6 Montereyx86_644.5.1 Patched (2025-09-10 r88807) -- "Great Square Root" 4691
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 17/31HostnameOS / ArchCHECK
DOtools 1.0.0  (landing page)
Mariano Ruz Jurado
Snapshot Date: 2025-11-01 09:55 -0400 (Sat, 01 Nov 2025)
git_url: https://git.bioconductor.org/packages/DOtools
git_branch: RELEASE_3_22
git_last_commit: 95a2404
git_last_commit_date: 2025-10-29 11:38:46 -0400 (Wed, 29 Oct 2025)
nebbiolo2Linux (Ubuntu 24.04.3 LTS) / x86_64  ERROR  
lconwaymacOS 12.7.6 Monterey / x86_64  ERROR  


CHECK results for DOtools on nebbiolo2

To the developers/maintainers of the DOtools package:
- 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: DOtools
Version: 1.0.0
Command: /home/biocbuild/bbs-3.22-bioc/R/bin/R CMD check --test-dir=longtests --no-stop-on-test-error --no-codoc --no-examples --no-manual --ignore-vignettes --check-subdirs=no DOtools_1.0.0.tar.gz
StartedAt: 2025-11-01 16:09:51 -0400 (Sat, 01 Nov 2025)
EndedAt: 2025-11-01 16:18:32 -0400 (Sat, 01 Nov 2025)
EllapsedTime: 521.1 seconds
RetCode: 1
Status:   ERROR  
CheckDir: DOtools.Rcheck
Warnings: NA

Tests output

DOtools.Rcheck/tests/test-DO.BarplotWilcox.Rout.fail


R version 4.5.1 Patched (2025-08-23 r88802) -- "Great Square Root"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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(Seurat)
Loading required package: SeuratObject
Loading required package: sp

Attaching package: 'SeuratObject'

The following objects are masked from 'package:base':

    intersect, t

> library(ggplot2)
> library(SingleCellExperiment)
Loading required package: SummarizedExperiment
Loading required package: MatrixGenerics
Loading required package: matrixStats

Attaching package: 'MatrixGenerics'

The following objects are masked from 'package:matrixStats':

    colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
    colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
    colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
    colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
    colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
    colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
    colWeightedMeans, colWeightedMedians, colWeightedSds,
    colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
    rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
    rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
    rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
    rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
    rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
    rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
    rowWeightedSds, rowWeightedVars

Loading required package: GenomicRanges
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: generics

Attaching package: 'generics'

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 objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, is.unsorted, lapply,
    mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
    rank, rbind, rownames, sapply, saveRDS, table, tapply, unique,
    unsplit, which.max, which.min

Loading required package: S4Vectors

Attaching package: 'S4Vectors'

The following object is masked from 'package:utils':

    findMatches

The following objects are masked from 'package:base':

    I, expand.grid, unname

Loading required package: IRanges

Attaching package: 'IRanges'

The following object is masked from 'package:sp':

    %over%

Loading required package: Seqinfo
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.


Attaching package: 'Biobase'

The following object is masked from 'package:MatrixGenerics':

    rowMedians

The following objects are masked from 'package:matrixStats':

    anyMissing, rowMedians


Attaching package: 'SummarizedExperiment'

The following object is masked from 'package:Seurat':

    Assays

The following object is masked from 'package:SeuratObject':

    Assays

> 
> # Helper function to create test Seurat object
> create_test_seurat <- function() {
+   set.seed(42)
+ 
+   # Toy counts matrix: 10 genes x 12 cells
+   mat <- matrix(rpois(120, lambda = 5), nrow = 10)
+   rownames(mat) <- paste0("gene", 1:10)
+   colnames(mat) <- paste0("cell", 1:12)
+ 
+   # Metadata: four conditions, three cells each
+   meta <- data.frame(
+     orig.ident = rep(c("sample1", "sample2", "sample3", "sample4"), each = 3),
+     condition = rep(c("A", "B", "C", "D"), each = 3),
+     cluster = rep(c("cluster1", "cluster2"), times = 6)
+   )
+   rownames(meta) <- colnames(mat)
+ 
+   # Create Seurat object - convert matrix to dgCMatrix to avoid warnings
+   mat_sparse <- as(mat, "dgCMatrix")
+   seurat_obj <- CreateSeuratObject(counts = mat_sparse, meta.data = meta)
+   seurat_obj <- NormalizeData(seurat_obj)
+ 
+   # Add a metadata feature
+   seurat_obj$metadata_feature <- rnorm(ncol(seurat_obj))
+ 
+   return(seurat_obj)
+ }
> 
> # Helper function to create test SCE object
> create_test_sce <- function() {
+   set.seed(42)
+ 
+   # Toy counts matrix: 10 genes x 12 cells
+   mat <- matrix(rpois(120, lambda = 5), nrow = 10)
+   rownames(mat) <- paste0("gene", 1:10)
+   colnames(mat) <- paste0("cell", 1:12)
+ 
+   # Create SingleCellExperiment
+   sce <- SingleCellExperiment(
+     assays = list(counts = mat, logcounts = log1p(mat)),
+     colData = data.frame(
+       orig.ident = rep(c("sample1", "sample2", "sample3", "sample4"), each = 3),
+       condition = rep(c("A", "B", "C", "D"), each = 3),
+       cluster = rep(c("cluster1", "cluster2"), times = 6)
+     )
+   )
+ 
+   return(sce)
+ }
> 
> test_that("DO.BarplotWilcox returns ggplot and list correctly", {
+   skip_if_not_installed("Seurat")
+   skip_if_not_installed("ggplot2")
+   skip_if_not_installed("rstatix")
+ 
+   seurat_obj <- create_test_seurat()
+ 
+   # Test 1: Default parameters (ggplot)
+   p <- DO.BarplotWilcox(
+     sce_object = seurat_obj,
+     Feature = "gene1",
+     ListTest = list(c("A","B")),
+     returnValues = FALSE,
+     ctrl.condition = "A",
+     group.by = "condition"
+   )
+   expect_s3_class(p, "ggplot")
+ 
+   # Test 2: returnValues = TRUE (list with components)
+   res <- DO.BarplotWilcox(
+     sce_object = seurat_obj,
+     Feature = "gene1",
+     ListTest = list(c("A","B")),
+     returnValues = TRUE,
+     ctrl.condition = "A",
+     group.by = "condition"
+   )
+   expect_type(res, "list")
+   expect_named(res, c("plot", "df.melt", "df.melt.orig", "df.melt.sum", "stat.test"))
+   expect_s3_class(res$plot, "ggplot")
+   expect_true(is.data.frame(res$df.melt))
+   expect_true(is.data.frame(res$df.melt.orig))
+   expect_true(is.data.frame(res$df.melt.sum))
+ })
Performing log-normalization
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
── Error: DO.BarplotWilcox returns ggplot and list correctly ───────────────────
Error in `DO.BarplotWilcox(sce_object = seurat_obj, Feature = "gene1", 
    ListTest = list(c("A", "B")), returnValues = FALSE, ctrl.condition = "A", 
    group.by = "condition")`: could not find function "DO.BarplotWilcox"

Error:
! Test failed
Backtrace:
    ▆
 1. ├─testthat::test_that(...)
 2. │ └─withr (local) `<fn>`()
 3. └─reporter$stop_if_needed()
 4.   └─rlang::abort("Test failed", call = NULL)
Execution halted

DOtools.Rcheck/tests/test-DO.Dotplot.Rout


R version 4.5.1 Patched (2025-08-23 r88802) -- "Great Square Root"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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.

> # tests/testthat/test-DO.Dotplot-full.R
> library(testthat)
> library(Seurat)
Loading required package: SeuratObject
Loading required package: sp

Attaching package: 'SeuratObject'

The following objects are masked from 'package:base':

    intersect, t

> library(SingleCellExperiment)
Loading required package: SummarizedExperiment
Loading required package: MatrixGenerics
Loading required package: matrixStats

Attaching package: 'MatrixGenerics'

The following objects are masked from 'package:matrixStats':

    colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
    colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
    colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
    colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
    colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
    colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
    colWeightedMeans, colWeightedMedians, colWeightedSds,
    colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
    rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
    rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
    rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
    rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
    rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
    rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
    rowWeightedSds, rowWeightedVars

Loading required package: GenomicRanges
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: generics

Attaching package: 'generics'

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 objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, is.unsorted, lapply,
    mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
    rank, rbind, rownames, sapply, saveRDS, table, tapply, unique,
    unsplit, which.max, which.min

Loading required package: S4Vectors

Attaching package: 'S4Vectors'

The following object is masked from 'package:utils':

    findMatches

The following objects are masked from 'package:base':

    I, expand.grid, unname

Loading required package: IRanges

Attaching package: 'IRanges'

The following object is masked from 'package:sp':

    %over%

Loading required package: Seqinfo
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.


Attaching package: 'Biobase'

The following object is masked from 'package:MatrixGenerics':

    rowMedians

The following objects are masked from 'package:matrixStats':

    anyMissing, rowMedians


Attaching package: 'SummarizedExperiment'

The following object is masked from 'package:Seurat':

    Assays

The following object is masked from 'package:SeuratObject':

    Assays

> library(DOtools)
> library(Matrix)

Attaching package: 'Matrix'

The following object is masked from 'package:S4Vectors':

    expand

> library(ggplot2)
> 
> safe_dotplot <- function(...) suppressWarnings(suppressMessages(DO.Dotplot(...)))
> 
> # Helper function to create consistent test data
> create_test_seurat <- function() {
+   set.seed(1234)
+   n_genes <- 200
+   n_cells <- 60
+   synthetic_genes <- paste0("SGENE", seq_len(n_genes))
+ 
+   # Create matrix with correct dimensions: n_genes x n_cells
+   counts_matrix <- matrix(
+     rpois(n_genes * n_cells, lambda = 1),
+     nrow = n_genes,
+     ncol = n_cells,
+     dimnames = list(synthetic_genes, paste0("Cell", seq_len(n_cells)))
+   )
+ 
+   # Convert to dgCMatrix
+   counts <- as(counts_matrix, "dgCMatrix")
+ 
+   clusters <- c(rep("C1", 30), rep("C2", 30))
+   conditions <- c(rep(c("healthy","disease"), each = 15), rep(c("healthy","disease"), each = 15))
+   origidents <- rep(c("sample1","sample2","sample3","sample4"), length.out = n_cells)
+ 
+   # Create some expression patterns
+   counts["SGENE10", clusters == "C1" & conditions == "healthy"] <- rpois(15, 80)
+   counts["SGENE10", clusters == "C1" & conditions == "disease"] <- rpois(15, 2)
+   counts["SGENE20", clusters == "C2" & conditions == "disease"] <- rpois(15, 70)
+   counts["SGENE20", clusters == "C2" & conditions == "healthy"] <- rpois(15, 1)
+   counts["SGENE30",] <- rpois(n_cells, 5)  # Low expression gene
+   counts["SGENE40",] <- 0  # Zero expression gene
+ 
+   suppressWarnings({
+     seu <- CreateSeuratObject(counts = counts, assay = "RNA")
+   })
+   seu$cluster <- clusters
+   seu$condition <- conditions
+   seu$orig.ident <- origidents
+   seu <- NormalizeData(seu, verbose = FALSE)
+   return(seu)
+ }
> 
> # Define PercentAbove function
> PercentAbove <- function(x, threshold = 0) {
+   if (length(x) == 0) return(0)  # Handle empty vector case
+   return(length(x = x[x > threshold]) / length(x = x))
+ }
> 
> # ---- Tests for branches ----
> 
> test_that("SingleCellExperiment conversion works", {
+   seu <- create_test_seurat()
+ 
+   # Convert to SCE and test - suppress the scale.data warning
+   suppressWarnings({
+     sce <- as.SingleCellExperiment(seu)
+   })
+   p <- safe_dotplot(sce, Feature = c("SGENE10", "SGENE20"), group.by.x = "condition")
+   expect_s3_class(p, "ggplot")
+ })
Test passed 🥳
> 
> test_that("error handling for invalid Feature types", {
+   seu <- create_test_seurat()
+ 
+   # Test non-vector, non-dataframe input
+   expect_error(DO.Dotplot(seu, Feature = list("SGENE10", "SGENE20"), group.by.x = "condition"))
+ })
Test passed 🥳
> 
> test_that("cluster name detection in data frame works with various column names", {
+   seu <- create_test_seurat()
+ 
+   # Test different cluster column names
+   features_df_cluster <- data.frame(
+     gene = c("SGENE10", "SGENE20"),
+     cluster = c("C1", "C2"),
+     stringsAsFactors = FALSE
+   )
+   p1 <- safe_dotplot(seu, Feature = features_df_cluster, group.by.x = "condition")
+   expect_s3_class(p1, "ggplot")
+ 
+ 
+ })
Test passed 🥳
> 
> test_that("gene name detection in data frame works with various column names", {
+   seu <- create_test_seurat()
+ 
+   # Test gene column named "feature"
+   features_df_feature <- data.frame(
+     feature = c("SGENE10", "SGENE20"),
+     cluster = c("C1", "C2"),
+     stringsAsFactors = FALSE
+   )
+   p <- safe_dotplot(seu, Feature = features_df_feature, group.by.x = "condition")
+   expect_s3_class(p, "ggplot")
+ })
Test passed 🥳
> 
> test_that("error handling for invalid data frame columns", {
+   seu <- create_test_seurat()
+ 
+   features_df_invalid <- data.frame(
+     invalid_col1 = c("SGENE10", "SGENE20"),
+     invalid_col2 = c("C1", "C2"),
+     stringsAsFactors = FALSE
+   )
+   expect_error(safe_dotplot(seu, Feature = features_df_invalid, group.by.x = "condition"))
+ })
Test passed 🥳
> 
> test_that("group.by.x only case with identical id and xaxis", {
+   seu <- create_test_seurat()
+ 
+   # Test case where id and xaxis become identical
+   features_df <- data.frame(
+     gene = c("SGENE10", "SGENE20", "SGENE30"),
+     cluster = c("C1", "C2", "C1"),
+     stringsAsFactors = FALSE
+   )
+ 
+   p <- safe_dotplot(seu, Feature = features_df, group.by.x = "condition")
+   expect_s3_class(p, "ggplot")
+ })
Test passed 🥳
> 
> test_that("hide_zero functionality with complete cases", {
+   seu <- create_test_seurat()
+ 
+   # Test hide_zero = FALSE keeps zeros
+   df_show <- safe_dotplot(seu, Feature = "SGENE40", group.by.x = "condition",
+                           hide_zero = FALSE, returnValue = TRUE)
+   # Should have entries even for zero expression
+   expect_true(nrow(df_show) > 0)
+ })
Test passed 🥳
> 
> test_that("pseudobulk functionality with edge cases", {
+   seu <- create_test_seurat()
+ 
+   # Test pseudobulk with single group
+   p1 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                      group.by.x = "condition", across.group.by.x = TRUE)
+   expect_s3_class(p1, "ggplot")
+ 
+   # Test pseudobulk with group.by.y but no group.by.y2
+   p2 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                      group.by.x = "condition", group.by.y = "cluster",
+                      across.group.by.y = TRUE)
+   expect_s3_class(p2, "ggplot")
+ })
Test passed 😀
> 
> test_that("expression scaling and transformation combinations", {
+   seu <- create_test_seurat()
+ 
+   # Test all combinations of scale_gene and log1p_nUMI
+   combinations <- list(
+     c(FALSE, FALSE),
+     c(FALSE, TRUE),
+     c(TRUE, FALSE),
+     c(TRUE, TRUE)
+   )
+ 
+   for (combo in combinations) {
+     scale_gene <- combo[1]
+     log1p_nUMI <- combo[2]
+ 
+     p <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                       group.by.x = "condition",
+                       scale_gene = scale_gene,
+                       log1p_nUMI = log1p_nUMI)
+     expect_s3_class(p, "ggplot")
+   }
+ })
Test passed 🥳
> 
> test_that("aesthetic mapping selection logic", {
+   seu <- create_test_seurat()
+ 
+   # Test case where id and xaxis are identical with vector Feature
+   p1 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"), group.by.x = "condition")
+   expect_s3_class(p1, "ggplot")
+ 
+   # Test case where id and xaxis are identical with dataframe Feature
+   features_df <- data.frame(
+     gene = c("SGENE10", "SGENE20"),
+     cluster = c("C1", "C2"),
+     stringsAsFactors = FALSE
+   )
+   p2 <- safe_dotplot(seu, Feature = features_df, group.by.x = "condition")
+   expect_s3_class(p2, "ggplot")
+ 
+   # Test case with group.by.y (different id and xaxis)
+   p3 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                      group.by.x = "condition", group.by.y = "cluster")
+   expect_s3_class(p3, "ggplot")
+ })
Test passed 😀
> 
> test_that("color scale branches", {
+   seu <- create_test_seurat()
+ 
+   # Test the main branch with 2 colors (default)
+   p1 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"), group.by.x = "condition")
+   expect_s3_class(p1, "ggplot")
+ })
Test passed 🥳
> 
> test_that("facetting and plot type branches", {
+   seu <- create_test_seurat()
+ 
+   # Test across.group.by.x branch
+   p1 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                      group.by.x = "condition", across.group.by.x = TRUE)
+   expect_s3_class(p1, "ggplot")
+ 
+   # Test across.group.by.y branch
+   p2 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                      group.by.x = "condition", group.by.y = "cluster",
+                      across.group.by.y = TRUE)
+   expect_s3_class(p2, "ggplot")
+ 
+   # Test identical id/xaxis branch with dataframe
+   features_df <- data.frame(
+     gene = c("SGENE10", "SGENE20"),
+     cluster = c("C1", "C2"),
+     stringsAsFactors = FALSE
+   )
+   p3 <- safe_dotplot(seu, Feature = features_df, group.by.x = "condition")
+   expect_s3_class(p3, "ggplot")
+ 
+   # Test default branch (group.by.y case)
+   p4 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                      group.by.x = "condition", group.by.y = "cluster")
+   expect_s3_class(p4, "ggplot")
+ })
Test passed 😀
> 
> test_that("annotation_x with coord_flip scenario", {
+   seu <- create_test_seurat()
+ 
+   features_df <- data.frame(
+     gene = c("SGENE10", "SGENE20"),
+     cluster = c("C1", "C2"),
+     stringsAsFactors = FALSE
+   )
+ 
+   # Test without expecting warning
+   p <- safe_dotplot(seu, Feature = features_df, group.by.x = "condition",
+                     annotation_x = TRUE, coord_flip = TRUE)
+   expect_s3_class(p, "ggplot")
+ })
Test passed 🥳
> 
> test_that("statistical significance star plotting", {
+   seu <- create_test_seurat()
+ 
+   # Test with stats_x = TRUE
+   p1 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                      group.by.x = "condition", group.by.y = "cluster",
+                      stats_x = TRUE)
+   expect_s3_class(p1, "ggplot")
+ 
+   # Test with stats_y = TRUE
+   p2 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                      group.by.x = "condition", group.by.y = "cluster",
+                      stats_y = TRUE)
+   expect_s3_class(p2, "ggplot")
+ 
+   # Test with both stats TRUE
+   p3 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                      group.by.x = "condition", group.by.y = "cluster",
+                      stats_x = TRUE, stats_y = TRUE)
+   expect_s3_class(p3, "ggplot")
+ })
Test passed 😀
> 
> test_that("scale_size_continuous with different scenarios", {
+   seu <- create_test_seurat()
+ 
+   # Test with normal data
+   p1 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"), group.by.x = "condition")
+   expect_s3_class(p1, "ggplot")
+ 
+   # Test with single group (different size scaling branch)
+   features_df <- data.frame(
+     gene = c("SGENE10", "SGENE20"),
+     cluster = c("C1", "C2"),
+     stringsAsFactors = FALSE
+   )
+   p2 <- safe_dotplot(seu, Feature = features_df, group.by.x = "condition")
+   expect_s3_class(p2, "ggplot")
+ })
Test passed 🥳
> 
> test_that("statistical tests with genes that have results", {
+   seu <- create_test_seurat()
+ 
+   # Use genes that definitely have expression and will produce statistical results
+   p <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                     group.by.x = "condition", group.by.y = "cluster",
+                     stats_x = TRUE)
+   expect_s3_class(p, "ggplot")
+ })
Test passed 😀
> 
> test_that("factor level ordering with sort_x", {
+   seu <- create_test_seurat()
+ 
+   # Test sort_x with group.by.y
+   p1 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                      group.by.x = "condition", group.by.y = "cluster",
+                      sort_x = c("disease", "healthy"))
+   expect_s3_class(p1, "ggplot")
+ 
+   # Test sort_x without group.by.y
+   p2 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                      group.by.x = "condition", sort_x = c("SGENE20", "SGENE10"))
+   expect_s3_class(p2, "ggplot")
+ })
Test passed 😀
> 
> test_that("pseudobulk level ordering", {
+   seu <- create_test_seurat()
+ 
+   # Test pseudobulk level ordering for x-axis
+   p1 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                      group.by.x = "condition", across.group.by.x = TRUE)
+   expect_s3_class(p1, "ggplot")
+ 
+   # Test pseudobulk level ordering for y-axis without group.by.y2
+   p2 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                      group.by.x = "condition", group.by.y = "cluster",
+                      across.group.by.y = TRUE)
+   expect_s3_class(p2, "ggplot")
+ 
+   # Test pseudobulk level ordering for y-axis with group.by.y2
+   p3 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                      group.by.x = "condition", group.by.y = "cluster",
+                      group.by.y2 = "orig.ident", across.group.by.y = TRUE)
+   expect_s3_class(p3, "ggplot")
+ })
Test passed 😀
> 
> test_that("edge cases with proper data preparation", {
+   # Test with very small dataset
+   set.seed(123)
+   tiny_counts <- matrix(rpois(5 * 10, lambda = 1), nrow = 5, ncol = 10,
+                         dimnames = list(paste0("G", 1:5), paste0("C", 1:10)))
+ 
+   # Convert to dgCMatrix to avoid warning
+   tiny_counts <- as(tiny_counts, "dgCMatrix")
+ 
+   suppressWarnings({
+     tiny_seu <- CreateSeuratObject(counts = tiny_counts)
+   })
+   tiny_seu$group <- rep(c("A", "B"), each = 5)
+   tiny_seu <- NormalizeData(tiny_seu, verbose = FALSE)  # Add normalization
+ 
+   p <- safe_dotplot(tiny_seu, Feature = c("G1", "G2"), group.by.x = "group")
+   expect_s3_class(p, "ggplot")
+ })
Test passed 🌈
> 
> test_that("error conditions for statistical tests", {
+   seu <- create_test_seurat()
+ 
+   # Test that no error occurs with valid inputs
+   expect_silent(safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                              group.by.x = "condition", stats_x = FALSE, stats_y = FALSE))
+ })
Test passed 🥳
> 
> test_that("guide customization layers", {
+   seu <- create_test_seurat()
+ 
+   # Test that guide layers are properly applied
+   p <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"), group.by.x = "condition")
+ 
+   # Check that the plot has guides
+   expect_s3_class(p, "ggplot")
+ })
Test passed 🥳
> 
> test_that("PercentAbove function edge cases", {
+   # Test PercentAbove with various inputs
+   expect_equal(PercentAbove(c(0, 0, 0), threshold = 0), 0)
+   expect_equal(PercentAbove(c(1, 2, 3), threshold = 0), 1)
+   expect_equal(PercentAbove(c(1, 2, 3), threshold = 2), 1/3)
+   expect_equal(PercentAbove(numeric(0), threshold = 0), 0) # Handle empty vector
+ })
Test passed 😸
> 
> test_that("data frame manipulation with dplyr functions", {
+   seu <- create_test_seurat()
+ 
+   # Test that the dplyr manipulations work correctly
+   df <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                      group.by.x = "condition", group.by.y = "cluster",
+                      across.group.by.y = TRUE, returnValue = TRUE)
+ 
+   expect_true(is.data.frame(df))
+   expect_true(all(c("gene", "id", "xaxis", "avg.exp", "pct.exp") %in% colnames(df)))
+ })
Test passed 😀
> 
> test_that("conditional factor level setting", {
+   seu <- create_test_seurat()
+ 
+   # Test with annotation_x_rev = TRUE
+   features_df <- data.frame(
+     gene = c("SGENE10", "SGENE20", "SGENE30"),
+     cluster = c("C1", "C2", "C1"),
+     stringsAsFactors = FALSE
+   )
+ 
+   p <- safe_dotplot(seu, Feature = features_df, group.by.x = "condition",
+                     annotation_x = TRUE, annotation_x_rev = TRUE)
+   expect_s3_class(p, "ggplot")
+ })
Test passed 🥳
> 
> # ---- Integration tests with complex scenarios ----
> 
> test_that("complex multi-parameter scenarios without conflicting options", {
+   seu <- create_test_seurat()
+ 
+   features_df <- data.frame(
+     gene = c("SGENE10", "SGENE20", "SGENE30"),
+     cluster = c("C1", "C2", "C1"),
+     stringsAsFactors = FALSE
+   )
+ 
+   # Test complex scenario but don't set both pseudobulk options
+   p1 <- safe_dotplot(seu, Feature = features_df,
+                      group.by.x = "condition",
+                      group.by.y = "cluster",
+                      across.group.by.y = TRUE,  # Only one pseudobulk option
+                      scale_gene = TRUE,
+                      log1p_nUMI = FALSE,
+                      stats_x = TRUE,
+                      stats_y = TRUE,
+                      annotation_x = TRUE,
+                      coord_flip = TRUE,
+                      hide_zero = FALSE,
+                      dot.size = c(2, 8),
+                      point_stroke = 0.5,
+                      limits_colorscale = c(0, 10),
+                      sig_size = 8,
+                      nudge_x = 0.5,
+                      nudge_y = 0.5)
+   expect_s3_class(p1, "ggplot")
+ 
+   # Test another complex scenario with the other pseudobulk option
+   p2 <- safe_dotplot(seu, Feature = features_df,
+                      group.by.x = "condition",
+                      group.by.y = "cluster",
+                      across.group.by.x = TRUE,  # Only one pseudobulk option
+                      scale_gene = FALSE,
+                      log1p_nUMI = TRUE,
+                      stats_x = FALSE,  # Disable stats to avoid subset issues
+                      stats_y = FALSE,  # Disable stats to avoid subset issues
+                      annotation_x = FALSE,
+                      coord_flip = FALSE,
+                      hide_zero = TRUE,
+                      dot.size = c(1, 6),
+                      point_stroke = 0.2)
+   expect_s3_class(p2, "ggplot")
+ })
Test passed 😀
> 
> test_that("complex scenario with group.by.y2 but careful statistical testing", {
+   seu <- create_test_seurat()
+ 
+   features_df <- data.frame(
+     gene = c("SGENE10", "SGENE20"),
+     cluster = c("C1", "C2"),
+     stringsAsFactors = FALSE
+   )
+ 
+   # Use group.by.y2 but avoid statistical tests that cause subset issues
+   p <- safe_dotplot(seu, Feature = features_df,
+                     group.by.x = "condition",
+                     group.by.y = "cluster",
+                     group.by.y2 = "orig.ident",
+                     across.group.by.y = TRUE,
+                     stats_x = FALSE,  # Disable to avoid "No cells found" error
+                     stats_y = FALSE,  # Disable to avoid "No cells found" error
+                     scale_gene = TRUE,
+                     log1p_nUMI = TRUE)
+   expect_s3_class(p, "ggplot")
+ })
Test passed 🥳
> 
> # ---- Additional edge case tests ----
> 
> test_that("empty gene list handling", {
+   seu <- create_test_seurat()
+ 
+   # Test with empty gene list (should error)
+   expect_error(safe_dotplot(seu, Feature = character(0), group.by.x = "condition"))
+ })
Test passed 🥳
> 
> test_that("single cell edge cases", {
+   seu <- create_test_seurat()
+ 
+   # Test with single gene, single group
+   p <- safe_dotplot(seu, Feature = "SGENE10", group.by.x = "condition")
+   expect_s3_class(p, "ggplot")
+ })
Test passed 🥳
> 
> test_that("metadata column edge cases", {
+   seu <- create_test_seurat()
+ 
+   # Test with numeric metadata
+   seu$numeric_meta <- as.numeric(factor(seu$condition))
+   p <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"), group.by.x = "numeric_meta")
+   expect_s3_class(p, "ggplot")
+ })
Test passed 🥳
> 
> test_that("plot margin and theme parameters", {
+   seu <- create_test_seurat()
+ 
+   # Test different margin settings
+   p <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                     group.by.x = "condition", plot.margin = c(0.5, 0.5, 0.5, 0.5))
+   expect_s3_class(p, "ggplot")
+ })
Test passed 🥳
> 
> test_that("various parameter combinations that should work", {
+   seu <- create_test_seurat()
+ 
+   # Test different combinations of parameters that are less likely to cause errors
+   test_combinations <- list(
+     list(group.by.x = "condition", dot.size = c(1, 3)),
+     list(group.by.x = "condition", point_stroke = 0.1),
+     list(group.by.x = "condition", midpoint = 0.8),
+     list(group.by.x = "condition", limits_colorscale = c(0, 2)),
+     list(group.by.x = "condition", sig_size = 4, nudge_x = 0.1, nudge_y = 0.1)
+   )
+ 
+   for (params in test_combinations) {
+     p <- do.call(safe_dotplot, c(list(sce_object = seu, Feature = c("SGENE10", "SGENE20")), params))
+     expect_s3_class(p, "ggplot")
+   }
+ })
Test passed 🥳
> 
> test_that("data frame return structure verification", {
+   seu <- create_test_seurat()
+ 
+   # Test various returnValue scenarios
+   df1 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                       group.by.x = "condition", returnValue = TRUE)
+   expect_true(is.data.frame(df1))
+   expect_true(nrow(df1) > 0)
+ 
+   df2 <- safe_dotplot(seu, Feature = c("SGENE10", "SGENE20"),
+                       group.by.x = "condition", group.by.y = "cluster",
+                       returnValue = TRUE)
+   expect_true(is.data.frame(df2))
+   expect_true(nrow(df2) > 0)
+ })
Test passed 😀
> 
> 
> proc.time()
   user  system elapsed 
 48.772   1.445  50.207 

DOtools.Rcheck/tests/test-DO.MultiDGE.Rout


R version 4.5.1 Patched (2025-08-23 r88802) -- "Great Square Root"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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(DOtools)
> library(Seurat)
Loading required package: SeuratObject
Loading required package: sp

Attaching package: 'SeuratObject'

The following objects are masked from 'package:base':

    intersect, t

> library(SingleCellExperiment)
Loading required package: SummarizedExperiment
Loading required package: MatrixGenerics
Loading required package: matrixStats

Attaching package: 'MatrixGenerics'

The following objects are masked from 'package:matrixStats':

    colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
    colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
    colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
    colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
    colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
    colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
    colWeightedMeans, colWeightedMedians, colWeightedSds,
    colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
    rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
    rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
    rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
    rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
    rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
    rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
    rowWeightedSds, rowWeightedVars

Loading required package: GenomicRanges
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: generics

Attaching package: 'generics'

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 objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, is.unsorted, lapply,
    mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
    rank, rbind, rownames, sapply, saveRDS, table, tapply, unique,
    unsplit, which.max, which.min

Loading required package: S4Vectors

Attaching package: 'S4Vectors'

The following object is masked from 'package:utils':

    findMatches

The following objects are masked from 'package:base':

    I, expand.grid, unname

Loading required package: IRanges

Attaching package: 'IRanges'

The following object is masked from 'package:sp':

    %over%

Loading required package: Seqinfo
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.


Attaching package: 'Biobase'

The following object is masked from 'package:MatrixGenerics':

    rowMedians

The following objects are masked from 'package:matrixStats':

    anyMissing, rowMedians


Attaching package: 'SummarizedExperiment'

The following object is masked from 'package:Seurat':

    Assays

The following object is masked from 'package:SeuratObject':

    Assays

> 
> test_that("DO.MultiDGE returns merged dataframe with SC and PB results", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   expect_true(all(c("gene", "celltype", "condition") %in% colnames(result)))
+   expect_true(any(grepl("SC_wilcox", colnames(result))))
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE works with SingleCellExperiment input", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   expect_true(all(c("gene", "celltype", "condition") %in% colnames(result)))
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE stops when ident_ctrl not found", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   expect_error(
+     DO.MultiDGE(
+       sce_object = sce_data,
+       sample_col = "orig.ident",
+       method_sc = "wilcox",
+       annotation_col = "annotation",
+       ident_ctrl = "nonexistent_condition"
+     ),
+     "was not found in meta data"
+   )
+ })
── Warning: DO.MultiDGE stops when ident_ctrl not found ────────────────────────
2 arguments not used by format '%s was not found in meta data under the specified '
Backtrace:
    ▆
 1. ├─testthat::expect_error(...)
 2. │ └─testthat:::quasi_capture(...)
 3. │   ├─testthat (local) .capture(...)
 4. │   │ └─base::withCallingHandlers(...)
 5. │   └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
 6. └─DOtools::DO.MultiDGE(...)
 7.   ├─base::stop(...)
 8.   └─base::sprintf(...)

> 
> test_that("DO.MultiDGE works with different method_sc", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   # Test with different methods
+   methods_to_test <- c("wilcox", "t")
+ 
+   for(method in methods_to_test) {
+     result <- DO.MultiDGE(
+       sce_object = sce_data,
+       sample_col = "orig.ident",
+       method_sc = method,
+       annotation_col = "annotation",
+       ident_ctrl = "healthy"
+     )
+ 
+     expect_true(any(grepl(paste0("SC_", method), colnames(result))))
+   }
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE handles min_pct and logfc_threshold parameters", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy",
+     min_pct = 0.1,
+     logfc_threshold = 0.25
+   )
+ 
+   expect_true(all(c("gene", "celltype", "condition") %in% colnames(result)))
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE works with only_pos = TRUE", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy",
+     only_pos = TRUE
+   )
+ 
+   expect_true(all(c("gene", "celltype", "condition") %in% colnames(result)))
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE handles cell count filtering", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy",
+     min_cells_group = 5
+   )
+ 
+   expect_s3_class(result, "data.frame")
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE works with different assays", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   seurat_obj <- as.Seurat(sce_data)
+ 
+   result <- DO.MultiDGE(
+     sce_object = seurat_obj,
+     assay = "RNA",
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   expect_true(all(c("gene", "celltype", "condition") %in% colnames(result)))
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE returns proper column structure", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   expected_base_cols <- c("gene", "pct.1", "pct.2", "celltype", "condition")
+   expect_true(all(expected_base_cols %in% colnames(result)))
+   expect_true(any(grepl("SC_wilcox", colnames(result))))
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE works with additional FindMarkers parameters", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy",
+     min.cells.feature = 3,
+     verbose = FALSE
+   )
+ 
+   expect_s3_class(result, "data.frame")
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE handles different group_by columns", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   if ("condition" %in% colnames(sce_data@colData)) {
+     result <- DO.MultiDGE(
+       sce_object = sce_data,
+       group_by = "condition",
+       sample_col = "orig.ident",
+       method_sc = "wilcox",
+       annotation_col = "annotation",
+       ident_ctrl = "healthy"
+     )
+ 
+     expect_s3_class(result, "data.frame")
+   }
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> 
> test_that("DO.MultiDGE handles the internal .suppressDeprecationWarnings", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   expect_s3_class(result, "data.frame")
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE handles the PB_ident creation and usage", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   expect_s3_class(result, "data.frame")
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE column renaming works correctly", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   sc_cols <- grep("SC_", colnames(result), value = TRUE)
+   expect_true(length(sc_cols) > 0)
+   expect_true(all(c("gene", "celltype", "condition") %in% colnames(result)))
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE handles the left join operation correctly", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   expect_s3_class(result, "data.frame")
+ 
+   if (nrow(result) > 0) {
+     expect_false(any(is.na(result$gene)))
+     expect_false(any(is.na(result$celltype)))
+     expect_false(any(is.na(result$condition)))
+   }
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE logging doesn't interfere with execution", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   expect_s3_class(result, "data.frame")
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE works with minimal parameters", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   expect_s3_class(result, "data.frame")
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE pseudo-bulk aggregation works", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   expect_s3_class(result, "data.frame")
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> # TESTS FOR SPECIFIC FUNCTIONAL PATHS THAT ARE SAFE
> 
> test_that("DO.MultiDGE handles the AggregateExpression pathway", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   # This tests the pseudo-bulk creation without triggering empty results
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",  # This is critical for aggregation
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   expect_s3_class(result, "data.frame")
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE handles annotation name consistency check", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   # This tests the annotation name consistency logic
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",  # Use standard annotation column
+     ident_ctrl = "healthy"
+   )
+ 
+   expect_s3_class(result, "data.frame")
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE handles the comparison loop structure", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   # Test with a control condition that exists
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   # handle the comparison loops without error
+   expect_s3_class(result, "data.frame")
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE handles the cell count validation", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   # Test with reasonable min_cells_group
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy",
+     min_cells_group = 3  # Default value
+   )
+ 
+   expect_s3_class(result, "data.frame")
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> test_that("DO.MultiDGE handles the result collection and merging", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   # Test the final merged result structure
+   expect_s3_class(result, "data.frame")
+   if (nrow(result) > 0) {
+     # key columns for the merge
+     expect_true(all(c("gene", "celltype", "condition") %in% colnames(result)))
+   }
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> # TEST FOR THE DESeq2 PSEUDO-BULK PATHWAY
> test_that("DO.MultiDGE DESeq2 pseudo-bulk analysis completes", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",  # Required for pseudo-bulk
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   # should complete the DESeq2 pseudo-bulk pathway
+   expect_s3_class(result, "data.frame")
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> # TEST FOR THE SINGLE-CELL ANALYSIS PATHWAY
> test_that("DO.MultiDGE single-cell analysis completes", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   result <- DO.MultiDGE(
+     sce_object = sce_data,
+     sample_col = "orig.ident",
+     method_sc = "wilcox",
+     annotation_col = "annotation",
+     ident_ctrl = "healthy"
+   )
+ 
+   # Should complete single-cell analysis pathway
+   expect_s3_class(result, "data.frame")
+   expect_true(any(grepl("SC_wilcox", colnames(result))))
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> # COMPREHENSIVE TEST COVERING MULTIPLE PARAMETERS
> test_that("DO.MultiDGE comprehensive parameter test", {
+   sce_data <- readRDS(system.file("extdata", "sce_data.rds", package = "DOtools"))
+ 
+   # Test multiple parameter combinations that are known to work
+   test_combinations <- list(
+     list(method_sc = "wilcox", only_pos = FALSE),
+     list(method_sc = "wilcox", only_pos = TRUE),
+     list(method_sc = "t", only_pos = FALSE)
+   )
+ 
+   for (params in test_combinations) {
+     result <- DO.MultiDGE(
+       sce_object = sce_data,
+       sample_col = "orig.ident",
+       method_sc = params$method_sc,
+       annotation_col = "annotation",
+       ident_ctrl = "healthy",
+       only_pos = params$only_pos
+     )
+ 
+     expect_s3_class(result, "data.frame")
+     if (nrow(result) > 0) {
+       expect_true(any(grepl(paste0("SC_", params$method_sc), colnames(result))))
+     }
+   }
+ })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Test passed 😀
> 
> proc.time()
   user  system elapsed 
173.734   1.847 175.571 

DOtools.Rcheck/tests/test-DO.scVI.Rout.fail


R version 4.5.1 Patched (2025-08-23 r88802) -- "Great Square Root"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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(mockery)
> library(Seurat)
Loading required package: SeuratObject
Loading required package: sp

Attaching package: 'SeuratObject'

The following objects are masked from 'package:base':

    intersect, t

> library(SingleCellExperiment)
Loading required package: SummarizedExperiment
Loading required package: MatrixGenerics
Loading required package: matrixStats

Attaching package: 'MatrixGenerics'

The following objects are masked from 'package:matrixStats':

    colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
    colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
    colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
    colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
    colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
    colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
    colWeightedMeans, colWeightedMedians, colWeightedSds,
    colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
    rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
    rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
    rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
    rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
    rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
    rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
    rowWeightedSds, rowWeightedVars

Loading required package: GenomicRanges
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: generics

Attaching package: 'generics'

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 objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, is.unsorted, lapply,
    mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
    rank, rbind, rownames, sapply, saveRDS, table, tapply, unique,
    unsplit, which.max, which.min

Loading required package: S4Vectors

Attaching package: 'S4Vectors'

The following object is masked from 'package:utils':

    findMatches

The following objects are masked from 'package:base':

    I, expand.grid, unname

Loading required package: IRanges

Attaching package: 'IRanges'

The following object is masked from 'package:sp':

    %over%

Loading required package: Seqinfo
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.


Attaching package: 'Biobase'

The following object is masked from 'package:MatrixGenerics':

    rowMedians

The following objects are masked from 'package:matrixStats':

    anyMissing, rowMedians


Attaching package: 'SummarizedExperiment'

The following object is masked from 'package:Seurat':

    Assays

The following object is masked from 'package:SeuratObject':

    Assays

> library(Matrix)

Attaching package: 'Matrix'

The following object is masked from 'package:S4Vectors':

    expand

> 
> SCE_obj <- readRDS(
+   system.file("extdata",
+               "sce_data.rds",
+               package = "DOtools")
+ )
> 
> # ------------------------------
> # Improved Helper functions for test objects
> # ------------------------------
> setup_minimal_seurat <- function() {
+   set.seed(42)
+   counts_matrix <- as(
+     matrix(rpois(20*10, lambda = 10), nrow = 20, ncol = 10), "dgCMatrix"
+     )
+   rownames(counts_matrix) <- paste0("Gene", 1:20)
+   colnames(counts_matrix) <- paste0("Cell", 1:10)
+ 
+   seurat_obj <- CreateSeuratObject(counts = counts_matrix)
+   seurat_obj <- NormalizeData(seurat_obj, verbose = FALSE)
+   seurat_obj <- ScaleData(seurat_obj, verbose = FALSE)
+ 
+   seurat_obj$orig.ident <- rep(c("A", "B"), each = 5)
+   VariableFeatures(seurat_obj) <- rownames(seurat_obj)[1:10]
+   seurat_obj
+ }
> 
> setup_minimal_sce <- function() {
+   set.seed(42)
+   counts_matrix <- as(
+     matrix(rpois(20*10, lambda = 10), nrow = 20, ncol = 10), "dgCMatrix"
+     )
+   rownames(counts_matrix) <- paste0("Gene", 1:20)
+   colnames(counts_matrix) <- paste0("Cell", 1:10)
+ 
+   sce <- SingleCellExperiment(
+     assays = list(
+       counts = counts_matrix,
+       logcounts = log1p(counts_matrix)
+     )
+   )
+   colData(sce)$orig.ident <- rep(c("A", "B"), each = 5)
+   sce
+ }
> 
> # Global mock for basiliskRun to avoid Python execution
> mock_basilisk_run <- function(env, fun, args) {
+   # Return a simple matrix as the scVI embedding
+   embedding <- matrix(
+     runif(ncol(args$sce_object) * 5), nrow = ncol(args$sce_object), ncol = 5
+     )
+   rownames(embedding) <- colnames(args$sce_object)
+   embedding
+ }
> 
> # ------------------------------
> # Enhanced Tests with Real Data
> # ------------------------------
> 
> test_that("DO.scVI works with real SCE data", {
+   skip_if_not(exists("SCE_obj"), "Real SCE data not available")
+ 
+   # Ensure the object has the required structure
+   expect_s4_class(SCE_obj, "SingleCellExperiment")
+   expect_true("counts" %in% assayNames(SCE_obj))
+ 
+   # Add batch information if not present
+   if (!"orig.ident" %in% colnames(colData(SCE_obj))) {
+     colData(SCE_obj)$orig.ident <- rep(c("A", "B"), length.out = ncol(SCE_obj))
+   }
+ 
+   mock_as_seurat <- function(x) {
+     # Create a minimal Seurat object that mimics conversion from real SCE
+     counts_matrix <- assay(x, "counts")
+     seurat_obj <- CreateSeuratObject(counts = counts_matrix)
+     seurat_obj <- NormalizeData(seurat_obj, verbose = FALSE)
+     VariableFeatures(seurat_obj) <-
+       rownames(seurat_obj)[1:min(2000, nrow(seurat_obj))]
+     seurat_obj$orig.ident <- colData(x)$orig.ident
+     seurat_obj
+   }
+ 
+   testthat::with_mocked_bindings(
+     basiliskRun = mock_basilisk_run,
+     code = {
+       mockery::stub(DO.scVI, "as.Seurat", mock_as_seurat)
+       result <- DO.scVI(SCE_obj, batch_key = "orig.ident")
+     },
+     .package = "basilisk"
+   )
+ 
+   expect_s4_class(result, "SingleCellExperiment")
+   expect_true("scVI" %in% reducedDimNames(result))
+ })
── Error: DO.scVI works with real SCE data ─────────────────────────────────────
Error in `eval(code, test_env)`: object 'DO.scVI' not found
Backtrace:
    ▆
 1. ├─testthat::with_mocked_bindings(...)
 2. └─mockery::stub(DO.scVI, "as.Seurat", mock_as_seurat)
 3.   └─mockery:::build_function_tree(test_env, where, where_name, depth)

Error:
! Test failed
Backtrace:
    ▆
 1. ├─testthat::test_that(...)
 2. │ └─withr (local) `<fn>`()
 3. └─reporter$stop_if_needed()
 4.   └─rlang::abort("Test failed", call = NULL)
Execution halted

DOtools.Rcheck/tests/test-DO.SplitBarGSEA.Rout


R version 4.5.1 Patched (2025-08-23 r88802) -- "Great Square Root"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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(DOtools)
> 
> test_that("DO.SplitBarGSEA executes successfully on mock GSEA data", {
+   set.seed(123)
+ 
+   # Create a mock GSEA data frame with proper structure
+   df_GSEA <- data.frame(
+     Term = paste0("GO_Term_", 1:20),
+     Combined.Score = runif(20, 1, 10),
+     State = rep(c("enriched", "depleted"), 10),
+     celltype = rep(c("CT1", "CT2"), each = 10),
+     stringsAsFactors = FALSE
+   )
+ 
+   # Test that the function runs without errors
+   expect_error(
+     suppressMessages({
+       DO.SplitBarGSEA(
+         df_GSEA = df_GSEA,
+         term_col = "Term",
+         col_split = "Combined.Score",
+         cond_col = "State",
+         pos_cond = "enriched",
+         cutoff = 30,
+         log10_transform = FALSE,
+         figsize = c(8,6),
+         topN = 5,
+         colors_pairs = c("red", "blue"),
+         alpha_colors = 0.5,
+         path = NULL,
+         spacing = 5,
+         txt_size = 10,
+         filename = "test.svg",
+         title = "Test Split Bar Plot",
+         showP = FALSE,
+         celltype = "all"
+       )
+     }),
+     NA  # Expect no error
+   )
+ })
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
Test passed 😀
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
> 
> test_that("DO.SplitBarGSEA handles missing celltype column", {
+   set.seed(123)
+ 
+   # Create mock data without celltype column
+   df_GSEA_no_celltype <- data.frame(
+     Term = paste0("GO_Term_", 1:10),
+     Combined.Score = runif(10, 1, 10),
+     State = rep(c("enriched", "depleted"), 5),
+     stringsAsFactors = FALSE
+   )
+ 
+   # Test that function throws error when celltype column is missing
+   expect_error(
+     DO.SplitBarGSEA(
+       df_GSEA = df_GSEA_no_celltype,
+       term_col = "Term",
+       col_split = "Combined.Score",
+       cond_col = "State",
+       pos_cond = "enriched"
+     ),
+     "Provided data frame has no column named 'celltype'"
+   )
+ })
Test passed 🌈
> 
> test_that("DO.SplitBarGSEA handles single celltype subsetting", {
+   set.seed(123)
+ 
+   df_GSEA <- data.frame(
+     Term = paste0("GO_Term_", 1:20),
+     Combined.Score = runif(20, 1, 10),
+     State = rep(c("enriched", "depleted"), 10),
+     celltype = rep(c("CT1", "CT2", "CT3", "CT4"), each = 5),
+     stringsAsFactors = FALSE
+   )
+ 
+   # Test with single celltype (avoiding the vector bug)
+   expect_error(
+     suppressMessages({
+       DO.SplitBarGSEA(
+         df_GSEA = df_GSEA,
+         term_col = "Term",
+         col_split = "Combined.Score",
+         cond_col = "State",
+         pos_cond = "enriched",
+         celltype = "CT1",  # Single celltype only
+         topN = 2
+       )
+     }),
+     NA
+   )
+ })
Test passed 😀
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
> 
> test_that("DO.SplitBarGSEA handles log10 transformation with safe data", {
+   set.seed(123)
+ 
+   # Create balanced data with enough terms for each condition
+   df_GSEA <- data.frame(
+     Term = paste0("GO_Term_", 1:40),
+     Combined.Score = runif(40, 0.001, 0.1),
+     State = rep(rep(c("enriched", "depleted"), each = 10), 2),
+     celltype = rep(c("CT1", "CT2"), each = 20),
+     stringsAsFactors = FALSE
+   )
+ 
+   # Test with log10_transform = TRUE and conservative topN
+   expect_error(
+     suppressMessages({
+       DO.SplitBarGSEA(
+         df_GSEA = df_GSEA,
+         term_col = "Term",
+         col_split = "Combined.Score",
+         cond_col = "State",
+         pos_cond = "enriched",
+         log10_transform = TRUE,
+         topN = 5
+       )
+     }),
+     NA
+   )
+ })
Test passed 🎊
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
Assuming col_split contains Pvals, apply -log10 transformation
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
Assuming col_split contains Pvals, apply -log10 transformation
> 
> test_that("DO.SplitBarGSEA handles different topN values with balanced data", {
+   set.seed(123)
+ 
+   # Create data with exactly equal numbers for each condition
+   df_GSEA <- data.frame(
+     Term = paste0("GO_Term_", 1:40),
+     Combined.Score = runif(40, 1, 10),
+     State = rep(rep(c("enriched", "depleted"), each = 10), 2),
+     celltype = "CT1",
+     stringsAsFactors = FALSE
+   )
+ 
+   # Test with topN = 3
+   expect_error(
+     suppressMessages({
+       DO.SplitBarGSEA(
+         df_GSEA = df_GSEA,
+         term_col = "Term",
+         col_split = "Combined.Score",
+         cond_col = "State",
+         pos_cond = "enriched",
+         topN = 3
+       )
+     }),
+     NA
+   )
+ })
Test passed 🎊
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
> 
> test_that("DO.SplitBarGSEA handles different cutoff values", {
+   set.seed(123)
+ 
+   df_GSEA <- data.frame(
+     Term = paste0("Very_Long_GO_Term_Name_That_Needs_Wrapping_", 1:20),
+     Combined.Score = runif(20, 1, 10),
+     State = rep(rep(c("enriched", "depleted"), each = 5), 2),
+     celltype = "CT1",
+     stringsAsFactors = FALSE
+   )
+ 
+   # Test with small cutoff for text wrapping
+   expect_error(
+     suppressMessages({
+       DO.SplitBarGSEA(
+         df_GSEA = df_GSEA,
+         term_col = "Term",
+         col_split = "Combined.Score",
+         cond_col = "State",
+         pos_cond = "enriched",
+         cutoff = 10,
+         topN = 3
+       )
+     }),
+     NA
+   )
+ })
Test passed 😀
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
> 
> test_that("DO.SplitBarGSEA handles showP parameter", {
+   set.seed(123)
+ 
+   df_GSEA <- data.frame(
+     Term = paste0("GO_Term_", 1:20),
+     Combined.Score = runif(20, 1, 10),
+     State = rep(rep(c("enriched", "depleted"), each = 5), 2),
+     celltype = "CT1",
+     stringsAsFactors = FALSE
+   )
+ 
+   # Test with showP = FALSE (no plot shown)
+   expect_error(
+     suppressMessages({
+       DO.SplitBarGSEA(
+         df_GSEA = df_GSEA,
+         term_col = "Term",
+         col_split = "Combined.Score",
+         cond_col = "State",
+         pos_cond = "enriched",
+         showP = FALSE,  # This won't call plt.show()
+         topN = 3
+       )
+     }),
+     NA
+   )
+ 
+ })
Test passed 😀
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
> 
> test_that("DO.SplitBarGSEA handles file saving parameters", {
+   set.seed(123)
+ 
+   df_GSEA <- data.frame(
+     Term = paste0("GO_Term_", 1:20),
+     Combined.Score = runif(20, 1, 10),
+     State = rep(rep(c("enriched", "depleted"), each = 5), 2),
+     celltype = "CT1",
+     stringsAsFactors = FALSE
+   )
+ 
+   # Create temporary directory for testing file output
+   temp_dir <- tempdir()
+ 
+   # Test with path provided - just test that it runs without error
+   # File creation might not work in test environment due to Python backend issues
+   expect_error(
+     suppressMessages({
+       DO.SplitBarGSEA(
+         df_GSEA = df_GSEA,
+         term_col = "Term",
+         col_split = "Combined.Score",
+         cond_col = "State",
+         pos_cond = "enriched",
+         path = temp_dir,
+         filename = "test_output.svg",
+         topN = 3
+       )
+     }),
+     NA
+   )
+ })
Test passed 😀
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
> 
> test_that("DO.SplitBarGSEA handles different color parameters", {
+   set.seed(123)
+ 
+   df_GSEA <- data.frame(
+     Term = paste0("GO_Term_", 1:20),
+     Combined.Score = runif(20, 1, 10),
+     State = rep(rep(c("enriched", "depleted"), each = 5), 2),
+     celltype = "CT1",
+     stringsAsFactors = FALSE
+   )
+ 
+   # Test with different color pairs
+   expect_error(
+     suppressMessages({
+       DO.SplitBarGSEA(
+         df_GSEA = df_GSEA,
+         term_col = "Term",
+         col_split = "Combined.Score",
+         cond_col = "State",
+         pos_cond = "enriched",
+         colors_pairs = c("green", "orange"),
+         alpha_colors = 0.8,
+         topN = 3
+       )
+     }),
+     NA
+   )
+ })
Test passed 😀
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
> 
> test_that("DO.SplitBarGSEA handles single celltype", {
+   set.seed(123)
+ 
+   df_GSEA <- data.frame(
+     Term = paste0("GO_Term_", 1:20),
+     Combined.Score = runif(20, 1, 10),
+     State = rep(rep(c("enriched", "depleted"), each = 5), 2),
+     celltype = "Single_CT",
+     stringsAsFactors = FALSE
+   )
+ 
+   # Test with only one celltype
+   expect_error(
+     suppressMessages({
+       DO.SplitBarGSEA(
+         df_GSEA = df_GSEA,
+         term_col = "Term",
+         col_split = "Combined.Score",
+         cond_col = "State",
+         pos_cond = "enriched",
+         topN = 3
+       )
+     }),
+     NA
+   )
+ })
Test passed 😀
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
> 
> test_that("DO.SplitBarGSEA handles empty dataframe after filtering", {
+   set.seed(123)
+ 
+   df_GSEA <- data.frame(
+     Term = paste0("GO_Term_", 1:10),
+     Combined.Score = runif(10, 1, 10),
+     State = rep(c("enriched", "depleted"), 5),
+     celltype = "CT1",
+     stringsAsFactors = FALSE
+   )
+ 
+   # Test with celltype that doesn't exist
+   expect_error(
+     suppressMessages({
+       DO.SplitBarGSEA(
+         df_GSEA = df_GSEA,
+         term_col = "Term",
+         col_split = "Combined.Score",
+         cond_col = "State",
+         pos_cond = "enriched",
+         celltype = "NonExistent_CT"
+       )
+     }),
+     NA
+   )
+ })
Test passed 🌈
> 
> test_that("DO.SplitBarGSEA returns NULL invisibly", {
+   set.seed(123)
+ 
+   df_GSEA <- data.frame(
+     Term = paste0("GO_Term_", 1:20),
+     Combined.Score = runif(20, 1, 10),
+     State = rep(rep(c("enriched", "depleted"), each = 5), 2),
+     celltype = "CT1",
+     stringsAsFactors = FALSE
+   )
+ 
+   result <- suppressMessages({
+     DO.SplitBarGSEA(
+       df_GSEA = df_GSEA,
+       term_col = "Term",
+       col_split = "Combined.Score",
+       cond_col = "State",
+       pos_cond = "enriched",
+       topN = 3
+     )
+   })
+ 
+   # The function should return NULL invisibly
+   expect_null(result)
+ })
Test passed 😀
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
> 
> test_that("DO.SplitBarGSEA handles minimal parameters with safe data", {
+   set.seed(123)
+ 
+   # Create well-balanced data for minimal parameters test
+   df_GSEA <- data.frame(
+     Term = paste0("GO_Term_", 1:40),
+     Combined.Score = runif(40, 1, 10),
+     State = rep(rep(c("enriched", "depleted"), each = 10), 2),
+     celltype = "CT1",
+     stringsAsFactors = FALSE
+   )
+ 
+   # Test with only required parameters and safe implicit topN
+   expect_error(
+     suppressMessages({
+       DO.SplitBarGSEA(
+         df_GSEA = df_GSEA,
+         term_col = "Term",
+         col_split = "Combined.Score",
+         cond_col = "State",
+         pos_cond = "enriched"
+         # Using default topN=10
+       )
+     }),
+     NA
+   )
+ })
Test passed 🎊
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
> 
> test_that("DO.SplitBarGSEA handles edge case with very small topN", {
+   set.seed(123)
+ 
+   df_GSEA <- data.frame(
+     Term = paste0("GO_Term_", 1:20),
+     Combined.Score = runif(20, 1, 10),
+     State = rep(rep(c("enriched", "depleted"), each = 5), 2),
+     celltype = "CT1",
+     stringsAsFactors = FALSE
+   )
+ 
+   # Test with topN = 1
+   expect_error(
+     suppressMessages({
+       DO.SplitBarGSEA(
+         df_GSEA = df_GSEA,
+         term_col = "Term",
+         col_split = "Combined.Score",
+         cond_col = "State",
+         pos_cond = "enriched",
+         topN = 1
+       )
+     }),
+     NA
+   )
+ })
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
Test passed 😀
> 
> test_that("DO.SplitBarGSEA handles multiple celltypes with 'all'", {
+   set.seed(123)
+ 
+   df_GSEA <- data.frame(
+     Term = paste0("GO_Term_", 1:40),
+     Combined.Score = runif(40, 1, 10),
+     State = rep(rep(c("enriched", "depleted"), each = 5), 4),
+     celltype = rep(c("CT1", "CT2", "CT3", "CT4"), each = 10),
+     stringsAsFactors = FALSE
+   )
+ 
+   # Test with celltype = "all"
+   expect_error(
+     suppressMessages({
+       DO.SplitBarGSEA(
+         df_GSEA = df_GSEA,
+         term_col = "Term",
+         col_split = "Combined.Score",
+         cond_col = "State",
+         pos_cond = "enriched",
+         celltype = "all",
+         topN = 3
+       )
+     }),
+     NA
+   )
+ })
Test passed 🎊
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
!!! Assuming GO Terms are preprocessed (Only Significant terms included)
> 
> # Test for the specific bug with vector celltype parameter
> test_that("DO.SplitBarGSEA fails gracefully with vector celltype (known bug)", {
+   set.seed(123)
+ 
+   df_GSEA <- data.frame(
+     Term = paste0("GO_Term_", 1:20),
+     Combined.Score = runif(20, 1, 10),
+     State = rep(c("enriched", "depleted"), 10),
+     celltype = rep(c("CT1", "CT2"), each = 10),
+     stringsAsFactors = FALSE
+   )
+ 
+ 
+   expect_error(
+     DO.SplitBarGSEA(
+       df_GSEA = df_GSEA,
+       term_col = "Term",
+       col_split = "Combined.Score",
+       cond_col = "State",
+       pos_cond = "enriched",
+       celltype = c("CT1", "CT2")
+     )
+   )
+ })
Test passed 😀
> 
> proc.time()
   user  system elapsed 
 15.743   1.599  17.263 

'R CMD check' output

##############################################################################
##############################################################################
###
### Running command:
###
###   /home/biocbuild/bbs-3.22-bioc/R/bin/R CMD check --test-dir=longtests --no-stop-on-test-error --no-codoc --no-examples --no-manual --ignore-vignettes --check-subdirs=no DOtools_1.0.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/home/biocbuild/bbs-3.22-bioc-longtests/meat/DOtools.Rcheck’
* using R version 4.5.1 Patched (2025-08-23 r88802)
* using platform: x86_64-pc-linux-gnu
* R was compiled by
    gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
    GNU Fortran (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
* running under: Ubuntu 24.04.3 LTS
* using session charset: UTF-8
* using options ‘--no-codoc --no-examples --no-manual --ignore-vignettes --no-stop-on-test-error’
* checking for file ‘DOtools/DESCRIPTION’ ... OK
* this is package ‘DOtools’ version ‘1.0.0’
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... INFO
Imports includes 35 non-default packages.
Importing from so many packages makes the package vulnerable to any of
them becoming unavailable.  Move as many as possible to Suggests and
use conditionally.
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... NOTE
Found the following hidden files and directories:
  .BBSoptions
These were most likely included in error. See section ‘Package
structure’ in the ‘Writing R Extensions’ manual.
* checking for portable file names ... WARNING
Found the following files with non-portable file names:
  vignettes/DOtools_files/figure-html/Clustering and UMAP-1.png
  vignettes/DOtools_files/figure-html/Clustering and UMAP-2.png
  vignettes/DOtools_files/figure-html/Manual annotation-1.png
  vignettes/DOtools_files/figure-html/Manual annotation-2.png
  vignettes/DOtools_files/figure-html/cell populations-1.png
These are not fully portable file names.
See section ‘Package structure’ in the ‘Writing R Extensions’ manual.
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘DOtools’ can be installed ... OK
* checking installed package size ... OK
* checking package 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 loading without being on the library search path ... OK
* checking whether startup messages can be suppressed ... OK
* checking dependencies in R code ... OK
* 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 ... SKIPPED
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in shell scripts ... OK
* checking files in ‘vignettes’ ... SKIPPED
* checking examples ... SKIPPED
* checking for unstated dependencies in ‘longtests’ ... OK
* checking tests in ‘longtests’ ...
  Running ‘test-DO.BarplotWilcox.R’
  Running ‘test-DO.Dotplot.R’
  Running ‘test-DO.MultiDGE.R’
  Running ‘test-DO.SplitBarGSEA.R’
  Running ‘test-DO.scVI.R’
 ERROR
Running the tests in ‘longtests/test-DO.BarplotWilcox.R’ failed.
Last 13 lines of output:
  **************************************************|
  ── Error: DO.BarplotWilcox returns ggplot and list correctly ───────────────────
  Error in `DO.BarplotWilcox(sce_object = seurat_obj, Feature = "gene1", 
      ListTest = list(c("A", "B")), returnValues = FALSE, ctrl.condition = "A", 
      group.by = "condition")`: could not find function "DO.BarplotWilcox"
  
  Error:
  ! Test failed
  Backtrace:
      ▆
   1. ├─testthat::test_that(...)
   2. │ └─withr (local) `<fn>`()
   3. └─reporter$stop_if_needed()
   4.   └─rlang::abort("Test failed", call = NULL)
  Execution halted
Running the tests in ‘longtests/test-DO.scVI.R’ failed.
Last 13 lines of output:
  Backtrace:
      ▆
   1. ├─testthat::with_mocked_bindings(...)
   2. └─mockery::stub(DO.scVI, "as.Seurat", mock_as_seurat)
   3.   └─mockery:::build_function_tree(test_env, where, where_name, depth)
  
  Error:
  ! Test failed
  Backtrace:
      ▆
   1. ├─testthat::test_that(...)
   2. │ └─withr (local) `<fn>`()
   3. └─reporter$stop_if_needed()
   4.   └─rlang::abort("Test failed", call = NULL)
  Execution halted
* DONE

Status: 1 ERROR, 1 WARNING, 1 NOTE
See
  ‘/home/biocbuild/bbs-3.22-bioc-longtests/meat/DOtools.Rcheck/00check.log’
for details.


Installation output

DOtools.Rcheck/00install.out

* installing *source* package ‘DOtools’ ...
** this is package ‘DOtools’ version ‘1.0.0’
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** 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 (DOtools)