R/utils.R
getWindowNames.RdReturn character labels of the form "seqnames:start-end" for each genomic
window/region, or the windows a dimensionality reduction was computed over.
getWindowNames(x)
# S4 method for class 'ANY'
getWindowNames(x)
# S4 method for class 'mesaPCA'
getWindowNames(x)
# S4 method for class 'mesaUMAP'
getWindowNames(x)
# S4 method for class 'mesaDimRed'
getWindowNames(x)qseaSet or GRanges or data.frame, or a
mesaPCA, mesaUMAP or mesaDimRed object.
If a data frame, it must be coercible to GRanges (accepted columns include
seqnames/start/end, or chr/start/end, or chr/window_start/window_end).
Default: none (must be supplied).
character() vector of window labels, one per region. For a
mesaDimRed, a named list of these, one per result.
If x is a qseaSet, regions are taken from qsea::getRegions(x).
If x is a mesaPCA or mesaUMAP, the window IDs used to
compute the dimensionality reduction are returned. If x is a
mesaDimRed, the result is a named list of these, one per result.
Otherwise
the input is coerced to GRanges (see asValidGranges()) and labels are
constructed as "seqnames:start-end".
# From a GRanges (no intermediate objects)
GenomicRanges::GRanges(c("chr1", "chr2"),
IRanges::IRanges(c(10, 20), c(15, 30))) %>%
getWindowNames()
#> [1] "chr1:10-15" "chr2:20-30"
# From a data.frame (no intermediate objects)
data.frame(seqnames = c("chr1", "chr2"),
start = c(100, 200),
end = c(120, 220)) %>%
getWindowNames()
#> [1] "chr1:100-120" "chr2:200-220"
# From a qseaSet shipped with mesa (if available)
data(exampleTumourNormal, package = "mesa")
exampleTumourNormal %>% getWindowNames() %>% head()
#> [1] "7:25002001-25002300" "7:25005001-25005300" "7:25008601-25008900"
#> [4] "7:25011301-25011600" "7:25017601-25017900" "7:25017901-25018200"
# The windows each PCA result was computed over
exampleTumourNormal %>%
getPCA(topVarNum = c(100, 500), verbose = FALSE) %>%
getWindowNames() %>%
lengths()
#> Generating table of beta values for 819 regions across 10 samples.
#> pca1 pca2
#> 100 500