1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use rust_htslib::bcf;
use crate::{
common::{aligner::InProgress, csv::CSVAuxData},
vcf::pipeline::clusterizer::phasing::OutputPhasing,
};
pub(super) enum Message {
/// Records to emit raw and unchanged: non-cluster runs and unresolvable clusters.
Passthrough(Vec<bcf::Record>),
/// A single haplotype sub-cluster. Carries its records with the chosen allele index and
/// the genotype to emit, so the writer can either write the realignment (on a template
/// switch) or reconstruct per-haplotype biallelic records (on no TS / failed prep).
Cluster {
/// `None` when preparation / alignment-start failed → reconstruct directly.
/// Boxed because `CSVAuxData` is large and most messages do not carry it.
pending: Option<Box<(InProgress, CSVAuxData)>>,
records: Vec<(bcf::Record, u32)>,
phasing: OutputPhasing,
},
}
impl Message {
pub(super) const fn passthrough(orig_records: Vec<bcf::Record>) -> Self {
Self::Passthrough(orig_records)
}
pub(super) const fn cluster(
pending: Option<Box<(InProgress, CSVAuxData)>>,
records: Vec<(bcf::Record, u32)>,
phasing: OutputPhasing,
) -> Self {
Self::Cluster {
pending,
records,
phasing,
}
}
}