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
| Argument | Description |
|---|---|
signal | A 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. |
binwidth | Numeric 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. |
reduce | One 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. |
window | Numeric scalar (base pairs), or NULL (default). Smoothing width for reduce = "window"; NULL uses three times the display bin width. |
normalize | One 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.quantile | Numeric 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. |
order | Lane 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. |
traits | Character 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.n | Positive integer scalar, or NULL (default, keep all). Keeps the top.n traits by total |attribution|, applied after traits. Auto-order layouts only. |
palette | Character 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.labels | Numeric 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. |
height | Numeric scalar, default 4. Relative panel height when stacked. |
theme | One 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
compute$genome$attribution(), which produces the input; visualize$genome$convergence for the summed marginal these lanes decompose.
Other visualize-genome:
visualize.genome.concordance(),
visualize.genome.convergence(),
visualize.genome.coverage(),
visualize.genome.cumulativeWeight(),
visualize.genome.effects(),
visualize.genome.loci(),
visualize.genome.manhattan(),
visualize.genome.overview(),
visualize.genome.prs(),
visualize.genome.reuse(),
visualize.genome.stack()