plot_progeny_dosage_change: Plot progeny dosage changes after HMM-based correction with a...

View source: R/plot_progeny_dosage_change.R

plot_progeny_dosage_changeR Documentation

Plot progeny dosage changes after HMM-based correction with a global error model

Description

Computes genotype probabilities under a global genotyping error rate, derives homolog probabilities, compares the most likely HMM-implied dosages to the original dosage matrix, and plots which entries were unchanged, imputed (originally missing), or changed.

Usage

plot_progeny_dosage_change(
  map_list,
  error,
  verbose = TRUE,
  output_corrected = FALSE
)

Arguments

map_list

A non-empty list of objects of class mappoly.map.

error

Numeric scalar. Global genotyping error rate passed to calc_genoprob_error.

verbose

Logical. If TRUE (default), progress is printed by underlying routines; if FALSE, suppresses progress messages where supported.

output_corrected

Logical. If FALSE (default), the function only prints the plot and returns invisible(NULL). If TRUE, returns a matrix containing marker metadata columns followed by the corrected dosages (individuals in columns).

Details

Missing dosages in dat$geno.dose are assumed to be encoded as ploidy + 1. The function prints a heatmap-style ggplot2 tile plot and, optionally, returns a corrected dosage matrix with marker metadata.

The mappoly.data object is retrieved by name from map_list[[1]]$info$data.name. The function:

  1. Runs calc_genoprob_error() for each map in map_list.

  2. Computes homolog probabilities with calc_homologprob().

  3. For each marker and individual, selects the ploidy most likely homologs and converts them to a dosage implied by the phased map.

  4. Compares implied dosages to dat$geno.dose and summarizes the fraction of entries that were imputed (original missing) vs changed.

  5. Produces a tile plot showing unchanged/imputed/changed cells.

Value

If output_corrected = FALSE, returns invisible(NULL) and prints a ggplot. If output_corrected = TRUE, returns a matrix with columns P1, P2, sequence, sequence_position, followed by one column per individual containing corrected dosages.

Author(s)

Jeekin Lau, with optimization by Cristiane Taniguti

See Also

calc_genoprob_error, calc_homologprob

Examples

## Not run: 
x <- get_submap(solcap.err.map[[1]], 1:5, reestimate.rf = FALSE)

corrected_matrix <- plot_progeny_dosage_change(list(x), error = 0.05,
                                               output_corrected = TRUE)

## End(Not run)


mappoly documentation built on Jan. 12, 2026, 5:09 p.m.