Fragments with haplotype A or B, sorted by cell,
chromosome and start; a new molecule starts when start > cummax(end) + gap of the previous
fragments of the same cell and chromosome; one vote per molecule for the majority haplotype
(ties dropped); ps is the first fragment's phase set. The running maximum is computed per group
with an integer offset (exact for coordinates below 2^53 / number of groups).
Value
data.table cell, chrom, start, end, ps, n_frag, hap (hap "A"/"B"), one row per molecule (per molecule x
phase set with split_ps)
Details
Phase sets are not oriented relative to each other, so a molecule whose fragments lie in different phase sets
(a molecule across a block junction) mixes unrelated haplotype labels. With split_ps = TRUE the molecules are
formed as above and then split by phase set: the fragments of each phase set of a molecule give their own vote
(majority haplotype of those fragments, ties dropped) in that phase set, with start / end / n_frag of
those fragments. Molecules within one phase set are the same under both settings.