PolyGenius
Contents

visualize$data$similarity$samples

visualize pre-computed similarity matrices

Draws one stored pairwise matrix as a clustered heatmap, using ComplexHeatmap and circlize. visualize$data$similarity$samples() reads data$sample.pairs; visualize$data$similarity$models() reads data$model.pairs.

Usage

visualize$data$similarity$samples(data, key, type = "heatmap", cluster = TRUE, label.by = NULL, palette = NULL, n.breaks = 11L, symmetrize.range = FALSE, center.zero = FALSE, drop.na = TRUE, ...)

visualize$data$similarity$models(data, key, type = "heatmap", cluster = TRUE, label.by = NULL, palette = NULL, n.breaks = 11L, symmetrize.range = FALSE, center.zero = FALSE, drop.na = TRUE, ...)

Arguments

ArgumentDescription
dataA PolyGeniusStudy object. A summary-mode study (no genotype backend attached, or an empty samples table) is refused.
keyUnquoted name of the matrix in data$sample.pairs or data$model.pairs. Must be square; missing dimnames are filled from the study's sample or model names.
typePlot type. Currently only "heatmap" is supported.
clusterLogical; whether rows and columns are hierarchically clustered. Default TRUE.
label.byOptional column name from data$samples (sample-side) or data$library$backbone$models$annotations (model-side) for labels. Given as a bare name or a string. NULL uses the matrix dimnames. Blank and NA labels fall back to the dimname. A sample label is drawn as given, repeats included; a model name or label shared by more than one model carries a [#<position>] suffix, its position in data.
paletteColor palette for the heatmap. NULL picks the package ramp whose role matches the matrix: sequential when the values never go negative (an overlap or kinship matrix has no meaningful midpoint), and diverging when they cross zero (a correlation matrix does). Otherwise a palette-system or hue name, a vector of colors, or a colorRampPalette/circlize::colorRamp2 function.
n.breaksInteger count of color breaks sampled from the palette. Default 11; must be at least 2, and odd and at least 3 when center.zero = TRUE.
symmetrize.rangeLogical; force the color range symmetric about zero. Default FALSE, but forced TRUE when palette is NULL and the matrix resolves to a diverging ramp, so the pivot lands on zero rather than on the arithmetic midrange. An explicit palette suppresses that override.
center.zeroLogical; require zero to be an explicit center break. Default FALSE. Errors unless the range spans zero or symmetrize.range is TRUE.
drop.naLogical; drop rows and columns that are entirely NA before clustering. Default TRUE. Errors when nothing survives.
...Further arguments passed to ComplexHeatmap::Heatmap(); use_raster = TRUE is the house default unless overridden here.

Value

A ComplexHeatmap::Heatmap (concrete class Heatmap). It does not compose with + as a ggplot does; print or ComplexHeatmap::draw() it.

Details

The sample-side accessor refuses outright above 2000 samples, because a sample x sample heatmap is a pairwise identity map of a real, named cohort at any size. There is no downsampling option, since a random subset is still full-resolution disclosure for every pair it keeps; the model-side accessor has no cap.

Examples

visualize$data$similarity$models(study, score.pearson, label.by = trait)

visualize$data$similarity$samples(study, kinship, cluster = FALSE)

See Also

Aliases: visualize_similarity, .visualize.similarity, visualize$data$similarity$samples, visualize$data$similarity$models