R/RcppExports.R
pedigrees_all_populate_haplotypes_ladder_bounded.Rd
Populate haplotypes from founder and down in all pedigrees.
Note, that haplotypes are bounded by ladder_min
and ladder_max
.
All founders get a haplotype from calling the user
provided function get_founder_haplotype()
.
pedigrees_all_populate_haplotypes_ladder_bounded(
pedigrees,
mutation_rates,
ladder_min,
ladder_max,
get_founder_haplotype = NULL,
prob_two_step = 0,
prob_genealogical_error = 0,
progress = TRUE
)
Pedigree list in which to populate haplotypes
Vector with mutation rates
Lower bounds for haplotypes, same length as mutation_rates
Upper bounds for haplotypes, same length as mutation_rates
; all entries must be strictly greater than ladder_min
Function taking no arguments returning a haplotype of length(mutation_rates)
Given a mutation happens, this is the probability that the mutation is a two-step mutation; refer to details for information about behaviour around ladder boundaries
Probability that a genealogical error happens: if so, give individual haplotype get_founder_haplotype()
instead of father's
Show progress
Given that a two step mutation should happen (probability specified by prob_two_step
):
With distances >= 2 to ladder bounds, mutations happen as usual.
At distance = 0 or 1 to a ladder bound, the mutation is forced to move away from the boundary.
Note, that pedigrees must first have been inferred by build_pedigrees()
.
sim <- sample_geneology(100, 10)
peds <- build_pedigrees(sim$population)
pedigrees_all_populate_haplotypes_ladder_bounded(
peds, c(1, 1), c(0L, 0L), c(10L, 10L),
function(x) c(10, 10))
get_haplotype(sim$end_generation_individuals[[1]])
#> [1] 9 7