View source: R/calculate.pairwise.Fst.R
calculate.pairwise.Fst | R Documentation |
This function calculates unbiased F_{ST} (based on Weir and Hill's θ, 2002), between a pair of populations/individuals. Loci for which either of the populations/individuals has missing data (i.e. - the sample size is zero) are excluded.
calculate.pairwise.Fst(allele.counts, sample.sizes)
allele.counts |
A matrix of allele counts of dimensions |
sample.sizes |
A matrix of sample sizes of dimensions |
Pairwise unbiased F_{ST} between a pair of populations/individuals
Gideon Bradburd
Weir,B.S. and W.G. Hill. 2002. Estimating F-statistics. Ann.Rev.Gen. 36:949-952.
#With the HGDP dataset data(HGDP.bedassle.data) #Draw 2 populations at random from the Eurasian HGDP dataset pop1 <- sample(nrow(HGDP.bedassle.data$allele.counts),1) pop2 <- sample(nrow(HGDP.bedassle.data$allele.counts),1) #Calculate unbiased Fst between them pairwise.Fst <- calculate.pairwise.Fst( HGDP.bedassle.data$allele.counts[c(pop1,pop2),], HGDP.bedassle.data$sample.sizes[c(pop1,pop2),] ) #Print that Fst to the console print(sprintf("Fst between the %s population and the %s population is %s", HGDP.bedassle.data$hgdp.metadata[pop1,1], HGDP.bedassle.data$hgdp.metadata[pop2,1], round(pairwise.Fst,3)) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.