GetWeightedMeanGenotypes: Export Numeric Genotype Values Weighted by Posterior...

Description Usage Arguments Details Value Author(s) Examples

View source: R/classes_methods.R

Description

This function calculates numerical genotype values, weighted by posterior genotype probabilities. If the "RADdata" object includes more than one possible inheritance mode, the $ploidyChiSq slot is used for selecting or weighting inheritance modes for each allele. A matrix is returned with numerical genotype values for each taxon and allele.

Usage

1
2
3
4
5
6
7
GetWeightedMeanGenotypes(object, ...)
## S3 method for class 'RADdata'
GetWeightedMeanGenotypes(object, minval = 0, maxval = 1, 
                         omit1allelePerLocus = TRUE, 
                         omitCommonAllele = TRUE,
                         naIfZeroReads = FALSE, 
                         onePloidyPerAllele = FALSE, ...)

Arguments

object

A "RADdata" object. Posterior genotype probabilities should have been added with AddGenotypePosteriorProb, and if there is more than one possible ploidy, ploidy chi-squared values should have been added with AddPloidyChiSq.

...

Additional arguments, listed below, to be passed to the method for "RADdata".

minval

The number that should be used for indicating that a taxon has zero copies of an allele.

maxval

The number that should be used for indicating that a taxon has the maximum copies of an allele (equal to the ploidy of the locus).

omit1allelePerLocus

A logical indicating whether one allele per locus should be omitted from the output, in order to reduce the number of variables and prevent singularities for genome-wide association and genomic prediction. The value for one allele can be predicted from the values from all other alleles at its locus.

omitCommonAllele

A logical, passed to the commonAllele argument of OneAllelePerMarker, indicating whether the most common allele for each locus should be omitted (as opposed to simply the first allele for each locus). Ignored if omit1allelePerLocus = FALSE.

naIfZeroReads

A logical indicating whether NA should be inserted into the output matrix for any taxa and loci where the total read depth for the locus is zero. If FALSE, the output for these genotypes is essentially the weighted mean across prior genotype probabilities, since prior and posterior genotype probabilities are equal when there are no reads.

onePloidyPerAllele

Logical. If TRUE, for each allele the inheritance mode with the lowest chi-squared value is selected and is assumed to be the true inheritance mode. If FALSE, inheritance modes are weighted by inverse chi-squared values for each allele, and mean genotypes that have been weighted across inheritance modes are returned.

Details

For each inheritance mode m, taxon t, allele a, allele copy number i, total ploidy k, and posterior genotype probability p_{i,t,a,m}, weighted mean genotype g_{t,a,m} is estimated as:

g_{t,a,m} = ∑_{i = 0}^k p_{i,t,a,m} * i/k

When there are multiple inheritance modes and onePloidyPerAllele = FALSE, the weighted genotype is estimated as:

∑_m [ g_{t,a,m} * 1/χ^2_{m,a} / ∑_m 1/χ^2_{m,a}]

When there are multiple inheritance modes and onePloidyPerAllele = TRUE, the genotype is simply the one corresponding to the inheritance mode with the minimum chi-squared value:

g_{t,a} = g_{t,a,m} | \min_m{χ^2_{m,a}}

Value

A named matrix, with taxa in rows and alleles in columns, and values ranging from minval to maxval. These values can be treated as continuous genotypes.

Author(s)

Lindsay V. Clark

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17

lvclark/polyRAD documentation built on Feb. 20, 2018, 1:15 p.m.