Skip to contents

Create a table of summary statistics per locus.

Usage

locus_table(
  x,
  index = "simpson",
  lev = "allele",
  population = "ALL",
  information = TRUE
)

Arguments

x

a adegenet::genind or genclone object.

index

Which diversity index to use. Choices are

  • "simpson" (Default) to give Simpson's index

  • "shannon" to give the Shannon-Wiener index

  • "invsimpson" to give the Inverse Simpson's index aka the Stoddard and Tayor index.

lev

At what level do you want to analyze diversity? Choices are "allele" (Default) or "genotype".

population

Select the populations to be analyzed. This is the parameter sublist passed on to the function popsub(). Defaults to "ALL".

information

When TRUE (Default), this will print out a header of information to the R console.

Value

a table with 4 columns indicating the Number of alleles/genotypes observed, Diversity index chosen, Nei's 1978 gene diversity (expected heterozygosity), and Evenness.

Note

The calculation of Hexp is \((\frac{n}{n-1}) 1 - \sum_{i = 1}^k{p^{2}_{i}}\) where p is the allele frequencies at a given locus and n is the number of observed alleles (Nei, 1978) in each locus and then returning the average. Caution should be exercised in interpreting the results of Hexp with polyploid organisms with ambiguous ploidy. The lack of allelic dosage information will cause rare alleles to be over-represented and artificially inflate the index. This is especially true with small sample sizes.

If lev = "genotype", then all statistics reflect genotypic diversity within each locus. This includes the calculation for Hexp, which turns into the unbiased Simpson's index.

References

Jari Oksanen, F. Guillaume Blanchet, Roeland Kindt, Pierre Legendre, Peter R. Minchin, R. B. O'Hara, Gavin L. Simpson, Peter Solymos, M. Henry H. Stevens, and Helene Wagner. vegan: Community Ecology Package, 2012. R package version 2.0-5.

Niklaus J. Gr\"unwald, Stephen B. Goodwin, Michael G. Milgroom, and William E. Fry. Analysis of genotypic diversity data for populations of microorganisms. Phytopathology, 93(6):738-46, 2003

J.A. Ludwig and J.F. Reynolds. Statistical Ecology. A Primer on Methods and Computing. New York USA: John Wiley and Sons, 1988.

E.C. Pielou. Ecological Diversity. Wiley, 1975.

J.A. Stoddart and J.F. Taylor. Genotypic diversity: estimation and prediction in samples. Genetics, 118(4):705-11, 1988.

Masatoshi Nei. Estimation of average heterozygosity and genetic distance from a small number of individuals. Genetics, 89(3):583-590, 1978.

Claude Elwood Shannon. A mathematical theory of communication. Bell Systems Technical Journal, 27:379-423,623-656, 1948

Author

Zhian N. Kamvar

Examples


data(nancycats)
locus_table(nancycats[pop = 5])
#> 
#> allele = Number of observed alleles
#> 
#> 1-D = Simpson index
#> 
#> Hexp = Nei's 1978 gene diversity
#> ------------------------------------------
#>        summary
#> locus   allele  1-D Hexp Evenness
#>   fca8    8.00 0.78 0.81     0.78
#>   fca23   6.00 0.66 0.69     0.65
#>   fca43   5.00 0.79 0.82     0.97
#>   fca45   5.00 0.76 0.79     0.90
#>   fca77   7.00 0.74 0.77     0.74
#>   fca78   3.00 0.38 0.39     0.63
#>   fca90   5.00 0.64 0.66     0.76
#>   fca96   5.00 0.63 0.65     0.76
#>   fca37   4.00 0.19 0.19     0.42
#>   mean    5.33 0.62 0.64     0.73
# \dontrun{
# Analyze locus statistics for the North American population of P. infestans.
# Note that due to the unknown dosage of alleles, many of these statistics
# will be artificially inflated for polyploids.
data(Pinf)
locus_table(Pinf, population = "North America")
#> 
#> allele = Number of observed alleles
#> 
#> 1-D = Simpson index
#> 
#> Hexp = Nei's 1978 gene diversity
#> ------------------------------------------
#>       summary
#> locus  allele    1-D   Hexp Evenness
#>   Pi02  9.000  0.690  0.697    0.653
#>   D13  21.000  0.895  0.906    0.684
#>   Pi33  2.000  0.021  0.021    0.353
#>   Pi04  4.000  0.545  0.551    0.764
#>   Pi4B  5.000  0.596  0.603    0.736
#>   Pi16  6.000  0.425  0.430    0.498
#>   G11  15.000  0.824  0.833    0.625
#>   Pi56  3.000  0.335  0.338    0.647
#>   Pi63  3.000  0.310  0.313    0.568
#>   Pi70  2.000  0.203  0.205    0.595
#>   Pi89 11.000  0.627  0.634    0.549
#>   mean  7.364  0.497  0.503    0.607
# }