Skip to contents

Fit the emission once (rtiger: the joint EM; bbnil: per-sample means, or nothing when fit_means = FALSE) and sweep values, fanning the decodes over threads. refit controls the accuracy/speed trade (see details).

Usage

caller_sweep(
  data,
  caller = c("nnil", "bbnil", "rtiger", "lbimpute"),
  values,
  refit = c("none", "cold"),
  design = NULL,
  f_1 = NULL,
  f_2 = NULL,
  threads = 1L,
  ref = NULL,
  min_reads = 1L,
  err = 0.01,
  conc = 20,
  fit_means = FALSE,
  seed = 1L,
  postprocess = TRUE,
  unit = c("bp", "cm"),
  genotypeerr = 0.05,
  drp = FALSE,
  source = "nilHMM",
  donor = NA_character_
)

Arguments

data

Common columns name, chr, pos, plus the caller's emission input, which differs by caller:

  • bbnil, rtiger, lbimpute consume the allelic read counts n_ref, n_alt (+ optional donor; lbimpute with unit = "cm" also needs a cm map-position column).

  • nnil is categorical: it consumes hard genotype calls in an integer g column (0/1/2/3, 3 = missing) produced by call_gt(), and does not threshold read counts itself. nnil requires only g – n_ref/n_alt are not needed, and if present they are ignored (with a warning). min_reads is likewise a no-op for nnil (a categorical caller has no read depth).

caller

"rtiger" (sweeps rigidity), "bbnil" or "nnil" (both sweep rrate; bbnil = count/BetaBinomial emission on read counts, nnil = categorical genotype emission on a hard-called g column), or "lbimpute" (sweeps recombdist).

values

Parameter grid to sweep.

refit

"none" (fit once at ref and reuse – exact at ref, a close approximation elsewhere; recommended for calibration, as it isolates the segmentation prior) or "cold" (fit each value from scratch – exact per value, the baseline). For bbnil with fit_means = FALSE the emission is rrate-independent, so both are identical (and exact). This sweep finds the best value; for the exact final calls, refit once with call_ancestry() at the chosen value. Ignored for lbimpute: recombdist touches only the transition, never the emission, so every swept value is already EXACT – identical to a cold call_ancestry(caller = "lbimpute", recombdist = v) (the emission is computed once per run and only the Viterbi transition is re-run over the grid, batched in C++).

design, f_1, f_2

Population priors (a design name, or explicit f_1,f_2). For lbimpute these only seed the start distribution (flat if absent).

threads

Fan-out width (parallel::mclapply on unix; serial otherwise).

ref

Reference value for the shared fit (default median(values), rounded for rtiger). Unused for lbimpute (no shared fit).

min_reads

Minimum read depth to keep a marker before decoding (default 1L); 0L keeps all. No-op for lbimpute, which keeps zero-read markers (flat emission) so the distance transition sees true marker spacing.

err, conc, fit_means

bbnil count-emission parameters (fixed across the grid). err is also LB-Impute's per-read error (readerr).

seed, postprocess

rtiger fit seed and border post-processing.

unit, genotypeerr, drp

lbimpute only: unit is the transition coordinate ("bp" physical / "cm" genetic map; output stays bp), genotypeerr the emission floor/ceiling, drp the single-vs-double homozygous-switch cost. Same validation/mismatch warnings as call_states().

source, donor

Output labels.

Value

A common-schema segment table with an added column named for the swept parameter (rigidity, rrate, or recombdist) tagging each value's calls.