| prune_fam | R Documentation |
This function accepts an input pedigree and a list of individuals of interest, and returns the subset of the pedigree including only the individuals of interest and their direct ancestors. This is useful in simulations, to avoid modeling/drawing genotypes of individuals without descendants in the last generation.
prune_fam(fam, ids, missing_vals = c("", 0))
fam |
The pedigree data.frame, in plink FAM format.
Only columns |
ids |
The list of individuals of interest, whose ancestors we want to keep.
All must be present in |
missing_vals |
The list of ID values treated as missing.
|
The filtered FAM table with non-ancestors of ids excluded.
IDs that are NA-equivalent (see missing_vals) will be mapped to NA.
# construct a family with three founders, but one "bob" has no descendants
library(tibble)
fam <- tibble(
id = c('mom', 'dad', 'bob', 'child'),
pat = c( NA, NA, NA, 'dad'),
mat = c( NA, NA, NA, 'mom')
)
# only want 'child' and its ancestors
ids <- 'child'
fam2 <- prune_fam( fam, ids )
# the filtered pedigree has "bob" removed:
fam2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.