if (FALSE) {
library(GenomicRanges)
set.seed(1)
gr <- GRanges(
seqnames = rep("chr1", 90),
ranges = IRanges(start = sort(sample(1e6, 90)), width = 50),
Tm = c(rnorm(30, 74, 2), rnorm(30, 70, 2), rnorm(30, 66, 2)),
GC = runif(90, 40, 60)
)
gr$group <- rep(c("high", "mid", "low"), each = 30)
# Two groups
gr2 <- gr[gr$group %in% c("high", "low")]
compare_groups(gr2, target = "Tm", group = "group", posthoc = FALSE)
# Three or more groups (Kruskal-Wallis + pairwise Wilcoxon)
compare_groups(gr, target = c("Tm", "GC"), group = "group",
method = "wilcoxon")
# Three or more groups (one-way ANOVA + pairwise t-tests)
compare_groups(gr, target = "Tm", group = "group", method = "t.test")
# Post-hoc with Benjamini-Hochberg FDR control
compare_groups(gr, target = "Tm", group = "group",
p.adjust.method = "BH")
}
Run the code above in your browser using DataLab