View source: R/applyKinshipOverrides.R
| applyKinshipOverrides | R Documentation |
Writes pairwise kinship coefficients from outside information
into a computed kinship matrix, replacing the
pedigree-derived value for the named pairs. Each
(id1, id2, kinship) row sets both kmat[id1, id2] and its
symmetric twin kmat[id2, id1]; all other cells are unchanged.
This is a direct cell replacement – it does not propagate to descendant
rows.
applyKinshipOverrides(kmat, overrides)
kmat |
a dense, symmetric, id-named numeric kinship matrix. |
overrides |
data.frame of overrides ( |
kmat must be a dense, symmetric, id-named base R matrix (the object
kinship returns); a sparse Matrix object is out of
contract. The function is strict: it stop()s on an id absent from the
matrix and on a value above the exact positive-semi-definiteness bound
sqrt(kmat[id1, id1] * kmat[id2, id2]). Soft, run-preserving
handling of ids outside the analysis set is the caller's responsibility
– reportGV warn-drops non-member ids before calling this.
kinship() itself is never modified (it has several callers, including
two simulations that must not take current-kinship overrides).
kmat with the override cells replaced (symmetric).
ped <- nprcgenekeepr::qcPed
kmat <- kinship(ped$id, ped$sire, ped$dam, ped$gen)
overrides <- data.frame(
id1 = ped$id[1], id2 = ped$id[2], kinship = 0.25,
stringsAsFactors = FALSE
)
kmat <- applyKinshipOverrides(kmat, overrides)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.