#' Copyright(c) 2017-2024 R. Mark Sharp #' This file is part of nprcgenekeepr context("calcRetention") library(testthat) library(stringi) data("lacy1989Ped") data("lacy1989PedAlleles") ped <- lacy1989Ped alleles <- lacy1989PedAlleles retention <- calcRetention(ped, alleles) ## Prior to forcing the pedigree to have id, sire, and dam as character vectors ## inside calcFG, the two calculations above with ped (characters) and ## feFactors (factors) resulted 2.189855 and 1.857998 respectively. ## ## Used example from Analysis of Founder Representation in Pedigrees: Founder ## Equivalents and Founder Genome Equivalents. ## Zoo Biology 8:111-123, (1989) by Robert C. Lacy ## He presented 2.18 as the answer, which was truncated and not precise enough ## for this specific comparison. test_that(stri_c( "calcRetention correctly calculates mean number of alleles retained from ", "each founder"), { expect_equal(retention[["A"]], 0.7500) expect_equal(retention[["B"]], 0.7507) expect_equal(retention[["E"]], 0.7452) })