Run segregation distortion tests as implemented in the polymapR package.
Source:R/polymapr.R
polymapr_test.RdThe polymapR package tests for segregation distortion by iterating through all
possible forms of disomic or polysomic inheritance from either parent,
tests for concordance of the offspring genotypes using a chi-squared
test, and returns the largest p-value. It sometimes chooses a different
p-value based on other heuristics. They also sometimes return NA.
When type = "segtest", we only look at patterns of the
given parent genotypes, choosing the largest p-value. When
type = "polymapR", we return what they use via their heuristics.
Usage
polymapr_test(x, g1 = NULL, g2 = NULL, type = c("segtest", "polymapR"))Arguments
- x
Either a vector of genotype counts, or a matrix of genotype posteriors where the rows index the individuals and the columns index the genotypes.
- g1
Parent 1's genotype.
- g2
Parent 2's genotype.
- type
Either my implementation which approximates that of polymapR (
"segtest") or the implementation through polymapR ("polymapR"). Note that polymapR needs to be installed fortype = "polymapR".
Value
A list with the following elements:
- p_value
The p-value of the test.
- bestfit
The genotype frequencies of the best fit model.
- frq_invalid
The frequency of invalid genotypes.
- p_invalid
The p-value of the invalid proportion.
See also
checkF1().
Examples
g1 <- 0
g2 <- 1
x <- c(4, 16, 0, 0, 0)
polymapr_test(x = x, g1 = g1, g2 = g2, type = "segtest")
#> $p_value
#> [1] 0.007290358
#>
#> $best_fit
#> [1] 5.000000e-01 5.000000e-01 4.482695e-17 4.399089e-17 4.440892e-17
#>
#> $frq_invalid
#> [1] 0
#>
#> $p_invalid
#> [1] 1
#>
polymapr_test(x = x, g1 = g1, g2 = g2, type = "polymapR")
#> $p_value
#> [1] 0.0073
#>
#> $bestfit
#> [1] 0.5 0.5 0.0 0.0 0.0
#>
#> $frq_invalid
#> [1] 0
#>
#> $p_invalid
#> [1] 1
#>