Generate Quarto report chunks for a GWAS meta-analysis trait
Source:R/generate_report_chunks.R
generate_report_chunks.RdGenerates quarto-compatible R code chunks as a character string for
inclusion in multi-trait reports. Manhattan plots use
knitr::include_graphics() with high-DPI PNG file targets for native
HTML rendering at full width. Loci tables are rendered with
DT::datatable() with a CSV export button.
Precision plots and LDSC heatmaps use native tar_read() calls.
Sections with per-ancestry results (LDSC heatmaps, Manhattan plots)
are organized using Quarto tabset panels.
Arguments
- trait
Trait name (e.g.
"CAD").- manifest_df
A data frame with at least
ancestryandcohortcolumns. Same manifest passed togenerate_gwas_meta_pipeline(). Used to determine which ancestries have per-ancestry meta-analysis targets (only ancestries with 2+ cohorts).- include_loci
Logical; whether to include genome-wide significant loci table chunks. Default
TRUE.- output_file
Optional file path to write the generated chunks to. When provided, parent directories are created automatically and the string is returned invisibly. When
NULL(default), the string is returned visibly.
Examples
if (FALSE) { # \dontrun{
manifest <- data.frame(
path = c("/data/UKBB_EUR.txt.gz", "/data/MVP_AFR.txt.gz",
"/data/BioVU_EUR.txt.gz"),
file = c("UKBB_EUR.txt.gz", "MVP_AFR.txt.gz", "BioVU_EUR.txt.gz"),
cohort = c("UKBB", "MVP", "BioVU"),
ancestry = c("EUR", "AFR", "EUR"),
study = c("UKBB", "MVP", "BioVU"),
stringsAsFactors = FALSE
)
cat(generate_report_chunks("CAD", manifest))
} # }