plotDeFinetti: Plot the De Finetti Diagram for Polarized Genotypes

View source: R/plotDeFinetti.r

plotDeFinettiR Documentation

Plot the De Finetti Diagram for Polarized Genotypes

Description

This function calculates genotype frequencies from polarized genotypes, ideally imported using the importPolarized function. It plots individuals onto a ternary De Finetti diagram and includes a curve indicating Hardy-Weinberg equilibrium if specified.

Usage

plotDeFinetti(
  genotypes,
  cols,
  HWE = TRUE,
  tipLabels = c("Homozygous 0", "Heterozygous 1", "Homozygous 2"),
  ...
)

Arguments

genotypes

A character matrix comprising of _012 encodings.

cols

A character vector of colors with a length equal to the number of individuals (rows) in genotypes.

HWE

Logical indicating whether to plot the curve for Hardy-Weinberg Equilibrium.

tipLabels

A character vector of length 3 with names for the ternary plot vertices.

...

additional graphical parameters (see plot.default).

Details

To import and polarize genotypes, use the importPolarized function. Alternatively, the I4 matrix can be used as input for genotypes.

Value

No return value; the function is called for its side effects.

Examples

gen <- importPolarized(
  file = system.file("extdata", "data7x10.txt", package = "diemr"),
  changePolarity = c(TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE),
  ChosenInds = 1:7
)

plotDeFinetti(gen, cols = palette.colors(nrow(gen), "Accent"), pch = 19)

diemr documentation built on Sept. 23, 2024, 5:10 p.m.