A Brief Tutorial on Landscape Genetic Analysis Using HierDpart "

Instruction

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.

Practical analyses

HierDpart can read genepop files both in haploid and diploid which are quite common in genetics.

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Install HierDpart

#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")

Function to calculate genetic diversity profiles (q=0,1,2)

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:

qD(infile,q=0,ncode=3)

You can choose which diversity you want to get by defining the value of q.

Plot diversity profiles

If we want to plot the diversity profiles, we can do:

qDplot(infile,q="all",ncode=3)

Hierarchical diversity and differentiation decomposition

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.

Hierarchical allelic richness (q=0)

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)

Hierarchical allelic diversity (^1D,q=1)

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.

Hierarchical heterozygosity (q=2)

He=HierHe(infile, nreg=4, r=c(7,4,2,3), ncode=3)
print(He)

Hierarchical Fst (allelic fixation)

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.

For Fst:

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.

Hierarchical Delta D

For DeltaD:

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.

References

'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



Try the HierDpart package in your browser

Any scripts or data that you put into this service are public.

HierDpart documentation built on March 31, 2021, 5:09 p.m.