Computes motif-based interactions between DMRs based on their motif similarity. Identifies pairs of DMRs with significant motif similarity and returns a data frame of interactions. Assigns directionality based on score, if available.
Usage
computeDMRsInteraction(
dmrs,
genome = "hg38",
array = "450K",
min_similarity = getOption("CMEnt.min_motif_similarity", 0.8),
beta_locs = NULL,
motif_site_flank_size = 5,
find_components = TRUE,
min_component_size = 2,
query_components_with_jaspar = TRUE,
plot_dir = NULL,
output_prefix = NULL
)Arguments
- dmrs
Dataframe or GRanges object containing DMR coordinates and motif information
- genome
Character. Genome version to use for sequence extraction (e.g., "hg38")
- array
Character. Array platform type (e.g., "450K", "EPIC"). Must be NULL if input is not array-based (default: "450K")
- min_similarity
Numeric. Minimum motifs PWM similarity threshold for considering DMRs are related (default: 0.8)
- beta_locs
Data frame. Optional pre-computed genomic locations. If NULL, locations will be retrieved using getSortedGenomicLocs (default: NULL)
- motif_site_flank_size
Integer. Number of base pairs to include as flanking regions around each site site (default: 5)
- find_components
Logical. Whether to identify connected components of interacting DMRs (default: TRUE)
- min_component_size
Integer. Minimum size of connected components to consider (default: 2)
- query_components_with_jaspar
Logical. Whether to query connected components average PWMs against JASPAR database (default: TRUE)
- plot_dir
Character. Directory to save diagnostic plots (optional). If NULL, no plots are saved (default: NULL)
- output_prefix
Character. Prefix for output files to save interactions and components (optional). If NULL, results are not saved to file (default: NULL)
Value
A list with:
interactions: Data frame of motif-based DMR interactions with columns
chr1,start1,end1,chr2,start2,end2,sim, and when components are requested,component_idcomponents: Data frame of discovered motif components
dmrs: The input DMRs in the same class as provided, with an added
component_idscolumn containing comma-separated component IDs for each DMR (orNAwhen the DMR is not part of a retained component)
Examples
# Compute motif-based interactions for DMRs
dmrs <- data.frame(
chr = c("chr16", "chr3"),
start = c(53468112, 37459206),
end = c(53468712, 37493431),
start_site = c("cg00000029", "cg00000108"),
start_seed = c("cg00000029", "cg00000108"),
end_site = c("cg13426503", "cg08730726"),
end_seed = c("cg13426503", "cg08730726"),
seeds = c("cg00000029,cg13426503", "cg00000108,cg08730726")
)
dmrs_with_motifs <- extractDMRMotifs(dmrs, genome = "hg38", array = "450K")
interactions <- computeDMRsInteraction(
dmrs_with_motifs,
genome = "hg38",
array = "450K",
query_components_with_jaspar = FALSE
)