Creates a detailed DMR plot with an integrated heatmap showing beta values across samples for seeds and surrounding sites. The plot consists of two panels: the top panel shows the DMR structure with seeds and extended sites, and the bottom panel displays a heatmap of beta values for all samples, if beta values are provided. Additionally, if motif information is available or can be extracted, a sequence logo plot is added showing the nucleotide composition and information content around site sites in the DMR.
Usage
plotDMR(
dmrs,
dmr_index,
beta = NULL,
pheno = NULL,
genome = "hg38",
array = c("450K", "27K", "EPIC", "EPICv2"),
beta_locs = NULL,
sample_group_col = "Sample_Group",
extend_by_dmr_size_ratio = 0.2,
min_extension_bp = 50,
max_sites = 100,
max_samples_per_group = 10,
plot_motif = TRUE,
motif_site_flank_size = 5,
plot_title = TRUE,
output_file = NULL,
width = 8,
height = 12
)Arguments
- dmrs
GRanges object. Output from buildDMRs.
- dmr_index
Integer. Which DMR to plot.
- beta
BetaHandler object, character path to beta file, or beta values matrix. If a character path or matrix is provided, a BetaHandler will be created automatically.
- pheno
Data frame or character path to phenotype file. Sample information with rownames matching beta column names (required).
- genome
Character. Genome version (default: "hg38").
- array
Character. Array platform type. Must be NULL if input is not array-based. Ignored if beta_locs is provided. (default: "450K")
- beta_locs
Data frame. Genomic locations sorted by position (optional).
- sample_group_col
Character. Column in pheno for sample grouping (default: "Sample_Group").
- extend_by_dmr_size_ratio
Numeric. Ratio of the DMR width to extend the plot region outside of the DMR in both sides (default: 0.2).
- min_extension_bp
Integer. Minimum extension in base pairs (default: 50).
- max_sites
Integer. Maximum number of sites to show in heatmap (default: 100).
- max_samples_per_group
Integer. Maximum number of samples to show per group in heatmap (default: 10).
- plot_motif
Logical. Whether to plot the sequence logo motif (default: TRUE).
- motif_site_flank_size
Integer. Number of base pairs to include as flanking regions around each site site for motif extraction (default: 5).
- plot_title
Logical. Whether to display the title on the plot. If FALSE, the title is shown in the logs (default: TRUE).
- output_file
Character. If provided, saves the plot to the specified file path (PDF format).
- width
Numeric. Width of the output PDF in inches when
output_fileis provided (default:8).- height
Numeric. Height of the output PDF in inches when
output_fileis provided (default:12).
Value
A combined plot object (gridExtra) containing the DMR structure plot, beta values heatmap (if beta is provided), and sequence logo motif plot (if motif information is available and plot_motif is TRUE).
Examples
dmrs <- readRDS(system.file(
"extdata", "example_outputChr5And11.rds", package = "CMEnt"
))
# \donttest{
plotDMR(dmrs, 1, plot_motif = FALSE)
# }
