geno_fam | R Documentation |
Constructs a random genotype matrix (for all individuals in the provided pedigree FAM table) starting from the genotype matrix of the founders as provided.
geno_fam(X, fam, missing_vals = c("", 0))
X |
The genotype matrix of the founders (loci along rows, individuals along columns).
This matrix must have column 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 random genotype matrix of the entire fam
table, starting from the genotypes of the founders.
The columns of this matrix correspond to fam$id
in that order.
The rows (loci) are the same as in the input X
.
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') ) # genotypes of the parents at 4 loci X <- cbind( c(1, 2, 0, 2), c(0, 2, 2, 1) ) # Name the parents with same codes as in `fam` # (order can be different) colnames( X ) <- c('mother', 'father') # name loci too rownames( X ) <- paste0( 'rs', 1:4 ) # Draw the full genotype matrix X_all <- geno_fam( X, fam ) # This is a 4x3 matrix with column names matching fam$id. # The parent submatrix equals the input (reordered), # but now there's random genotypes for the child too X_all
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.