Skip to contents

Viterbi per clone and chromosome over the states of fit_clone_states() (stay probability 1 - p_switch, switches weighted by the grid prior); runs shorter than min_win windows are absorbed into the adjacent run whose state explains them better. With the allele part of the emissions (ll_a, from fit_clone_states()) a run in an imbalanced state whose allelic log-likelihood ratio vs 1:1 is not positive is given the best balanced state instead. Clone profiles of clones under 50 cells are expected on the 5 Mb tile grid (caller_tumour() does that).

Usage

segment_clone(
  ll,
  p_switch = 0.001,
  min_win = 3,
  grid = NULL,
  min_llr = 10,
  min_excess = 0.5,
  bal_frac = 0.75,
  min_bal_len = 2e+07,
  max_contra = 0.1
)

Arguments

ll

a fit_clone_states() result, or a long table clone, chrom, start, end, state, ll (optional window, ploidy; then summaries that need the profile are NA)

p_switch

switch probability between adjacent windows

min_win

minimal windows per segment

grid

state grid (default the fit's grid or cn_grid())

min_llr

segments with llr above this are confident (neutral segments always are)

min_excess

with a fit_clone_states() input: an imbalanced run also needs its pooled split-half oriented fraction to exceed 0.5 by at least this share of the expected excess a * (f_state - 0.5) (0 = off)

bal_frac, min_bal_len

with a fit_clone_states() input: a balanced non-neutral run (2:2, depth only) needs a mean log2 of at least bal_frac of its expected shift c * log2(cn / base) and min_bal_len bp, else 1:1 (0 = off)

max_contra

with a fit_clone_states() input: an imbalanced gain / loss whose mean log2 has the opposite sign of its expected shift by more than this takes the best supported copy-neutral state (CN-LOH or 1:1; Inf = off)

Value

segments table (check_segments()) plus label, ploidy