R/qseaExtra.R
convertToArrayBetaTable.RdBuild a probe × sample beta table by mapping qseaSet windows to array
probe coordinates. Currently supports Illumina Infinium 450k probes on
GRCh38; a custom GRanges of probes can also be supplied.
convertToArrayBetaTable(qseaSet, arrayDetails = "Infinium450k")qseaSet.
Input object providing per-window beta values.
Default: none (must be supplied).
character(1) or GRanges.
Either a recognised keyword (currently "Infinium450k") or a GRanges
of probe loci with an ID metadata column of probe identifiers. Coordinates
must match the qseaSet genome (e.g., GRCh38).
Default: "Infinium450k".
A data.frame with one row per probe (including an ID column) and one
column per sample containing the corresponding beta values. Probes with no
matching/overlapping window receive NA.
Probe coordinates are matched to qseaSet windows (e.g., via overlap). When
multiple windows are relevant for a probe, the package's implementation is
used to derive a single beta value per probe. Ensure the probe genome build
matches the qseaSet (e.g., GRCh38) to avoid mismatches.
getDataTable(), dataset mesa::hg38_450kArrayGR
Other window-helpers:
calculateFractionReadsInGRanges(),
downSample(),
subsetWindowsBySignal(),
subsetWindowsOverBackground()
data(exampleTumourNormal, package = "mesa")
# Use the built-in keyword for 450k probes (GRCh38)
exampleTumourNormal %>%
convertToArrayBetaTable(arrayDetails = "Infinium450k") %>%
head()
#> selecting specified ROIs
#> obtaining raw values for 10 samples in 724 windows
#> deriving beta values...
#> creating table...
#> ID Colon1_N Colon1_T Colon2_N Colon2_T Lung1_N Lung1_T
#> 1 cg07628855 0.23631177 0.25657611 0.38851605 0.27410317 0.14973361 0.2473639
#> 2 cg20986166 0.23631177 0.25657611 0.38851605 0.27410317 0.14973361 0.2473639
#> 3 cg10626515 0.27941431 0.31468726 0.26731751 0.33483640 0.18763547 NA
#> 4 cg21433538 0.25522252 0.16195411 0.24284522 0.16033002 0.16554444 0.5702529
#> 5 cg14984920 0.07535972 0.04279569 0.07017123 0.04338794 0.04491717 0.1511983
#> 6 cg11496438 0.07535972 0.04279569 0.07017123 0.04338794 0.04491717 0.1511983
#> Lung2_N Lung2_T Lung3_N Lung3_T
#> 1 0.22838487 0.14690660 0.19599965 0.17212922
#> 2 0.22838487 0.14690660 0.19599965 0.17212922
#> 3 0.52722534 0.32436375 0.23822053 0.21263410
#> 4 0.13935910 0.16248322 0.21411349 0.18926005
#> 5 0.06908935 0.04410231 0.06068734 0.09997946
#> 6 0.06908935 0.04410231 0.06068734 0.09997946
# Supply an explicit GRanges of 450k probes (must have metadata column 'ID')
exampleTumourNormal %>%
convertToArrayBetaTable(arrayDetails = mesa::hg38_450kArrayGR) %>%
head()
#> selecting specified ROIs
#> obtaining raw values for 10 samples in 724 windows
#> deriving beta values...
#> creating table...
#> ID Colon1_N Colon1_T Colon2_N Colon2_T Lung1_N Lung1_T
#> 1 cg07628855 0.23631177 0.25657611 0.38851605 0.27410317 0.14973361 0.2473639
#> 2 cg20986166 0.23631177 0.25657611 0.38851605 0.27410317 0.14973361 0.2473639
#> 3 cg10626515 0.27941431 0.31468726 0.26731751 0.33483640 0.18763547 NA
#> 4 cg21433538 0.25522252 0.16195411 0.24284522 0.16033002 0.16554444 0.5702529
#> 5 cg14984920 0.07535972 0.04279569 0.07017123 0.04338794 0.04491717 0.1511983
#> 6 cg11496438 0.07535972 0.04279569 0.07017123 0.04338794 0.04491717 0.1511983
#> Lung2_N Lung2_T Lung3_N Lung3_T
#> 1 0.22838487 0.14690660 0.19599965 0.17212922
#> 2 0.22838487 0.14690660 0.19599965 0.17212922
#> 3 0.52722534 0.32436375 0.23822053 0.21263410
#> 4 0.13935910 0.16248322 0.21411349 0.18926005
#> 5 0.06908935 0.04410231 0.06068734 0.09997946
#> 6 0.06908935 0.04410231 0.06068734 0.09997946