plot_compare_haplotypes: Plot Two Overlapped Haplotypes

View source: R/utils.R

plot_compare_haplotypesR Documentation

Plot Two Overlapped Haplotypes

Description

This function plots two sets of haplotypes for comparison, allowing for visual inspection of homologous allele patterns across two groups or conditions. It is designed to handle and display genetic data for organisms with varying ploidy levels.

Usage

plot_compare_haplotypes(
  ploidy,
  hom.allele.p1,
  hom.allele.q1,
  hom.allele.p2 = NULL,
  hom.allele.q2 = NULL
)

Arguments

ploidy

Integer, specifying the ploidy level of the organism being represented.

hom.allele.p1

A list where each element represents the alleles for a marker in the first haplotype group, for 'p' parent.

hom.allele.q1

A list where each element represents the alleles for a marker in the first haplotype group, for 'q' parent.

hom.allele.p2

Optionally, a list where each element represents the alleles for a marker in the second haplotype group, for 'p' parent.

hom.allele.q2

Optionally, a list where each element represents the alleles for a marker in the second haplotype group, for 'q' parent.

Details

The function creates a graphical representation of haplotypes, where each marker's alleles are plotted along a line for each parent ('p' and 'q'). If provided, the second set of haplotypes (for comparison) are overlaid on the same plot. This allows for direct visual comparison of allele presence or absence across the two sets. Different colors are used to distinguish between the first and second sets of haplotypes.

The function uses several internal helper functions ('ph_list_to_matrix' and 'ph_matrix_to_list') to manipulate haplotype data. These functions should correctly handle the conversion between list and matrix representations of haplotype data.

Value

Invisible. The function primarily generates a plot for visual analysis and does not return any data.


mmollina/MAPpoly documentation built on March 9, 2024, 2:52 a.m.