phipt: Distances between communities, auxiliary functions

View source: R/reg2cluster2dist.R

phiptR Documentation

Distances between communities, auxiliary functions

Description

Auxiliary functions for communitydist. phipt computes phiPT/phiST (Peakall and Smouse, 2012, Meirmans, 2006) between two communities. cfchord computes the chord-distance (Cavalli-Sforza and Edwards, 1967) between two lists or locus-wise relative allele frequencies. shared.problist computes a straightforward generalisation of the shared allele distance (Bowcock et al., 1994) between individuals for communities, namely the ‘overlap’, i.e., sum of the minima of the allele relative frequencies. diploidcomlist constructs the input lists for cfchord and shared.problist from an alleleobject. It provides relative frequencies for all alles of all loci in all communities.

Usage


phipt(alleleobj,comvector,i,j)
cfchord(p1,p2)
shared.problist(p1,p2)
diploidcomlist(alleleobj,comvector,diploid=TRUE)

Arguments

alleleobj

if diploid=TRUE, an object of class alleleobject as produced by function alleleinit. This has the required information on the individuals that are grouped into communities. In case diploid=FALSE, a list that needs to have components n.variables (number of loci), alevels (vector of allele names, see alleleinit) and charmatrix (matrix of characters with one row for every individual and one column for every locus giving the alleles; see examples below for how this can be constructed for a prabobject with presence-absence data).

comvector

vector of integers indicating to which community an individual belongs.

i

integer. Number of community.

j

integer. Number of community. The phiPT-distance is computed between the communities numbered i and j

p1

list. Every list entry refers to a locus and is a vector of relative frequencies of the alleles present in that locus in a community.

p2

list. Every list entry refers to a locus and is a vector of relative frequencies of the alleles present in that locus in a community. The chord or shared allele distance is computed between the communities encoded by p1 and p2.

diploid

logical, indicating whether loci are diploid, see alleleobj.

Value

cfchord gives out the value of the chord distance. shared.problist gives out the distance value. diploidcomlist gives out a two-dimensional list. The list has one entry for each community, which is itself a list. This community list has one entry for each locus, which is a vector that gives the relative frequencies of the different alleles in phipt gives out a list with components phipt, vap, n0, sst, ssg, msa, msw. These refer to the notation on p.2.12 and 2.15 of Peakall and Smouse (2012).

phipt

value of phiPT.

vap

variance among (between) populations (communities).

n0

standardisation factor N0, see p.2.12 of Peakall and Smouse (2012).

sst

total distances sum of squares.

ssg

vector with two non-NA entriesm, within community sums of squares for communities i and j.

msa

mean square between communities.

msw

mean square within communities.

Author(s)

Christian Hennig christian.hennig@unibo.it https://www.unibo.it/sitoweb/christian.hennig/en

References

Bowcock, A. M., Ruiz-Linares, A., Tomfohrde, J., Minch, E., Kidd, J. R., Cavalli-Sforza, L. L. (1994) High resolution of human evolutionary trees with polymorphic microsatellites. Nature 368, 455-457.

Cavalli-Sforza, L. L. and Edwards, A. W. F. (1967) Phylogenetic Analysis - Models and Estimation Procedures. The American Journal of Human Genetics 19, 233-257.

Meirmans, P. G. (2006) Using the AMOVA framework to estimate a standardized genetic differentiation measure. Evolution 60, 2399-2402.

Peakall, R. and Smouse P.E. (2012) GenAlEx Tutorial 2. https://biology-assets.anu.edu.au/GenAlEx/Tutorials.html

See Also

communitydist

Examples

  options(digits=4)
  data(tetragonula)
  tnb <-
  coord2dist(coordmatrix=tetragonula.coord[83:120,],cut=50,file.format="decimal2",neighbors=TRUE)
  ta <- alleleconvert(strmatrix=tetragonula[83:120,])
  tai <- alleleinit(allelematrix=ta,neighborhood=tnb$nblist)
  tetracoms <-
  c(rep(1:3,each=3),4,5,rep(6:11,each=2),12,rep(13:19,each=2))
  phipt(tai,tetracoms,4,6)
  tdip <- diploidcomlist(tai,tetracoms,diploid=TRUE)
  cfchord(tdip[[4]],tdip[[6]])
  shared.problist(tdip[[4]],tdip[[6]])
  

prabclus documentation built on Sept. 24, 2024, 5:07 p.m.