Runs a CNV pipeline on each sample: counts fragments in fixed-size genomic
windows, normalises for GC and mappability (HMMcopy), segments, and stores
per-window copy-number in the qseaSet. Supports parallel execution.
Only GRCh38/hg38 is currently supported.
addHMMcopyCNV(
qs,
inputColumn = "input_file",
windowSize = 1e+06,
fragmentLength = NULL,
plotDir = NULL,
parallel = getMesaParallel(),
maxInsertSize = 1000,
minInsertSize = 50,
minReferenceLength = 30,
minMapQual = 30,
properPairsOnly = FALSE,
hmmCopyGC = NULL,
hmmCopyMap = NULL
)qseaSet.
Input object whose samples will receive CNV tracks.
character(1).
Column in the sample table containing BAM paths (e.g. "input_file").
Default: "input_file".
integer(1).
CNV bin size in bp. Allowed values: 50000, 500000, 1000000.
Default: 1000000.
integer(1) or NULL.
Length to extend unpaired R1 reads; if NULL, estimate from proper pairs.
Default: NULL.
character(1) or NULL.
Directory to write per-sample PDF diagnostics; if NULL, no plots are saved.
Default: NULL.
logical(1).
Use the registered BiocParallel backend when TRUE; otherwise run
serially.
Default: getMesaParallel().
integer(1).
Maximum insert size to accept for proper pairs (bp).
Default: 1000.
integer(1).
Minimum insert size to accept for proper pairs (bp).
Default: 50.
integer(1).
Minimum aligned reference span for unpaired R1 (bp).
Default: 30.
integer(1).
Minimum MAPQ; for pairs, either end meeting the cutoff is accepted.
Default: 30.
logical(1).
If TRUE, ignore unpaired R1; if FALSE, combine proper pairs with
high-quality R1.
Default: FALSE.
GRanges or NULL.
Precomputed GC content track binned at windowSize.
Default: NULL.
GRanges or NULL.
Precomputed mappability track binned at windowSize.
Default: NULL.
The input qseaSet with CNV information attached, including:
per-window CNV tracks accessible via downstream CNV accessors,
library/sample tables updated with relevant CNV/coverage summaries,
(optionally) per-sample diagnostic PDFs if plotDir is provided.
Coverage is obtained (pairs + optional R1) over tiled windows, corrected with
HMMcopy (HMMcopy::correctReadcount() followed by HMMcopy::HMMsegment()),
and
merged back into the qseaSet. You must supply GC/mappability tracks binned
at
the same windowSize (or use package-provided defaults where applicable).
When parallel = TRUE, computation uses the currently registered backend
(see BiocParallel::register()).
runHMMcopy(),
plotCNVheatmap(),
getBamCoveragePairedAndUnpairedR1() (internal low-level worker),
HMMcopy::correctReadcount(),
HMMcopy::HMMsegment(),
BiocParallel::register()
Other CNV:
plotCNVheatmap(),
removeCNV(),
runHMMCopy()
if (FALSE) { # \dontrun{
data(exampleTumourNormal, package = "mesa")
exampleTumourNormal %>%
addHMMcopyCNV(
inputColumn = "input_file",
windowSize = 1e6,
hmmCopyGC = gc_hg38_1000kb, # GRanges with 'gc' column
hmmCopyMap = map_hg38_1000kb, # GRanges with 'map' column
properPairsOnly = TRUE,
parallel = FALSE,
plotDir = tempdir()
)
} # }