Simulate a population forwards with recombination that approximates the Structured Wright Fisher Process and tracks haplotype identity by descent where individuals represent demes, such that within a deme individual-level COI is considered.
sim_swf(pos, N, m, rho, mean_coi, tlim, migr_mat = 1, verbose = FALSE)vector; the genomic coordinates for chromosome and position of the sites
integer vector; The number of individuals to consider in each deme
numeric numeric; Probability of internal migration where m represents the probability of moving from host_origin to host_new by m*(1-1/N) of each deme
numeric; expected recombination rate
numeric vector; The lambda of a right-shifted Poisson process, 1 + Pos(lambda) representing the average COI of each deme
numeric; the maximum number of generations to consider before exiting gracefully if all samples have not coalesced
numeric matrix; Migrations rates or probabilities between destination and origin. Note, because this is a Wright-Fisher model, we are drawing parents and therefore migration matrix is parameterized towards "where one came from" versus "where one is headed": origin specified as columns and destination in rows Default value of 1 indicates non-spatial model. Note, if probability matrix, rows must sum to 1 (valid marginal probability); otherwise, values will be assumed to be rates and converted to probabilities
boolean
Returns a list of length six that contains the COI of each individual. A recombination list of length of tlim where each element contains the recombination block -- as a boolean -- of the two parental haplotypes. (the number of generations it took for all lineages to coalesce). Finally, there are lists for the parental host and parental haplotype assignments for the "paternal" and "maternal" haplotypes (1 and 2), respectively.
Demes are assumed to be ordered throughout (i.e. the order needs to be consistent between N, m, mean_coi, and the rows and columns of the migration matrix).
Migration matrix is assumed to be a distance matrix that is either a rate or a probability. The program will coerce the matrix into a probability distribution between origin and destination based on the row-sums.
This function is intended to be fed into the get_arg function for interpretability.