PolyGenius
Contents

visualize$genome$stack

Stack genome tracks on a shared axis

Compose genome tracks vertically onto one shared genome x-axis. The axis is derived from the union of every track's variants, so tracks align even when they cover different variant sets.

Usage

visualize.genome.stack(
  ...,
  region = NULL,
  bands = NULL,
  scale = c("window", "genome"),
  heights = NULL,
  guides = "collect"
)

Arguments

ArgumentDescription
...One or more PolyGeniusGenomeTrack objects from a visualize$genome$* builder, or a single list of them. NULL entries are dropped; no track left, or a non-track argument, aborts naming the offending positions.
regionA "chr:start-end" string, a list or one-row data frame with chr/start/end, or NULL (default) for the whole genome. Viewport applied uniformly to every track; a chromosome absent from the shared axis aborts. In the string form each bound takes decimals, thousands separators and a case-insensitive kb/Mb suffix: "11:59.9-60.5Mb" and "chr11:59,900,000-60500000" name the same window.
bandsIntervals to shade through every panel, or NULL (default): a character vector of "chr:start-end" strings, or a data frame with chr, start and end, as [visualize$genome$loci](/reference/visualize-genome-loci/) takes. A band on a chromosome absent from the shared axis is dropped with a warning, and one outside region is dropped silently.
scaleOne of "window" (default), "genome". Whether lane tracks re-bin and re-normalize to the region window, or keep their genome-wide scale; see Details.
heightsNumeric vector, or NULL (default). Relative panel heights, one per track, top to bottom; a length other than the track count aborts. NULL uses each track's own height.
guidesCharacter scalar, default "collect". Passed to patchwork::plot_layout(): "collect" gathers the tracks' legends into one column, "keep" leaves each track's legend in place.

Value

A patchwork composite, one panel per track in the order supplied. It is not a plain ggplot: apply a theme to every panel with &, since + targets only the last one.

Details

Tracks are drawn top to bottom in the order supplied, and only the bottom one shows the chromosome axis. Each track is re-rendered on the shared axis and clipped to region before its own display binning runs, so a zoom re-bins the visible window rather than cropping whole-genome bins. Tracks carrying two different genome builds are refused; a track whose build is NA -- a single-variant Manhattan, for instance -- is compatible with any.

Under a zoom, each track re-bins to the window by default (scale = "window"), so a lane heatmap is normalized against what is visible. scale = "genome" keeps the lane tracks, attribution and prs, at their genome-wide bin width and colour limits, so a zoom reads on the same scale as the whole-genome figure. Bar and point tracks are unaffected by scale.

bands are drawn as translucent strips behind the data of every panel, and change neither axis. Like the loci track, each band is drawn at least 0.3% of the visible span wide so that a locus narrower than a pixel stays visible; the widening is display only.

Examples

visualize$genome$stack(
  visualize$genome$manhattan(gwas, outcome = "dementia"),
  visualize$genome$effects(models),
  visualize$genome$coverage(models),
  region = "19:44.4-45.5Mb"
)

See Also

Aliases: visualize.genome.stack, visualize$genome$stack, visualize_genome_stack