Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcjwilliams1 committed Jan 7, 2025
1 parent 544e415 commit 189af72
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions tests/testthat/test-hscn.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ library(ggplot2)
library(dplyr)
library(data.table)

set.seed(123)
loherror <- 0.02
sim_data_bb <- simulate_data_cohort(
clone_num = c(20, 25, 25, 10),
Expand Down Expand Up @@ -88,13 +89,31 @@ test_that("Test rephasing by minimizing number of events", {
expect_true(isTRUE(all.equal(trueA$x, newA)) | isTRUE(all.equal(trueB$x, newA)))
})

set.seed(123)
loherror <- 0.02
sim_data_bb <- simulate_data_cohort(
clone_num = c(20, 25, 25, 10),
clonal_events = list(
list("1" = c(2, 0), "5" = c(3, 1)),
list("2" = c(6, 3), "3" = c(1, 0)),
list("17" = c(3, 1), "8" = c(6, 2)),
list("1" = c(2, 2), "9" = c(4, 1))
), # opposite LOH on chr 1
loherror = loherror,
coverage = 100,
rho = 0.02,
likelihood = "betabinomial",
nchr = 0
)

df <- sim_data_bb$ascn %>%
group_by(cell_id, chr) %>%
summarize(x = sum(A != B) / n()) %>%
arrange(desc(x)) %>%
group_by(chr) %>%
filter(row_number() < 5)
filter(row_number() <= 5)
chr_cell_list <- split(df$cell_id, df$chr)
print(chr_cell_list)

results_bb_2 <- callHaplotypeSpecificCN(sim_data_bb$CNbins,
sim_data_bb$haplotypes,
Expand All @@ -114,4 +133,4 @@ test_that("Test haplotype specific copy number inference using input chr-cell li
expect_gt(results_bb_2$likelihood$taronesZ, 5)
expect_equal(f[[1]], 0.125)
expect_equal(f[[2]], 0.25)
})
})

0 comments on commit 189af72

Please sign in to comment.