Skip to content

Commit

Permalink
Add a test to expect warning for k=2 registration
Browse files Browse the repository at this point in the history
  • Loading branch information
lahuuki committed Oct 1, 2024
1 parent f9882e6 commit ae8fb4a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/testthat/test-registration_wrapper.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Ensure reproducibility of example data
set.seed(20220907)

## Generate example data
sce <- scuttle::mockSCE()

## Add some sample IDs
sce$sample_id <- sample(LETTERS[1:5], ncol(sce), replace = TRUE)

## Add a sample-level covariate: age
ages <- rnorm(5, mean = 20, sd = 4)
names(ages) <- LETTERS[1:5]
sce$age <- ages[sce$sample_id]

## add variable with one group
sce$batch <- "batch1"

## Add gene-level information
rowData(sce)$ensembl <- paste0("ENSG", seq_len(nrow(sce)))
rowData(sce)$gene_name <- paste0("gene", seq_len(nrow(sce)))


test_that("warning for k=2 variable",
example_modeling_results <- expect_warning(
registration_wrapper(
sce,
var_registration ="Treatment",
var_sample_id ="sample_id",
covars = c("age"),
gene_ensembl = "ensembl",
gene_name = "gene_name",
suffix = "wrapper"
)
)
)

0 comments on commit ae8fb4a

Please sign in to comment.