recomb_last_gen {simfam} | R Documentation |
Draw recombination breaks for autosomes for last generation of a pedigree
Description
A wrapper around the more general recomb_fam()
, specialized to save memory when only the last generation is desired (recomb_fam()
returns recombination blocks for the entire pedigree).
This function assumes that generations are non-overlapping (met by the output of sim_pedigree()
), in which case each generation g
can be drawn from generation g-1
data only.
That way, only two consecutive generations need be in memory at any given time.
The partitioning of individuals into generations is given by the ids
parameter (again matches the output of sim_pedigree()
).
Usage
recomb_last_gen(founders, fam, ids, missing_vals = c("", 0))
Arguments
founders |
The named list of founders with their chromosomes.
For unstructured founders, initialize with |
fam |
The pedigree data.frame, in plink FAM format.
Only columns |
ids |
A list containing vectors of IDs for each generation.
All these IDs must be present in |
missing_vals |
The list of ID values treated as missing.
|
Value
The list of individuals with recombined chromosomes of the last generation (the intersection of ids[ length(ids) ]
and fam$id
), in the same format as founders
above.
The names of this list are last-generation individuals in the order that they appear in fam$id
.
See Also
Plink FAM format reference: https://www.cog-genomics.org/plink/1.9/formats#fam
Examples
# A small pedigree, two parents and two children.
# A minimal fam table with the three required columns.
# Note "mother" and "father" have missing parent IDs, while children do not
library(tibble)
fam <- tibble(
id = c('father', 'mother', 'child', 'sib'),
pat = c(NA, NA, 'father', 'father'),
mat = c(NA, NA, 'mother', 'mother')
)
# need an `ids` list separating the generations
ids <- list( c('father', 'mother'), c('child', 'sib') )
# initialize parents with this other function
# simulate three chromosomes with these lengths in cM
lengs <- c(50, 100, 150)
founders <- recomb_init_founders( ids[[1]], lengs )
# draw recombination breaks for the children
inds <- recomb_last_gen( founders, fam, ids )