For a given set of genomic windows, count (per sample) how many windows exceed a chosen threshold using the selected normalisation/measure.
countWindowsAboveCutoff(
qseaSet,
GRanges,
samples = NULL,
cutoff = 0,
normMethod = "nrpm"
)qseaSet.
A qseaSet object containing methylation-enriched sequencing data.
Default: none (must be supplied).
GenomicRanges::GRanges.
Windows to count over.
Default: none (must be supplied).
character() or NULL.
Sample names to include, or a single string used as a pattern to match
sample names. If NULL, all samples are used.
Default: NULL.
numeric(1).
Threshold; windows with value >= cutoff are counted.
Default: 0.
character(1).
Measure to use. One of "nrpm" or "beta".
Default: "nrpm".
A tibble with one row per sample containing:
sample_name
numOverCutoff — number of windows >= cutoff
totalWindowsUsed — number of windows evaluated
followed by columns from the sample table (left-joined).
The function builds a window × sample matrix over GRanges for the chosen
normMethod, optionally restricts to samples, and counts, per sample, the
number of windows with value >= cutoff. It also reports how many windows
were evaluated (totalWindowsUsed). Results are joined with the sample
table.
getDataTable(), summariseAcrossWindows()
Other window-summaries:
addSummaryAcrossWindows(),
summariseAcrossWindows()
data(exampleTumourNormal, package = "mesa")
#' # Count windows with NRPM >= 1 over the first 100 regions
countWindowsAboveCutoff(exampleTumourNormal,
qsea::getRegions(exampleTumourNormal)[1:100],
cutoff = 1,
normMethod = "nrpm")
#> obtaining raw values for 10 samples in 100 windows
#> deriving nrpm values...
#> creating table...
#> Joining with `by = join_by(sample_name)`
#> # A tibble: 10 × 11
#> sample_name numOverCutoff totalWindowsUsed group patient type tumour tissue
#> <chr> <dbl> <int> <chr> <chr> <chr> <chr> <chr>
#> 1 Colon1_N 6 100 Colon… Colon1 Norm… Normal Colon
#> 2 Colon1_T 6 100 Colon… Colon1 CRC Tumour Colon
#> 3 Colon2_N 8 100 Colon… Colon2 Norm… Normal Colon
#> 4 Colon2_T 11 100 Colon… Colon2 CRC Tumour Colon
#> 5 Lung1_N 13 100 Lung1… Lung1 Norm… Normal Lung
#> 6 Lung1_T 6 100 Lung1… Lung1 LUAD Tumour Lung
#> 7 Lung2_N 15 100 Lung2… Lung2 Norm… Normal Lung
#> 8 Lung2_T 9 100 Lung2… Lung2 LUSC Tumour Lung
#> 9 Lung3_N 14 100 Lung3… Lung3 Norm… Normal Lung
#> 10 Lung3_T 11 100 Lung3… Lung3 LUAD Tumour Lung
#> # ℹ 3 more variables: age <dbl>, gender <chr>, stage <chr>