Skip to content

Commit

Permalink
fix test for real - check for grouped scale factors
Browse files Browse the repository at this point in the history
  • Loading branch information
Qile0317 committed Oct 30, 2024
1 parent e824414 commit 73aee34
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/testthat/test-clonalCompare.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,26 @@ test_that("clonalCompare works with exportTable and prop FALSE", {
propCompareRes %>% dplyr::select(-Proportion)
)

fullJoined <- getClonalCompareRes(FALSE) %>%
dplyr::full_join(
getClonalCompareRes(TRUE)
)
fullJoined <- suppressMessages(getClonalCompareRes(FALSE) %>%
dplyr::full_join(getClonalCompareRes(TRUE))
)

expect_setequal(
colnames(fullJoined),
c("clones", "Count", "original.clones", "Proportion", "Sample")
)

expect_identical(
fullJoined %>%
dplyr::mutate(propToCountScaleFactor = Count / Proportion) %>%
dplyr::group_by(Sample) %>%
dplyr::summarise(
areAllFactorsEqual = var(propToCountScaleFactor) < 1e-10
) %>%
dplyr::pull(areAllFactorsEqual),
rep(TRUE, length(unique(fullJoined$Sample)))
)

countPropFactor <- fullJoined$Count / fullJoined$Proportion

expect_identical(
Expand Down

0 comments on commit 73aee34

Please sign in to comment.