kinship_fam | R Documentation |
Calculates a full kinship matrix (between all individuals in the provided pedigree FAM table) taking into account the relatedness of the founders as provided.
Output agrees with kinship2::kinship()
but only when founders are unrelated/outbred (in other words, that function does not allow relatedness between founders).
kinship_fam(kinship, fam, missing_vals = c("", 0))
kinship |
The kinship matrix of the founders.
This matrix must have column and row names that identify each founder (matching codes in |
fam |
The pedigree data.frame, in plink FAM format.
Only columns |
missing_vals |
The list of ID values treated as missing.
|
The kinship matrix of the entire fam
table, taking the relatedness of the founders into account.
The rows and columns of this kinship matrix correspond to fam$id
in that order.
Plink FAM format reference: https://www.cog-genomics.org/plink/1.9/formats#fam
# The smallest pedigree, two parents and a child. # A minimal fam table with the three required columns. # Note "mother" and "father" have missing parent IDs, while "child" does not library(tibble) fam <- tibble( id = c('father', 'mother', 'child'), pat = c(NA, NA, 'father'), mat = c(NA, NA, 'mother') ) # Kinship of the parents, here two unrelated/outbred individuals: kinship <- diag(2)/2 # Name the parents with same codes as in `fam` # (order can be different) colnames( kinship ) <- c('mother', 'father') rownames( kinship ) <- c('mother', 'father') # For a clearer example, make the father slightly inbred # (a self-kinship value that exceeds 1/2): kinship[2,2] <- 0.6 # Calculate the full kinship matrix kinship_all <- kinship_fam( kinship, fam ) # This is a 3x3 matrix with row/col names matching fam$id. # The parent submatrix equals the input (reordered), # but now there's relatedness to the child too kinship_all
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.