polyRAD (version 1.3)

AddGenotypePriorProb_ByTaxa: Estimate Prior Genotype Probabilities on a Per-Taxon Basis

Description

Using local allele frequencies estimated by AddAlleleFreqByTaxa and assuming Hardy-Weinberg Equilibruim or inbreeding on a local scale, AddGenotypePriorProb_ByTaxa estimates prior genotype probabilities at each taxon, allele, and possible ploidy. These are then stored in the $priorProb slot of the "RADdata" object.

Usage

AddGenotypePriorProb_ByTaxa(object, ...)
# S3 method for RADdata
AddGenotypePriorProb_ByTaxa(object, selfing.rate = 0, …)

Arguments

object

A "RADdata" object. AddAlleleFreqByTaxa should have already been run.

selfing.rate

A number ranging from zero to one indicating the frequency of self-fertilization in the species.

Additional arguments (none implemented).

Value

A "RADdata" object identical to that passed to the function, but with a list added to the $priorProb slot. Each item in the list corresponds to one ploidy in object$possiblePloidies, and is a three-dimensional array with allele copy number in the first dimension, taxa in the second dimension, and alleles in the third dimension. The values in the array are prior genotype probabilities. Additionally, object$possiblePloidies is copied to object$priorProbPloidies, and "taxon" is recorded in the "priorType" attribute.

See Also

AddGenotypePriorProb_HWE for equations used for genotype prior probability estimation.

AddGenotypePriorProb_Mapping2Parents, AddGenotypeLikelihood

Examples

Run this code
# NOT RUN {
# load data
data(exampleRAD)
# do PCA
exampleRAD <- AddPCA(exampleRAD, nPcsInit = 3)
# get allele frequencies
exampleRAD <- AddAlleleFreqByTaxa(exampleRAD)

# add prior probabilities
exampleRAD <- AddGenotypePriorProb_ByTaxa(exampleRAD)

exampleRAD$priorProb[[1]][,1,]
exampleRAD$priorProb[[2]][,1,]
exampleRAD$priorProb[[1]][,2,]
exampleRAD$priorProb[[2]][,2,]

# try it with inbreeding
exampleRAD <- AddGenotypePriorProb_ByTaxa(exampleRAD, selfing.rate = 0.5)

exampleRAD$priorProb[[1]][,1,]
# }

Run the code above in your browser using DataLab