Skip to content

R scripts to explore diversity and differentiation statistics with respects to their mathematical bounds

License

GPL-3.0, GPL-3.0 licenses found

Licenses found

GPL-3.0
LICENSE
GPL-3.0
LICENSE.md
Notifications You must be signed in to change notification settings

nalcala/PopGenBounds

Repository files navigation

PopGenBounds

The PopGenBounds R package provides functions and visualization to explore diversity and differentiation statistics (FST, Hedrick's G'ST, and Jost's D) with respects to their mathematical bounds as functions of the frequency of the most frequent allele.

Installation

You can install this package from GitHub with the following R code:

# install.packages("devtools")
devtools::install_github("nalcala/PopGenBounds")

Usage

We load the package

library(PopGenBounds)

Let's first create an allele frequency matrix with subpopulations as rows and alleles as columns:

popa = matrix(c(0.4,0.4,0.2,rep(0,3*5),
                rep(0,3),0.4,0.4,0.2,rep(0,3*4),
                rep(0,3*2),0.4,0.4,0.2,rep(0,3*3),
                rep(0,3*3),0.4,0.4,0.2,rep(0,3*2),
                rep(0,3*4),0.4,0.4,0.2,rep(0,3),
                rep(0,3*5),0.4,0.4,0.2),ncol=18,byrow = T)

The Diff function computes the differentiation statistics along with their bounds given the most frequent allele M

Diff(popa)

We can plot the allele frequency table with function ggfreqtable:

ggfreqtable(popa)

And plot the value within the bounds of FST, G'ST, and D with function ggbounds:

ggbounds(M=Diff(popa)$value[1],FST=Diff(popa)$value[2],GpST = Diff(popa)$value[3],D=Diff(popa)$value[4],K=nrow(popa))

Citations

Alcala, N., Lim, Y., & Rosenberg, N. A. (In prep)

Alcala, N., & Rosenberg, N. A. (2022). Mathematical constraints on F ST: multiallelic markers in arbitrarily many populations. Philosophical Transactions of the Royal Society B, 377(1852), 20200414.

Alcala, N., & Rosenberg, N. A. (2019). G'ST, Jost's D, and FST are similarly constrained by allele frequencies: A mathematical, simulation, and empirical study. Molecular ecology, 28(7), 1624-1636.

Alcala, N., & Rosenberg, N. A. (2017). Mathematical constraints on F ST: biallelic markers in arbitrarily many populations. Genetics, 206(3), 1581-1600.

About

R scripts to explore diversity and differentiation statistics with respects to their mathematical bounds

Resources

License

GPL-3.0, GPL-3.0 licenses found

Licenses found

GPL-3.0
LICENSE
GPL-3.0
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages