Learn R Programming

polyRAD (version 1.1)

AddAlleleFreqHWE: Estimate Allele Frequencies in a RADdata Object Assuming Hardy-Weinberg Equilibrium

Description

Allele frequencies are estimated based on the best parameters available. object$alleleFreqByTaxa is used if available. If object$alleleFreqByTaxa is null, GetWeightedMeanGenotypes is used, and if that isn't possible object$depthRatio is used. From whichever of the three options is used, column means are taken, the output of which is stored as object$alleleFreq.

Usage

AddAlleleFreqHWE(object, ...)
# S3 method for RADdata
AddAlleleFreqHWE(object, excludeTaxa = GetBlankTaxa(object), …)

Arguments

object

A "RADdata" object.

excludeTaxa

A character vector indicating taxa that should be excluded from the calculation.

Included to allow more arguments in the future, although none are currently used.

Value

A "RADdata" object identical to the one passed to the function, but with allele frequencies added to object$alleleFreq, and "HWE" as the value for the "alleleFreqType" attribute.

See Also

AddAlleleFreqMapping, AddGenotypePriorProb_HWE

Examples

Run this code
# NOT RUN {
# load in an example dataset
data(exampleRAD)
exampleRAD

# add allele frequencies
exampleRAD <- AddAlleleFreqHWE(exampleRAD)
exampleRAD$alleleFreq
# }

Run the code above in your browser using DataLab