Thin wrapper on the shared pedigree belief-propagation kernel
(call_states() caller = "pedigree") for the hard-call refinement use:
couple a family's relatives to correct a per-marker mosaic produced by another
caller. Same engine as caller = "pedigree"; the difference is ergonomic —
refine_ancestry() takes and returns a mosaic in place (so a
call_states() output goes in and a same-shape corrected mosaic comes back),
whereas the caller takes the raw observation table. See design/PEDIGREE_HMM.md.
Arguments
- mosaic
Per-marker table keyed by
name, chr, pos(+ optionalsource, donor, cm). Foremission = "gt"needsstatein{0,1,2,3=missing}(fromcall_states()); foremission = "count"needsn_ref, n_altread depths.- pedigree
A pedigree: a path (read via
read_pedigree()) or aread_pedigree()-shaped data.frame (taxon, family, parent1, parent2).taxonjoins tomosaic$name; ataxonused as a parent but absent frommosaicis a latent ancestor.- design
Breeding design
"BC{n}S{m}": the founder priorpi_0is derived viabreeding_prior(); per-nodemeiosescome from the BC count and pedigree depth.- emission
"gt"(depth-blind, over hard states) or"count"(depth-aware BetaBinomial overn_ref/n_alt).- err
Genotyping/read error:
emission_gt()germwhenemission="gt"(default 0.05), per-read error whenemission="count"(default 0.01).- gert
emission_gt()genotyping-error-rate-in-transmission ("gt"only).- conc
emission_count()BetaBinomial concentration ("count"only).- rrate
Per-bp recombination fraction applied to
posgaps whenmosaichas nocmcolumn (else Haldane oncm).- maxiter, tol, lambda
BP sweeps, convergence tolerance, damping.
- ped_format
Passed to
read_pedigree()whenpedigreeis a path.
Value
mosaic with the refined per-marker calls in its state column —
replaced when a state column is present (emission = "gt"), or appended when
absent (emission = "count") — preserving the input columns and row order
(genotyped leaves only). Feed to to_segments().
Details
Two emission modes (the swappable observation channel): "gt" (default;
depth-blind, emission_gt() over the hard state calls) or "count"
(depth-aware, emission_count() BetaBinomial over read depths). The count mode
is identical to call_ancestry(caller = "pedigree") on the same counts; prefer
the caller for de novo calling and reserve refine_ancestry() for correcting an
existing hard-call mosaic.
See also
call_states() (caller = "pedigree"), simulate_family(),
pedigree_bp_cpp(), to_segments().
Examples
if (FALSE) { # \dontrun{
sim <- simulate_family("BC2S3", families = 10, sibs = 10, seed = 1)
obs <- simulate_counts(sim$truth, depth = 0.5, seed = 1)
calls <- call_states(obs, caller = "rtiger", design = "BC2S3")
ref <- refine_ancestry(calls, sim$pedigree, design = "BC2S3")
} # }