R/sampleQC.R
addHyperStableFraction.RdFor each sample, compute the proportion of Edgar et al. “ultra-stable”
windows that are clearly methylated (beta >= minBeta) after filtering by
CpG density (>= minDensity). The result is added to the sample table as
hyperStableEdgar (overwriting any existing column of that name).
addHyperStableFraction(qseaSet, minDensity = 5, minBeta = 0.8)The input qseaSet with its sampleTable augmented by a numeric column
hyperStableEdgar (range 0–1) giving, per sample, the fraction of
ultra-stable
windows called methylated.
Genome restriction. Only supported for
"BSgenome.Hsapiens.NCBI.GRCh38"; the function stops otherwise (checked via
qsea::getParameters()).
Regions used. Uses mesa::hg38UltraStableProbes, a GRCh38 set derived
from array data (Edgar et al., 2014).
Computation. Windows overlapping the ultra-stable set are extracted,
beta values are computed via qsea::makeTable(norm_methods = "beta"),
windows with CpG_density < minDensity are dropped, NA beta
are treated as 0 for thresholding, and the per-sample
fraction with beta >= minBeta is returned.
Edgar R, Tan PPC, Portales-Casamar E, Pavlidis P (2014). Meta-analysis of human methylomes reveals stably methylated sequences surrounding CpG islands associated with high gene expression. doi:10.1186/1756-8935-7-28
data(exampleTumourNormal, package = "mesa")
# Run only if the example windows overlap the ultra-stable probes
exampleTumourNormal %>%
{
has_ov <- sum(
GenomicRanges::countOverlaps(
qsea::getRegions(.),
mesa::hg38UltraStableProbes
)
) > 0
if (has_ov) addHyperStableFraction(.) else {
message(
"No overlap with hg38UltraStableProbes in this toy dataset;",
" skipping."
)
.
}
} %>%
qsea::getSampleTable() %>%
dplyr::select(sample_name, dplyr::any_of("hyperStableEdgar")) %>%
head()
#> No overlap with hg38UltraStableProbes in this toy dataset; skipping.
#> sample_name
#> Colon1_N Colon1_N
#> Colon1_T Colon1_T
#> Colon2_N Colon2_N
#> Colon2_T Colon2_T
#> Lung1_N Lung1_N
#> Lung1_T Lung1_T