Learn R Programming

segtest

Provides a suite of tests for segregation distortion for F1 populations of polyploids under various models of meiosis. You can use these tests for autopolyploids that exhibit full polysomic inheritance, allopolyploids that exhibit full disomic inheritance, or segmental allopolyploids that exhibit partial preferential pairing. Double reduction is (optionally) fully accounted for in tetraploids, and (optionally) partially accounted for (only at simplex loci) for higher ploidies. Some maximum proportion of outliers can be specified, and so these methods can accommodate moderate levels of double reduction at non-simplex loci. Offspring genotypes can either be known, or genotype uncertainty can be represented through genotype likelihoods. Parent data may or may not be provided, at your option. Parents can have different (even) ploidies, at your option.

This package only contains likelihood ratio and chi-squared tests. See the menbayes package for Bayesian tests for tetraploids.

The main functions are:

  • seg_multi(): Run the likelihood ratio test for segregation distortion in parallel at many loci.
  • multidog_to_g: Format the genotyping output from updog::multidog() to be compatible with the input of seg_multi().
  • seg_lrt(): Test for segregation distortion for any even ploidy.
  • gamfreq(): Gamete frequencies.
  • gf_freq(): Genotype frequencies of an F1 population of polyploids.
  • drbounds(): Upper bounds on the double reduction rate(s) based on two different extreme models of meiosis.
  • simgl(): Simulate genotype log-likelihoods given a vector of genotype counts.

Older functions that are only applicable to tetraploids are:

  • multi_lrt(): Run any of the tetraploid likelihood ratio tests for segregation distortion in parallel across many SNPs.
  • lrt_men_g4(): Tetraploid likelihood ratio test for segregation distortion using known genotypes.
  • lrt_men_gl4(): Tetraploid likelihood ratio test for segregation distortion using genotype likelihoods.
  • offspring_gf_2(): Tetraploid offspring genotype frequencies under the two parameter model of meiosis.
  • offspring_gf_3(): Tetraploid offspring genotype frequencies under the three parameter model of meiosis.
  • simf1g(): Simulate genotypes from an F1 population of tetraploids.
  • simf1gl(): Simulate genotype likelihoods from an F1 population of tetraploids.

We also provide some functions from “competing” methods:

  • polymapr_test(): Test from polymapR.
  • chisq_g4(): Chi-squared test (not accounting for double reduction and preferential pairing) when genotypes are known.
  • chisq_gl4(): Chi-squared test (not accounting for double reduction and preferential pairing) using genotype likelihoods.

Details of these methods may be found in Gerard et al. (2025a) and Gerard et al. (2025b).

Installation

You can install the stable version of segtest from CRAN with:

install.packages("segtest")

You can install the development version of segtest from GitHub with:

# install.packages("pak")
pak::pak("github::dcgerard/segtest")

Code of Conduct

Please note that the segtest project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

References

Gerard D, Thakkar M, & Ferrão LFV (2025a). “Tests for segregation distortion in tetraploid F1 populations.” Theoretical and Applied Genetics, 138(30), p. 1–13. doi:10.1007/s00122-025-04816-z.

Gerard, D, Ambrosano, GB, Pereira, GdS, & Garcia, AAF (2025b). “Tests for segregation distortion in higher ploidy F1 populations.” bioRxiv, p. 1–20. bioRxiv:2025.06.23.661114

Acknowledgments

Part of this material is based upon work supported by the National Science Foundation under Grant No. 2132247.

Copy Link

Version

Install

install.packages('segtest')

Monthly Downloads

137

Version

2.0.0

License

GPL (>= 3)

Maintainer

David Gerard

Last Published

June 30th, 2025

Functions in segtest (2.0.0)

po_gl

Generate genotype likelihoods from offspring genotypes.
llike_li

Objective function for em_li()
simf1gl

Simulate genotype likelihoods of F1 individuals.
simf1g

Simulate genotype counts from F1 individuals
seg_lrt

Test for segregation distortion in a polyploid F1 population.
polymapr_test

Run segregation distortion tests as implemented in the polymapR package.
offspring_gf_2

Calculates offspring genotype frequencies under the two-parameter model.
offspring_geno

Simulates genotypes given genotype frequencies.
seg

Disomic and polysomic segregation patterns
nextElem.arrayiter

Next element in an array
pvec_tet_3

Tetraploid gamete frequencies of gametes when one parent's genotype is known
n_pp_mix

Number of mixture components
ufit

Genotype data from Cappai et al. (2020)
pvec_tet_2

Tetraploid gamete frequencies of gametes when one parent's genotype is known
seg_multi

Parallelized likelihood ratio test for segregation distortion for arbitrary (even) ploidies.
segtest-package

segtest: Tests for Segregation Distortion in Polyploids
three_to_two

Convert from three parameters to two parameters
simgl

Simulate genotype (log) likelihoods from genotype counts
offspring_gf_3

Calculates offspring genotype frequencies under the three-parameter model.
otest_g

Jointly tests for segregation distortion and number of incompatible genotypes
gamfreq

Gamete frequencies under a generalized model
beta_bounds

Bounds on the distortion at simplex loci caused by double reduction.
em_li

EM algorithm from Li (2011)
gvec_to_gcount

Inverse function of gcount_to_gvec().
is_valid_2

Tests if the two parameter model is valid
chisq_gl

Chi-Sq for GL
drbounds

Upper bounds on double reduction rates.
gcount_to_gvec

Converts genotype counts to genotype vectors.
gf_freq

Genotype frequencies of an F1 population under a generalized model.
chisq_g

Chi Square test when genotypes are known
like_gknown_3

Likelihood under three parameter model when genotypes are known
multi_lrt

Parallelized likelihood ratio test for segregation distortion.
lrt_men_g4

Likelihood ratio test for segregation distortion with known genotypes
multidog_to_g

Converts multidog output to a format usable for seg_multi() and multi_lrt()
like_gknown_2

Likelihood under three parameter model when genotypes are known
iter.array

Iterator over array
like_glpknown_3

Likelihood under three parameter model when using offspring genotypes likelihoods but parent genotypes are known.
like_glpknown_2

Likelihood under three parameter model when using offspring genotypes likelihoods but parent genotypes are known.
lrt_men_gl4

Likelihood ratio test using genotype likelihoods.