PolyGenius
Contents

visualize$genome$attribution

Per-trait genomic attribution track

Renders an attribution PolyGeniusGenomeSignal as a per-trait lane heatmap: one row per model, genome on x, each cell filled with the summed weight x single-variant effect that model attributes to the bin, on a diverging ramp (red drives the outcome up, blue down). Shows where each trait-PRS's outcome signal sits and which loci recur across traits.

Usage

visualize.genome.attribution(
  signal,
  binwidth = 1e+07,
  reduce = c("bin", "window"),
  window = NULL,
  normalize = c("row", "row-clip", "global-clip", "none"),
  clip.quantile = 0.99,
  order = "strength",
  traits = NULL,
  top.n = NULL,
  palette = NULL,
  max.labels = 40,
  height = 4,
  theme = c("polygenius", "none")
)

Arguments

ArgumentDescription
signalA PolyGeniusGenomeSignal with metadata$statistic == "attribution", from [compute$genome$attribution()](/reference/compute-genome-attribution/); any other statistic aborts, naming the producer to call. Reads chr, position, group (the model) and value from $results.
binwidthNumeric scalar (base pairs), default 1e7 (10 Mb). Display bin width. Superseded under a region = zoom on the stack, which re-bins to about 50 bins across the visible window.
reduceOne of "bin" (default), "window". "bin" assigns each variant to one disjoint bin; "window" sums overlapping windows, each variant contributing to every bin within +/- window/2, clipped to its chromosome, so an isolated influential variant reads as a smoothed lane rather than a one-bin sliver.
windowNumeric scalar (base pairs), or NULL (default). Smoothing width for reduce = "window"; NULL uses three times the display bin width.
normalizeOne of "row" (default), "row-clip", "global-clip", "none". How the diverging fill scale is set, applied to the binned lane values. "row" — Rescales each lane by its own max|value| onto [-1, 1], keeping the sign, and relabels the legend "relative attribution (per trait)"; lane magnitudes are not comparable across traits or algorithms. An all-zero lane draws neutral rather than dropping out. "row-clip" — As "row", but each lane is rescaled by its own quantile(|value|, clip.quantile) and out-of-range values are squished, so one extreme locus saturates instead of fading the rest of its lane. "global-clip" — One shared scale clipped to +/- quantile(|value|, clip.quantile), with out-of-range values squished, so one extreme locus does not flatten every other lane. "none" — One shared scale over the full +/- max|value| range.
clip.quantileNumeric scalar in (0, 1], default 0.99. Quantile of |value| used as the colour limit by "row-clip" (per lane) and "global-clip" (over all lanes). Only bins holding variants count. A locus covering more than 1 - clip.quantile of them sets the limit itself rather than being clipped, so a 3-bin locus in a lane of a few hundred bins needs about 0.95.
orderLane order, default "strength"; either an auto layout or an explicit sequence. "strength" — Models by total |attribution|, strongest at the top. "input" — The order the signal carries them in. index or name vector — An explicit order, first element at the top. Indices run over the models this signal carries; names are addressable only when unique in the signal. list of such vectors — Splits the lanes into stacked facet blocks, first block on top. A named list titles each block and must name every block; an unnamed list draws blocks without strip titles. An explicit order both selects and sequences the rows, so combining it with traits/top.n aborts, as does listing a model in two positions.
traitsCharacter vector of model names, or NULL (default, keep all). Restricts the lanes to these traits; matching none of the signal's groups aborts. Auto-order layouts only.
top.nPositive integer scalar, or NULL (default, keep all). Keeps the top.n traits by total |attribution|, applied after traits. Auto-order layouts only.
paletteCharacter vector of two or more colours, a single colour or role/hue name, a colorRampPalette-style ramp function, or NULL (default). Diverging fill ramp; NULL uses the package diverging ramp.
max.labelsNumeric scalar, default 40. Draw model row labels only when the lane count is at most this; above it the y-axis is labelled with the lane count instead.
heightNumeric scalar, default 4. Relative panel height when stacked.
themeOne of "polygenius" (default), "none". Plot theme. "none" gives a bare theme_minimal() to style yourself; palette colors are applied either way.

Value

A PolyGeniusGenomeTrack: the render spec (mark, data, params, positions, height, label, build), with build taken from signal$metadata$build. Binning and normalize both run at render, so a region = zoom re-bins and re-normalizes the visible window. Prints as a standalone plot; stack it with visualize$genome$stack.

Examples

sig <- compute$genome$attribution(gwas, models, outcome = "dementia")
visualize$genome$attribution(sig, top.n = 12)
visualize$genome$attribution(sig, order = list(amyloid = c("AD", "APOE"), lipids = "LDL"))

See Also

Aliases: visualize.genome.attribution, visualize$genome$attribution, visualize_genome_attribution