Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

HIsurf

Describe the joint likelihood surface of ancestry and heterozygosity for a hybrid genotype.


Description

HIsurf calculates the log likelihood of points on a bivariate grid to describe the joint likelihood surface of ancestry and interclass heterozygosity for a genotype given parental allele frequencies.

Usage

HIsurf(G, P, type, size)

Arguments

G

An individual diploid genotype as matrix G. If type == "codominant", G must be a two-row matrix with one column for each locus, as in STRUCTURE

(http://pritch.bsd.uchicago.edu/structure.html). If type == "dominant", G is a vector of 0,1 for absence,presence of the dominant allele. If type == "allele.count", G must be a vector of genotypes coded as 0,1,2 for the number of "j" alleles. That is, genotype 2 is homozygous for allele j, genotype 1 is heterozygous, and genotype 0 has no j alleles.

P

Parental allele frequencies. A matrix or data frame with the following columns (order is important!): Locus name, Allele name, P1 allele frequency, P2 allele frequency. For type="dominant" or type="allele.count", there should be one row per locus, giving the frequencies of the dominant or "1" allele. For type="codominant" there should be a separate row for each allele AND the Allele names should match the data in G.

type

A string representing the data type. The options are "codominant", "dominant", and "allele.count".

size

An integer giving the desired number of gridlines in each direction. The function will calculate the likelihood for all (size^2)/2 combinations of S and H that fall within the triangular sample space.

Details

Given two ancestral species or parental populations (P1 and P2), the ancestry index (S) is the proportion of an individual's alleles descending from alleles in the P1 population and the interclass heterozygosity (H) is the proportion of an individual's loci that have one allele from each ancestral population (Lynch 1991). The likelihood functions are described in Fitzpatrick (2012).

Value

A size x size matrix of log likelihoods for all combinations of ancestry (S) and interclass heterozygosity (H). Rows correspond to the size values of S, and columns the size values of H. For impossible combinations (H > min(2*S,2-2*S)), NA's are returned.

Author(s)

Ben Fitzpatrick

References

Fitzpatrick, B. M. 2008. Hybrid dysfunction: Population genetic and quantitative genetic perspectives. American Naturalist 171:491-198.

Fitzpatrick, B. M. 2012. Estimating ancestry and heterozygosity of hybrids using molecular markers. BMC Evolutionary Biology 12:131. http://www.biomedcentral.com/1471-2148/12/131

Lynch, M. 1991. The genetic interpretation of inbreeding depression and outbreeding depression. Evolution 45:622-629.

See Also

HIest for maximum likelihood estimation of S and H, HIclass for likelihoods of early generation hybrid classes, HItest to compare the classification to the maximum likelihood, HILL for the basic likelihood function.

Examples

data(Bluestone)
Bluestone <- replace(Bluestone,is.na(Bluestone),-9)
# parental allele frequencies (assumed diagnostic)
BS.P <- data.frame(Locus=names(Bluestone),Allele="BTS",P1=1,P2=0)

# a small surface to view in the console
BS.surf.5 <- HIsurf(Bluestone[21,],BS.P,type="allele.count",size=5)
BS.surf.5 # the maximum likelihood is very near the center (S ~ H ~ 0.5)

# # a more finely sampled surface to visualize with image
# BS.surf <- HIsurf(Bluestone[21,],BS.P,type="allele.count",size=99)

# image(-BS.surf,col=gray(seq(from=0,to=1,length.out=6)),
	# breaks=seq(from=min(-BS.surf,na.rm=TRUE),by=2,length.out=7),
	# cex.axis=1.5,bty="n",xaxs="r",yaxs="r")
# # the breaks option is set so that each level of shading corresponds to 2 log-likelihood
# # units (for one unit increments, set by=1).
# # now make it pretty:
# image(is.na(BS.surf),col="light blue",breaks=c(.5,1),add=TRUE)
# axis(1,labels=FALSE,lwd=2); axis(2,labels=FALSE,lwd=2)
# title(xlab=expression(italic(S)),ylab=expression(italic(H[I])),cex.lab=1.5)
# lines(c(0,.5,1,0),c(0,1,0,0),lty=2,lwd=2)

HIest

Hybrid index estimation

v2.0
GPL (>= 3)
Authors
Ben Fitzpatrick
Initial release
2012-05-09

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.