View source: R/classes_methods.R
AddPloidyChiSq | R Documentation |
This function is intended to help identify the correct inheritance mode for
each locus in a "RADdata"
object. Expected genotype frequencies
are taken from object$priorProb
. Observed genotype frequencies are
estimated from object$genotypeLikelihood
, where each taxon has a
partial assignment to each genotype, proportional to genotype likelihoods.
A chi-squared statistic is then estimated.
AddPloidyChiSq(object, ...) ## S3 method for class 'RADdata' AddPloidyChiSq(object, excludeTaxa = GetBlankTaxa(object), ...)
object |
A |
excludeTaxa |
A character vector indicating names of taxa to exclude from calculations. |
... |
Additional arguments to be passed to other methods (none currently in use). |
Parents (in mapping populations) and blank taxa are automatically excluded from calculations.
Genotypes with zero prior probability would result in an infinite A chi-squared statistic and therefore are excluded from the calculation. However, the total number of observations (total number of taxa) remains the same, so that if there are many taxa with high likelihood for a genotype with zero prior probability, chi-squared will be high.
A "RADdata"
object identical to the one passed to the function,
but with a matrix added to the $ploidyChiSq
slot. This matrix has inheritance rows (matching object$priorProb
) in
rows and alleles in columns. object$ploidyChiSq
contains the
chi-squared values.
Lindsay V. Clark
AddGenotypeLikelihood
, AddPloidyLikelihood
# load dataset and set some parameters data(exampleRAD_mapping) exampleRAD_mapping <- SetDonorParent(exampleRAD_mapping, "parent1") exampleRAD_mapping <- SetRecurrentParent(exampleRAD_mapping, "parent2") exampleRAD_mapping <- AddAlleleFreqMapping(exampleRAD_mapping, expectedFreqs = c(0.25, 0.75), allowedDeviation = 0.08) exampleRAD_mapping <- AddGenotypeLikelihood(exampleRAD_mapping) exampleRAD_mapping <- AddGenotypePriorProb_Mapping2Parents(exampleRAD_mapping, n.gen.backcrossing = 1) # get chi-squared values exampleRAD_mapping <- AddPloidyChiSq(exampleRAD_mapping) # view chi-squared and p-values (diploid only) exampleRAD_mapping$ploidyChiSq
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.