Skip to contents

plot_reconstructed_haplo visualizes the genotype data before and after HMM-based haplotype reconstruction for a specified set of individuals. It uses MapRtools::plot_geno() for visualization and appends informative titles based on the chromosome name.

Usage

plot_reconstructed_haplo(original, processed, individuals = 1:50)

Arguments

original

A genotype matrix before haplotype reconstruction. Rows represent markers, and columns represent individuals.

processed

A genotype matrix after HMM-based haplotype reconstruction. It must have the same dimensions as original.

individuals

A numeric vector specifying the indices of individuals (columns) to plot. Default is 1:50. All values must be within the column range of the input matrices.

Value

A list with two ggplot objects:

p1

Genotype plot before HMM, titled with the chromosome name and "Before HMM".

p2

Genotype plot after HMM, titled with the chromosome name and "After HMM".

Details

The function uses extract_map() from geneticMapR to infer the chromosome name from the original genotype matrix, which is then used to annotate the plots. Both matrices are expected to be compatible with MapRtools::plot_geno().

Examples

if (FALSE) { # \dontrun{
original_geno <- example_original
processed_geno <- example_processed
plots <- plot_reconstructed_haplo(original = original_geno,
                                  processed = processed_geno,
                                  individuals = 1:30)
plots$p1  # View plot before HMM
plots$p2  # View plot after HMM
} # }