use std::collections::HashMap;
use crate::node::NodeID;
pub struct Reconstruction<A> {
pub sequences: HashMap<NodeID, Vec<usize>>,
pub posteriors: Option<HashMap<NodeID, Vec<Vec<f64>>>>,
pub log_likelihood: f64,
pub alphabet: std::marker::PhantomData<A>,
}
impl<A: crate::tree::asr::alphabet::Alphabet> Reconstruction<A> {
pub fn sequence_string(&self, node: NodeID) -> Option<String> {
let seq = self.sequences.get(&node)?;
let mut s = String::with_capacity(seq.len());
for &idx in seq {
s.push(A::char_of(idx) as char);
}
Some(s)
}
}