pub struct PoaGraph { /* private fields */ }Implementations§
Source§impl PoaGraph
impl PoaGraph
pub fn new(seed: &[u8], config: PoaConfig) -> Result<Self, PoaError>
pub fn add_read(&mut self, read: &[u8]) -> Result<(), PoaError>
pub fn consensus(&self) -> Result<Consensus, PoaError>
pub fn stats(&self) -> GraphStats
Sourcepub fn warnings_emitted(&self) -> usize
pub fn warnings_emitted(&self) -> usize
Number of long-unbanded warnings emitted during add_read calls.
With the new bubble-aware aligner this always returns 0 (warnings removed).
Sourcepub fn edge_weights(&self) -> Vec<i32>
pub fn edge_weights(&self) -> Vec<i32>
Return all edge weights in the graph (one entry per directed edge).
Total (matched + deleted) traversal count, unchanged in meaning from
before the Match/Delete edge-weight split – this is a general
diagnostic/visualization API (see src/plot.rs), not a consensus
decision point, so its contract is preserved as-is.
Sourcepub fn node_coverages(&self) -> Vec<u32>
pub fn node_coverages(&self) -> Vec<u32>
Return per-node coverage in topological order.
Sourcepub fn align_read_ops(
&self,
read: &[u8],
) -> Result<(Vec<AlignOp>, usize, Vec<usize>), PoaError>
pub fn align_read_ops( &self, read: &[u8], ) -> Result<(Vec<AlignOp>, usize, Vec<usize>), PoaError>
Align read into the current graph and return the alignment operations
without modifying the graph.
Sourcepub fn align_read_ops_unbanded(
&self,
read: &[u8],
) -> Result<(Vec<AlignOp>, Vec<usize>), PoaError>
pub fn align_read_ops_unbanded( &self, read: &[u8], ) -> Result<(Vec<AlignOp>, Vec<usize>), PoaError>
Like [align_read_ops] but kept for compatibility.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of nodes currently in the graph.
Sourcepub fn graph_topology(&self) -> GraphTopology
pub fn graph_topology(&self) -> GraphTopology
Return a snapshot of the graph topology for visualization and inspection.
Nodes are in topological order; edges use topological ranks as source
and target identifiers. spine_ranks lists the ranks of nodes on the
heaviest-path (consensus) spine.
Sourcepub fn node_out_edge_info(&self) -> Vec<(usize, i32, i32)>
pub fn node_out_edge_info(&self) -> Vec<(usize, i32, i32)>
For each node, return (out_edges_count, max_out_edge_weight, min_out_edge_weight).
Total (matched + deleted) weight, same reasoning as edge_weights().
Sourcepub fn bubble_arm_lengths(
&self,
weight_threshold: i32,
arm_len_threshold: usize,
) -> Vec<(usize, Vec<usize>)>
pub fn bubble_arm_lengths( &self, weight_threshold: i32, arm_len_threshold: usize, ) -> Vec<(usize, Vec<usize>)>
Return arm lengths for each bubble node with 2+ qualifying arms (weight >= threshold).
Arm length is measured by walking the single-successor chain from each arm start, stopping at reconvergence points (nodes with multiple in-edges after the first step).
weight_threshold is compared against total (matched + deleted) weight,
unchanged from before the Match/Delete edge-weight split – a general
diagnostic API (see tests/rfc1_real_data.rs), not a consensus decision point.
Sourcepub fn consensus_multi(&self) -> Result<Vec<Consensus>, PoaError>
pub fn consensus_multi(&self) -> Result<Vec<Consensus>, PoaError>
Build one consensus per detected allele.
Structural bubbles (arm span ≥ phasing_bubble_min_span) are phased first using cross-bubble compatibility grouping. If no structural bubbles are found and the alignment was banded, the graph is rebuilt with unbanded alignment so that large allele-length differences create a visible Insert-arm bubble; structural phasing then retries on the unbanded graph. If still no structural bubble, falls back to single-best SNP bubble partitioning for substitution haplotypes.
Each returned Consensus’s read_indices are in this graph’s own
read ordering: the PoaGraph::new seed is index 0 and each
PoaGraph::add_read call follows in order. The free-function
crate::consensus_multi wrapper translates these back to the input
slice’s indexing; when calling this method directly the add-order
indexing is left as-is.