pub struct DeBruijnGraph { /* private fields */ }Expand description
A node-centric De Bruijn graph built from k-mers.
Each k-mer is an edge from its (k-1)-prefix to its (k-1)-suffix. Nodes are the (k-1)-mers; edges are the original k-mers.
Implementations§
Source§impl DeBruijnGraph
impl DeBruijnGraph
Sourcepub fn from_sequences(sequences: &[&[u8]], k: usize) -> Result<Self>
pub fn from_sequences(sequences: &[&[u8]], k: usize) -> Result<Self>
Build a De Bruijn graph from a set of input sequences.
Extracts all k-mers from each sequence and adds them as edges. Bases are uppercased; only A/C/G/T bases are accepted.
§Errors
Returns an error if k < 2, any sequence is shorter than k,
or a sequence contains non-ACGT characters.
Sourcepub fn from_kmers(kmers: &[&[u8]]) -> Result<Self>
pub fn from_kmers(kmers: &[&[u8]]) -> Result<Self>
Build a De Bruijn graph from pre-extracted k-mers.
All k-mers must have the same length (≥ 2).
§Errors
Returns an error if the k-mer slice is empty or k-mers differ in length.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of distinct (k-1)-mer nodes in the graph.
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Number of k-mer edges in the graph (including duplicates).
Sourcepub fn contains_kmer(&self, kmer: &[u8]) -> bool
pub fn contains_kmer(&self, kmer: &[u8]) -> bool
Check whether a specific k-mer exists as an edge in the graph.
Trait Implementations§
Source§impl Clone for DeBruijnGraph
impl Clone for DeBruijnGraph
Source§fn clone(&self) -> DeBruijnGraph
fn clone(&self) -> DeBruijnGraph
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more