Contents
visualize$genome$manhattan
Single-variant association across the genome (Manhattan track)
Manhattan-style genome track of per-variant association strength from
associate$singleVariant. Each point is a tested
variant placed at its genomic position; height is -log10(p) by default (or
the effect size). Chromosomes alternate shade, and an optional genome-wide
significance line is drawn.
Usage
visualize.genome.manhattan(
associations,
outcome = NULL,
stratum = NULL,
genotype = NULL,
statistic = c("neglog10p", "effect"),
significance.line = 5e-08,
highlight = NULL,
label.top = NULL,
label.window = 1e+06,
label.size = 2.5,
palette = NULL,
raster = NULL,
raster.args = list(),
point.size = 0.6,
point.alpha = 0.6,
height = 2,
trans = NULL,
y.max = NULL,
theme = c("polygenius", "none")
)Arguments
| Argument | Description |
|---|---|
associations | A PolyGeniusAssociation with the single.variant schema, or a meta of one, from [associate$singleVariant](/reference/associate-single-variant/); any other schema aborts. A plain data frame with the same columns is accepted unchecked. Column names resolve case-insensitively and ignoring a leading #, from chr/chrom/chromosome and position/pos/bp (both required), pval/p/p.value/pvalue or beta/estimate/effect/log_or (whichever statistic needs), and optionally variant.id/id/snp/variant, effect.scale, outcome, stratum and genotype. A missing variant.id falls back to chr:position. |
outcome | Character scalar, or NULL (default). Phenotype to plot, matched against the outcome column. Required when the result holds more than one; a value not present aborts and lists the available ones. |
stratum | Character scalar, or NULL (default). Stratum to plot, matched against the stratum column, under the same required-when-ambiguous rule as outcome. |
genotype | Character scalar, or NULL (default). Genotype dataset to plot, matched against the genotype column, under the same required-when-ambiguous rule as outcome. |
statistic | One of "neglog10p" (default), "effect". Track y-axis: -log10(p), or the effect size as reported (labelled log-odds when every row's effect.scale is "log.odds"). The column the choice needs must be present, or the call aborts. |
significance.line | Numeric scalar (a p-value), default 5e-8, or NULL to disable. Horizontal reference line, drawn only for statistic = "neglog10p". |
highlight | Character vector of variant identifiers, or NULL (default). Matched against variant.id and redrawn on top in an accent colour; identifiers absent from the data are ignored. |
label.top | Positive integer scalar, or NULL (default, no labels). Text-labels the lead variant of the top label.top loci, not the top label.top rows, so one tall multi-variant peak gets a single label. Uses ggrepel when installed, else geom_text() with a warning. |
label.window | Numeric scalar (base pairs), default 1e6 (1 Mb). Two labels are never placed within +/- label.window/2 on the same chromosome. |
label.size | Numeric scalar (mm), default 2.5 (about 7 pt). Text size of the peak labels, which read as exact base pairs, e.g. chr19:44908822. |
palette | Character vector of two or more colours, a single colour or role/hue name, or NULL (default). Points alternate by chromosome in a two-tone. NULL uses the package colour plus neutral grey; a single colour replaces the primary tone; two or more colours (e.g. c("#045669", "#822B2A")) set both chromosome shades, first two used. |
raster | Logical scalar, or NULL (default). Draw the points with ggrastr::geom_point_rast(), falling back to geom_point() with a warning when ggrastr is absent. NULL rasterizes above 100,000 plotted points, where a vector Manhattan becomes prohibitively large. |
raster.args | Named list, default list(). Extra arguments forwarded to ggrastr::geom_point_rast(), over a default raster.dpi = 300. |
point.size | Numeric scalar, default 0.6. Point size; a highlighted point is drawn at twice this. |
point.alpha | Numeric scalar in [0, 1], default 0.6. Point alpha. |
height | Numeric scalar, default 2. Relative panel height when stacked. |
trans | One of "sqrt", "log10", or NULL (default, a linear axis). Y-axis transform, to spread the mid-range instead of letting a few tall peaks flatten it. "sqrt" needs non-negative values, so it suits the default -log10(p); "log10" is scales::pseudo_log_trans(), which compresses harder, still admits zero and negative values, and places its ticks at powers of ten. |
y.max | Positive numeric scalar, or NULL (default, no cap). Ceiling for the y-axis: a variant above it is drawn on the ceiling as a triangle, so one dominant locus (e.g. APOE) does not flatten every other peak. Heights above it are not shown; peak labels ride on the capped height. Only the positive side is capped, and a significance.line above the ceiling still extends the axis to reach it. |
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 = NA_character_ since
single-variant output records no genome build, which makes it stackable
against a track of any build. Prints as a standalone plot and composes with
neither + nor draw(); stack it with
visualize$genome$stack.
Details
One scan holds one row per variant, so a duplicated chr:position only arises
from an unresolved genotype/stratum dimension: the first row is kept and
the count warned about. Rows with a non-finite statistic or a missing position
are then dropped. An empty input, or no row surviving those drops, is an error
rather than an empty panel. Chromosomes are canonicalized to the shared bare
axis spelling, so PLINK's 23 and X land on one slot when stacked.
Examples
gwas <- associate$singleVariant(data, phenotypes = dementia)
visualize$genome$manhattan(gwas, outcome = "dementia", label.top = 5)See Also
associate$singleVariant(), which produces the input; visualize$genome$stack to compose it with the model-composition tracks.
Other visualize-genome:
visualize.genome.attribution(),
visualize.genome.concordance(),
visualize.genome.convergence(),
visualize.genome.coverage(),
visualize.genome.cumulativeWeight(),
visualize.genome.effects(),
visualize.genome.loci(),
visualize.genome.overview(),
visualize.genome.prs(),
visualize.genome.reuse(),
visualize.genome.stack()