Skip to content

Commit

Permalink
Add test for masking/unmasking
Browse files Browse the repository at this point in the history
  • Loading branch information
magnusdv committed Oct 31, 2023
1 parent 3861710 commit d64a879
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/testthat/test-ped-mask.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
test_that("masking/unmasking works for lists", {
x = list(Ped1 = singleton("Mr. X"), Ped2 = nuclearPed()) |>
addMarker(name = "bcd", afreq = c(b=0.2, c = 0.3, d = 0.5), `Mr. X` = "c/c", `3` = "d/d") |>
addMarker(name = "num", alleles = c("6", "6.1", "6.2", "7"), `3` = "6.1/7") |>
setMutmod(marker = "num", model = "stepwise", rate = 0.1, rate2 = 1e-6, range = 0.1) |>
setMutmod(marker = "bcd", model = "equal", rate = 0.1)

y = maskPed(x, seed = 123)
# plot(y$maskedPed, marker = 1:2)

z = unmaskPed(y$maskedPed, keys = y$keys)
expect_identical(x,z)
})

0 comments on commit d64a879

Please sign in to comment.