R: Calculates unbiased pairwise Fst between a pair of...
calculate.pairwise.Fst
R Documentation
Calculates unbiased pairwise Fst between a pair of populations
Description
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.
A matrix of allele counts of dimensions nrow = 2, one for each of the two
populations/individuals between which pairwise F_{ST} is being calculated, and
ncol = the number of loci genotyped.
sample.sizes
A matrix of sample sizes of dimensions nrow = 2, one for each of the two
populations/individuals between which pairwise F_{ST} is being calculated, and
ncol = the number of loci genotyped (i.e. - the dimensions of
sample.sizes must match those of counts). Each cell gives the number
of chromosomes successfully genotyped at each locus in each population.
Value
Pairwise unbiased F_{ST} between a pair of populations/individuals
Author(s)
Gideon Bradburd
References
Weir,B.S. and W.G. Hill. 2002. Estimating F-statistics. Ann.Rev.Gen. 36:949-952.
Examples
#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))
)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(BEDASSLE)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BEDASSLE/calculate.pairwise.Fst.Rd_%03d_medium.png", width=480, height=480)
> ### Name: calculate.pairwise.Fst
> ### Title: Calculates unbiased pairwise Fst between a pair of populations
> ### Aliases: calculate.pairwise.Fst
>
> ### ** Examples
>
> #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))
+ )
[1] "Fst between the Yi population and the Yi population is -0.053"
>
>
>
>
>
> dev.off()
null device
1
>