Skip to contents

Builds a publication-ready gt table of the top hits, mirroring the top-markers table in the ggvolc package. Positions are shown with thousands separators, p-values in scientific notation, and \(-\log_{10}(P)\) is optionally colour-scaled.

Usage

gwas_table(
  data,
  highlight = highlight_top(top_n = 10),
  columns = NULL,
  color = TRUE,
  title = NULL,
  subtitle = NULL
)

Arguments

data

A GWAS data frame (passed through validate_gwas()).

highlight

A highlight_top() spec, or a single number (top_n). Defaults to the 10 smallest-p markers.

columns

Optional character vector of columns to keep (and order). By default keeps SNP, gene, trait, CHR, POS, P, neg_log10_p when present.

color

Logical; colour the neg_log10_p column by value (default TRUE).

title, subtitle

Optional table title and subtitle.

Value

A gt table object (class gt_tbl, see gt::gt()). Requires the gt package.

Examples

if (requireNamespace("gt", quietly = TRUE)) {
  data(gwas_example)
  gwas_table(gwas_example, highlight = highlight_top(top_n = 8))
}
SNP Gene Chr Position P-value −log10(P)
rs5486 GENE20370 20 1,342,370 2.55 × 10−13 12.6
rs5485 GENE20950 20 651,950 5.50 × 10−13 12.3
rs5487 GENE20702 20 1,501,702 5.50 × 10−13 12.3
rs646 GENE02691 2 65,881,691 7.94 × 10−13 12.1
rs5484 GENE20446 20 535,446 1.18 × 10−12 11.9
rs5488 GENE20216 20 3,639,216 1.18 × 10−12 11.9
rs563 GENE02324 2 42,260,324 1.25 × 10−12 11.9
rs645 GENE02251 2 65,374,251 1.71 × 10−12 11.8