From d64a879c4a30d01003617e68b4c8d55e2413c37e Mon Sep 17 00:00:00 2001 From: Magnus Dehli Vigeland Date: Tue, 31 Oct 2023 09:04:45 +0100 Subject: [PATCH] Add test for masking/unmasking --- tests/testthat/test-ped-mask.R | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/testthat/test-ped-mask.R diff --git a/tests/testthat/test-ped-mask.R b/tests/testthat/test-ped-mask.R new file mode 100644 index 0000000..a641e5a --- /dev/null +++ b/tests/testthat/test-ped-mask.R @@ -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) +})