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

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

Fragmentation of individual arms

The fragmentation of a chromosome arm is assessed with a statistical test based on counting the size of the copy number segments mapping to the arm. This analysis works only at the level of clonal segments

We work with the template dataset.

# 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')

print(x)
# A histogram of segments' lenght
plot_segment_size_distribution(x)

CNAqc counts, for every arm with lenght $L$ nucleotides:

A one-sided Binomial test is used to compute a p-value for the null hypothesis of seeing $n_s$ observations in $n_l$ trials, assuming a Binomial success probability $p = \delta > 0$. $p$ represents a model where each segment length is equally likely (uniform distribution).

In this way the test accounts for the difference in lenghts of the chromsome arms; a p-value per arm is reported and adjusted for multiple hyoptheses (Bonferroni).

# Test with default parameters (small segments: < 20% of chromosome arm)
x = detect_arm_overfragmentation(x)

print(x)

You can produce a arm-level report for the fragmentation test, with:

$J$ is the sum of the variation in total copy number profiles, evaluated among each pair of contiguous segments.

Significantly overfragmented arms with high $J$ have a "scattered" copy number profile. Those with low $J$ are more uniform, as they show little no copy number change, and can be possibly smoothed (see below).

plot_arm_fragmentation(x, zoom = 0)

Once available, these results appear in any call to plot_segments as annotated purple squares sorrounding the arms.

# Default plot has now segments
plot_segments(x)

Smoothing is a good way to start cleaning up the fragmented sets of arms.

# Smooth with default parameters
x = smooth_segments(x)

# Re-compute the fragmentation
x = detect_arm_overfragmentation(x)

print(x)
plot_arm_fragmentation(x, zoom = 0)


caravagnalab/CNAqc documentation built on Oct. 31, 2024, 3:54 a.m.