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)

Arguments

DMRtable

data.frame DMR results in wide format, typically produced by calculateDMRs().

FDRthres

numeric(1) False discovery rate threshold for filtering significant windows. Default: 0.05.

makePositive

logical(1) If TRUE, reverse the direction of contrasts so that all retained windows are positively associated with group1. Default: FALSE.

Value

A tibble:

  • pivotDMRsLonger(): returns a long-format table with one row per DMR–contrast combination, including columns group1, group2, deltaBeta, log2FC, and adjPval.

Examples

data(exampleDMRs, package = "mesa")

# Convert results to long format and filter at custom FDR threshold
exampleDMRs %>%
    pivotDMRsLonger(FDRthres = 0.1)
#> # A tibble: 330 × 32
#>    seqnames    start      end CpG_density annotation   geneChr geneStart geneEnd
#>    <fct>       <int>    <int>       <dbl> <chr>          <int>     <int>   <int>
#>  1 7        25018801 25019100        15.3 Distal Inte…       7  25025366  2.52e7
#>  2 7        25852801 25853100        18.4 Intron (ENS…       7  25831282  2.59e7
#>  3 7        25852801 25853100        18.4 Intron (ENS…       7  25831282  2.59e7
#>  4 7        25852801 25853100        18.4 Intron (ENS…       7  25831282  2.59e7
#>  5 7        25852801 25853100        18.4 Intron (ENS…       7  25831282  2.59e7
#>  6 7        25852801 25853100        18.4 Intron (ENS…       7  25831282  2.59e7
#>  7 7        25852801 25853100        18.4 Intron (ENS…       7  25831282  2.59e7
#>  8 7        25860601 25860900        11.6 Intron (ENS…       7  25831282  2.59e7
#>  9 7        25860601 25860900        11.6 Intron (ENS…       7  25831282  2.59e7
#> 10 7        25860601 25860900        11.6 Intron (ENS…       7  25831282  2.59e7
#> # ℹ 320 more rows
#> # ℹ 24 more variables: geneLength <int>, geneStrand <int>, geneId <chr>,
#> #   transcriptId <chr>, distanceToTSS <dbl>, ENSEMBL <chr>, SYMBOL <chr>,
#> #   GENENAME <chr>, shortAnno <chr>, NormalColon_beta_means <dbl>,
#> #   CRC_beta_means <dbl>, 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>, …