R/stat_genetics_utils.R
update_saved_state_barcode_plaf.RdThis function adjusts the barcode vectors stored in a saved simulation state so that the population level allele frequency (PLAF) matches a user supplied target. The adjustment is applied to each of the supported barcode containers individually (human strain barcodes, infection realisations, and male and female mosquito oocyst barcodes) as well as to the combined set of barcodes across all containers.
update_saved_state_barcode_plaf(saved_state, target_plaf, seed = NULL)A list representing the saved simulation state returned by [saveRDS()] on the final element of a `run_sim()` output.
Numeric vector giving the desired PLAF for each locus.
Optional integer to set the random number generator state before modifying barcodes. This is useful to obtain reproducible adjustments.
The input `saved_state` with barcode vectors modified in place so that their PLAF equals `target_plaf` (within numerical tolerance).