knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

options(crayon.enabled=FALSE)
library(CNAqc)

Smoothing merges, for each chromosome, all contiguous segments that have the same minnor and major allele counts, and are separated by up to $\delta$ base pairs (default $\delta = 10^6$, 1 megabase).

Only clonal CNAs can be smoothed; subclonal CNAs are retained but cannot be smoothed because the CCF of contiguous segments might be different.

# Dataset available with the package 
data('example_dataset_CNAqc', package = 'CNAqc')

x = CNAqc::init(
  mutations = example_dataset_CNAqc$mutations, 
  cna = example_dataset_CNAqc$cna,
  purity = example_dataset_CNAqc$purity,
  ref = 'hg19')
# Before smoothing
print(x)

# After smoothing
x = smooth_segments(x, maximum_distance = 1e6) # default

The old CNAqc object is retained inside the new one

print(x$before_smoothing)

# The new one should have fewer segments
print(x)

You can visualise the effect of the smoothing.

plot_smoothing(x)
plot_multisample_CNA(list(`Before` = x$before_smoothing, `After` = x))


caravagn/CNAqc documentation built on April 12, 2025, 10:39 a.m.