Creates a grid of DMR plots for multiple regions. Can optionally include beta value heatmaps if beta and pheno data are provided.
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. Column in pheno for sample grouping (default: "Sample_Group").
- genome
Character. Genome version (default: "hg38").
- array
Character. Array platform type (default: "450K"). Ignored if beta_locs is 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"
))
# \donttest{
# Plot structure only
plotDMRs(dmrs, dmr_indices = 1:2, ncol = 2, plot_motif = FALSE)
# Plot with beta values heatmap
if (interactive()) {
plotDMRs(dmrs, top_n = 4, beta = "beta.txt", pheno = pheno_df)
}
# }
