Creates a grid of DMR plots for multiple regions. Can optionally include beta value heatmaps if beta and pheno data are provided.
Usage
plotDMRs(
dmrs,
dmr_indices = NULL,
top_n = 4,
score_by = c("delta_beta", "score"),
beta = NULL,
pheno = NULL,
sample_group_col = NULL,
genome = NULL,
array = NULL,
beta_locs = NULL,
ncol = 1,
output_file = NULL,
width = 8,
height = 12,
...
)Arguments
- dmrs
GRanges object. Output from buildDMRs.
- dmr_indices
Integer vector. Which DMRs to plot. If NULL, selects top_n DMRs using
score_by.- top_n
Integer. Number of top DMRs to plot when dmr_indices is NULL (default: 4).
- score_by
Character. Which metric to use for ranking DMRs when dmr_indices is NULL. Options: "delta_beta" or "score" (default: "delta_beta").
- beta
BetaHandler object, character path to beta file, or beta values matrix (optional). If provided, creates plots with heatmaps.
- pheno
Data frame or character path to phenotype file (optional). Required when beta is provided.
- sample_group_col
Character. Required column in pheno for sample grouping when
phenois provided.- genome
Character. Genome version. Required for data.frame DMRs; inferred from GRanges seqinfo when available.
- array
Character. Array platform type. Required when beta row names are array probe IDs and
beta_locsis not provided.- beta_locs
Data frame. Genomic locations sorted by position (optional). If NULL, will be fetched based on array and genome.
- ncol
Integer. Number of columns in the grid (default: 1).
- output_file
Character. Path to save the combined plot as PDF (optional). If NULL, the plot is not saved to file.
- width
Numeric. Width of the output PDF in inches (default: 8).
- height
Numeric. Height of the output PDF in inches (default: 12).
- ...
Additional arguments passed to plotDMR.
Value
If beta is NULL: A gtable object. If beta is provided: A list of combined plot objects with structure and heatmap.
Examples
dmrs <- readRDS(system.file(
"extdata", "example_outputChr5And11.rds", package = "CMEnt"
))
if (requireNamespace(
"IlluminaHumanMethylation450kanno.ilmn12.hg19", quietly = TRUE
)) {
plotDMRs(dmrs, dmr_indices = seq_len(min(2, length(dmrs))),
array = "450K", ncol = 2, plot_motif = FALSE)
}
