This function simply returns the weighted mean inbreeding coefficient f_j^T.
If no weights are provided, the regular mean f_j^T is returned.
If a kinship matrix Φ^T is provided, then f_j^T are extracted from its diagonal using
inbr (assumes the diagonal of Φ^T is φ_jj^T = (1+f_j^T)/2 as
popkin returns, and not f_j^T as
The vector of inbreeding coefficients (f_j^T), or the kinship matrix Φ^T if
Weights for individuals (optional, defaults to uniform weights)
The returned weighted mean inbreeding coefficient equals the generalized FST if all individuals are "locally outbred" (i.e. if the self relatedness of every individual stems entirely from the population structure rather than due partly to having unusually closely related parents, such as first or second cousins). Note most individuals in population-scale human data are locally outbred. If there are locally inbred individuals, the returned value will overestimate FST.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
## Get FST from a genotype matrix ## Construct toy data X <- matrix(c(0,1,2,1,0,1,1,0,2), nrow=3, byrow=TRUE) # genotype matrix subpops <- c(1,1,2) # subpopulation assignments for individuals ## NOTE: for BED-formatted input, use BEDMatrix! ## "file" is path to BED file (excluding .bed extension) # library(BEDMatrix) # X <- BEDMatrix(file) # load genotype matrix object ## estimate the kinship matrix "Phi" from the genotypes "X"! Phi <- popkin(X, subpops) # calculate kinship from X and optional subpop labels w <- weightsSubpops(subpops) # can weigh individuals so subpopulations are balanced Fst <- fst(Phi, w) # use kinship matrix and weights to calculate fst Fst <- fst(Phi) # no weights implies uniform weights inbr <- inbr(Phi) # if you extracted inbr for some other analysis... Fst <- fst(inbr, w) # ...use this inbreeding vector as input too!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.