This vignette demonstrates how to use the latest version of HierDpart to do landscape genetic analysis. This package is designed for population geneticists and community geneticists to solve the gap between community ecology and population genetics - how to partition diversity across metrics and spatial scales, from genetic diversity to species diversity using an integrated method. The method, known as the unifying framework, has been explained in recent paper (Gaggiotti, O. E. et al, 2018, Evol Appl, 11:1176-1193). This package was developed to implement the hierarchical decomposition analysis using not only the common genetic metrics, such as He, Fst, allelic richness, but also new genetic metrics from the unifying framework.
Here, this vignette will briefly show how to do analyses using this package.
HierDpart can read genepop files both in haploid and diploid which are quite common in genetics.
knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
#Install from CRAN #install.packages("HierDpart") ## or you can get the latest version of HierDpart from github #library(devtools) #install_github("xinghuq/HierDpart") library("HierDpart")
# example genepop file f <- system.file('extdata',package='HierDpart') infile <- file.path(f, "Island.gen")
qD is the function calculating genetic diversity profile (qD, q=0,1,2), the true diversities. If we want to calculate the allelic diversity profiles, we can do the following command line:
You can choose which diversity you want to get by defining the value of q.
If we want to plot the diversity profiles, we can do:
For geneticists studying landscape genetics, they may want to partition the metapopulation into different subpopulation, thus having several hierarchical groups. Now I am showing how to decompose genetic diversity into different hierarchical levels.
Here it is easy to define or delimit your structure (hierarchy), type ?HierAr will show you how to do that. Here, "nreg" is the number of aggregate ( or population) in your metapopulation, and "r" is the number of subaggregate (or subpopulation) in each aggregate.
HAr=HierAr(infile, nreg=4, r=c(7,4,2,3), ncode=3) print(HAr)
HiD=HierD(infile, nreg=4, r=c(7,4,2,3), ncode=3) print(HiD)
The result returns a list of hierarchical metrics, the first five metrics are diversities. It explains in the below section.
He=HierHe(infile, nreg=4, r=c(7,4,2,3), ncode=3) print(He)
Besides the hierarchical diversity, this package also calculates hierarchical genetic differentiation measured by Fst and Delta D. The Delta D here, which corresponds to q=1, measures allelic differentiation. Now we are showing how to calculate the traditional hierarchical Fst and new hierarchical Delta D.
Hier_Fst=HierFst(infile, nreg=4, r=c(7,4,2,3), ncode=3) print(Hier_Fst)
This gives you the Fst among subaggregate within in aggregate. See ?HierFst for more details.
Hier_D=HierD(infile, nreg=4, r=c(7,4,2,3), ncode=3) print(Hier_D)
Here we get alpha, beta, gamma diversity. D alpha1, D alpha2 and Dgamma correspond to number of equivalent alleles at population level, number of equivalent alleles at regional level, and total number of equivalent alleles at ecosystem. Beta.1 is the number of equivalent subaggregate (population or subpopulation depends on the hierarchy), and beta.2 is the number of equivalent aggregate (eg. regions). Differentiation.2 represents genetic differentiation between aggragates, Differentiation.1 represents genetic differentiation between subaggregates.
Untill now you may know how to implement the hierarchical diversity analysis. Furthermore, this package also includes several functions that can plot correlation between geographic distances and genetic differentiations, (see COR_Fstd, and COR_DeltaDd), as well as Delta D matrix and Delta D across loci.
'Gaggiotti, O. E., Chao, A., Peres-Neto, P., Chiu, C. H., Edwards, C., Fortin, M. J., ... & Selkoe, K. A. (2018). Diversity from genes to ecosystems: A unifying framework to study variation across biological metrics and scales. Evolutionary Applications.
'Weir, B.S. (1996) Genetic Data Analysis II. Sinauer Associates.
'Yang, R.C. (1998). Estimating hierarchical F-statistics. Evolution 52 (4):950-956
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.