A Brief Tutorial on Landscape Genetic Analysis Using HierDpart

Xinghu Qin –School of Biology, University of St Andrews

2021-03-31

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.

##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")
#> Registered S3 method overwritten by 'spdep':
#>   method   from
#>   plot.mst ape
#> Registered S3 method overwritten by 'GGally':
#>   method from   
#>   +.gg   ggplot2
#> Registered S3 method overwritten by 'pegas':
#>   method      from
#>   print.amova ade4
# 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)
#>         pop1 pop2 pop3 pop4 pop5 pop6 pop7 pop8 pop9 pop10 pop11 pop12 pop13
#> locus1     2    3    2    3    3    2    2    5    5     4     5     3     3
#> locus2     9    9    8    7    7    7    8    4    5     5     6     7     6
#> locus3     8    9    8    7    8    8    8    8    9     9     7     6     6
#> locus4     8    8    8    7    5    6    7    8   10     9     8     5     6
#> locus5     7    7    9    6    7    5   10    6    9     6     7     7     7
#> locus6     4    6    5    6    6    3    5    4    6     6     6     5     4
#> locus7     6    5    6    6    8    7    4    6    7     4     5     4     4
#> locus8     9    8    9    9    9    8    7    8    6     9     7     5     5
#> locus9     5    6    8    6    8    6    6    6    6     7     6     5     4
#> locus10    9    8    7    7    8    6    6    6    6     8     7     7     6
#>         pop14 pop15 pop16
#> locus1      6     3     4
#> locus2      5     5     5
#> locus3      7     7     7
#> locus4      9     9    10
#> locus5      8     9     8
#> locus6      5     6     5
#> locus7      5     4     5
#> locus8      3     6     4
#> locus9      8     8     6
#> locus10     6     7     8

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.

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

The result returns a list of hierarchical metrics, the first five metrics are diversities. It explains in the below section.

Hierarchical heterozygosity (q=2)

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:

This gives you the Fst among subaggregate within in aggregate. See ?HierFst for more details.

Hierarchical Delta D

For DeltaD:

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