Skip to main content

PoaGraph

Struct PoaGraph 

Source
pub struct PoaGraph { /* private fields */ }

Implementations§

Source§

impl PoaGraph

Source

pub fn new(seed: &[u8], config: PoaConfig) -> Result<Self, PoaError>

Source

pub fn add_read(&mut self, read: &[u8]) -> Result<(), PoaError>

Source

pub fn consensus(&self) -> Result<Consensus, PoaError>

Source

pub fn stats(&self) -> GraphStats

Source

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).

Source

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.

Source

pub fn node_coverages(&self) -> Vec<u32>

Return per-node coverage in topological order.

Source

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.

Source

pub fn align_read_ops_unbanded( &self, read: &[u8], ) -> Result<(Vec<AlignOp>, Vec<usize>), PoaError>

Like [align_read_ops] but kept for compatibility.

Source

pub fn node_count(&self) -> usize

Number of nodes currently in the graph.

Source

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.

Source

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().

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.