Convert wide-format DMR results into a long-format table with explicit columns for contrasts, effect sizes, and significance values.
pivotDMRsLonger(DMRtable, FDRthres = 0.05, makePositive = FALSE)data.frame
DMR results in wide format, typically produced by calculateDMRs().
numeric(1)
False discovery rate threshold for filtering significant windows.
Default: 0.05.
logical(1)
If TRUE, reverse the direction of contrasts so that all retained windows
are positively associated with group1.
Default: FALSE.
A tibble:
pivotDMRsLonger(): returns a long-format table with one row per
DMR–contrast combination, including columns group1, group2,
deltaBeta, log2FC, and adjPval.
data(exampleTumourNormal, package = "mesa")
# Convert results to long format and filter at custom FDR threshold
exampleTumourNormal %>%
calculateDMRs(
variable = "type",
contrasts = "LUAD_vs_NormalLung",
FDRthres = 0.1
) %>%
pivotDMRsLonger(FDRthres = 0.1)
#> Generating table of nrpm values for 819 regions across 5 samples.
#> Fitting initial GLM on 255 windows, without using parallelisation.
#> Performing contrast LUAD_vs_NormalLung
#> Contrasts Complete
#> selecting regions from contrast LUAD_vs_NormalLung
#> selected 58/255 windows
#> adding test results from LUAD_vs_NormalLung
#> # A tibble: 58 × 19
#> seqnames start end CpG_density NormalColon_beta_means CRC_beta_means
#> <fct> <int> <int> <dbl> <dbl> <dbl>
#> 1 7 25107301 25107600 8.13 0.364 0.293
#> 2 7 27096001 27096300 18.8 0.0229 0.0259
#> 3 7 27096301 27096600 19.9 0.0431 0.0133
#> 4 7 27096601 27096900 12.6 0.0317 0.0187
#> 5 7 27096901 27097200 17.9 0.0341 0.0136
#> 6 7 27098401 27098700 12.1 0.203 0.484
#> 7 7 27099001 27099300 13.1 0.304 0.487
#> 8 7 27103501 27103800 13.1 0.247 0.686
#> 9 7 27106501 27106800 19.0 0.972 0.983
#> 10 7 27106801 27107100 13.1 0.859 0.958
#> # ℹ 48 more rows
#> # ℹ 13 more variables: NormalLung_beta_means <dbl>, LUAD_beta_means <dbl>,
#> # LUSC_beta_means <dbl>, NormalColon_nrpm_means <dbl>, CRC_nrpm_means <dbl>,
#> # NormalLung_nrpm_means <dbl>, LUAD_nrpm_means <dbl>, LUSC_nrpm_means <dbl>,
#> # group1 <chr>, group2 <chr>, log2FC <dbl>, adjPval <dbl>, deltaBeta <dbl>