admix_fam | R Documentation |
Calculates a full admixture proportions matrix (for all individuals in the provided pedigree FAM table) starting from the admixture proportions of the founders as provided.
admix_fam(admix, fam, missing_vals = c("", 0))
admix |
The admixture proportions matrix of the founders (individuals along rows and ancestries along columns).
This matrix must have 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 admixture proportions matrix of the entire fam
table, based on the admixture of the founders.
These are expectations, calculated for each individual as the average ancestry proportion of the parents.
The rows of this admixture matrix correspond to fam$id
in that order.
The columns (ancestries) are the same as in the input admix
.
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') ) # admixture proportions of the parents admix <- rbind( c(0.3, 0.3, 0.4), c(0.5, 0.25, 0.25) ) # Name the parents with same codes as in `fam` # (order can be different) rownames( admix ) <- c('mother', 'father') # name ancestries too colnames( admix ) <- c('African', 'European', 'Asian') # Calculate the full admixture proportions matrix admix_all <- admix_fam( admix, fam ) # This is a 3x3 matrix with row names matching fam$id. # The parent submatrix equals the input (reordered), # but now there's admixture to the child too (averages of parents) admix_all
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.