Merge samples whose names share a common prefix by removing a suffix pattern
(mergeString) and summing counts across the resulting groups. CNV and
zygosity values are combined using fragment‐count weights. The result is a
new qseaSet with pooled samples and updated metadata.
poolSamples(qseaSet, mergeString, renormalise = TRUE, maxPatternDensity = 0.05)qseaSet
A qseaSet object containing methylation-enriched sequencing data.
character(1)
Regular expression used to remove the suffix that distinguishes samples
to be merged. The remaining prefix becomes the pooled sample name, and the
samples that give the same prefix are pooled together. For example, with
names like "Patient1_T" and "Patient1_N", use mergeString = "_[TN]$" to
pool them into "Patient1".
logical(1)
Whether to run addNormalisation() on the result. The pooled samples have no
library factors, offsets or enrichment parameters until it has run, so beta
values and DMR calls need it. Set this to FALSE only for a set that cannot
be normalised, such as one whose windows are all CpG-dense.
Default: TRUE.
numeric(1)
Maximum pattern density in a window to consider it for the background
calculation. Passed to addNormalisation() when renormalise = TRUE.
Default: 0.05.
A qseaSet object:
poolSamples(): returns a new qseaSet where samples with names sharing
a common prefix (after applying mergeString) are merged. Counts are summed,
CNV and zygosity values are combined using weighted averages, and library
statistics are aggregated.
Internally, pooled counts are simple sums. CNV values and zygosity are
combined by a weighted average using total_fragments from the
"input_file" table of getLibraries(), or from the "file_name" table
when the set has no input libraries. Library statistics are aggregated
(sums for counts, weighted means for rates). When renormalise = TRUE,
addNormalisation() is run with the enrichmentMethod recorded in the
input set ("blind1-15" if there is none).
data(exampleTumourNormal)
# Pool Tumour/Normal pairs by patient into a single sample per patient:
# e.g., "Colon1_T","Colon1_N" -> "Colon1". The windows of the example data
# are too CpG-dense to estimate the background, so skip the normalisation.
poolSamples(exampleTumourNormal, mergeString = "_[TN]$", renormalise = FALSE)
#> All names in common, returning second qseaSet
#> qseaSet
#> =======================================
#> 5 Samples:
#> Colon1, Colon2, Lung1, Lung2, Lung3
#> 819 Regions in 22 chromosomes of BSgenome.Hsapiens.NCBI.GRCh38
# A set with a range of CpG densities can be renormalised after pooling
qsea::getExampleQseaSet(expSamplingDepth = 1e5) %>%
poolSamples(mergeString = "[TN]$", maxPatternDensity = 0.5)
#> selecting windows with low CpG density for background read estimation
#> 1.48% of the windows have enrichment pattern density of at most 0.5 per fragment
#> and are used for background reads estimation
#> All names in common, returning second qseaSet
#> selecting windows with low CpG density for background read estimation
#> 1.48% of the windows have enrichment pattern density of at most 0.5 per fragment
#> and are used for background reads estimation
#> qseaSet
#> =======================================
#> 2 Samples:
#> Sim1, Sim2
#> 10000 Regions in 1 chromosomes of example_genome