pub struct MLdBG {
    pub kmer_size: usize,
    pub ldbgs: Vec<LdBG>,
    pub scores: HashMap<Vec<u8>, f32>,
}Expand description
Represents a multi-color linked de Bruijn graph, all built with same k-mer size.
Fields§
§kmer_size: usize§ldbgs: Vec<LdBG>§scores: HashMap<Vec<u8>, f32>Implementations§
Source§impl MLdBG
 
impl MLdBG
Sourcepub fn from_ldbgs(ldbgs: Vec<LdBG>) -> Self
 
pub fn from_ldbgs(ldbgs: Vec<LdBG>) -> Self
Create an MLdBG from a vector of LdBGs.
§Arguments
- ldbgs- A vector of- LdBGs.
§Returns
A new MLdBG.
§Panics
This function will panic if the kmer_size of the LdBG being added does not match the
kmer_size of the MLdBG. Specifically, it will panic at the assert! statement if the
condition ldbg.kmer_size == self.kmer_size is not met.
Sourcepub fn insert(&mut self, index: usize, ldbg: LdBG)
 
pub fn insert(&mut self, index: usize, ldbg: LdBG)
Insert a LdBG at a specific position in the MLdBG.
Sourcepub fn append_from_file(&mut self, name: String, seq_path: &PathBuf)
 
pub fn append_from_file(&mut self, name: String, seq_path: &PathBuf)
Append an LdBG to the end of the MLdBG, created anew from a fasta file.
Sourcepub fn append_from_filtered_file<F>(
    &mut self,
    name: String,
    seq_path: &PathBuf,
    filter: F,
)
 
pub fn append_from_filtered_file<F>( &mut self, name: String, seq_path: &PathBuf, filter: F, )
Append an LdBG to the end of the MLdBG, created from a filtered set of
sequences in a fasta file.
This function reads sequences from a specified fasta file, filters them based on a provided
condition, and then creates an LdBG from the filtered sequences. The new LdBG is appended to
the MLdBG.
§Arguments
- name- A string representing the name of the new- LdBG.
- seq_path- A reference to a- PathBufrepresenting the path to the fasta file containing the sequences.
- filter- A closure that takes a fasta record and a set of kmers and returns a boolean indicating whether the record should be included.
§Panics
This function will panic if it cannot read the fasta file.
Sourcepub fn score_kmers(self, model_path: &PathBuf) -> Self
 
pub fn score_kmers(self, model_path: &PathBuf) -> Self
Scores the k-mers in the MLdBG using a pre-trained Gradient Boosting
Decision Tree (GBDT) model.
This function loads a GBDT model from the specified path and uses it to predict scores
for each k-mer in the union of k-mers from all LdBGs in the MLdBG. The scores are stored
in the scores field of the MLdBG.
§Arguments
- model_path- A path to the file containing the pre-trained- GBDTmodel.
§Returns
An updated MLdBG with the k-mer scores populated.
§Panics
This function will panic if the model file cannot be loaded or if the prediction fails.
pub fn collapse(&mut self) -> LdBG
Sourcepub fn filter_reads<F>(&mut self, seq_path: &PathBuf, filter: F) -> Vec<Vec<u8>>
 
pub fn filter_reads<F>(&mut self, seq_path: &PathBuf, filter: F) -> Vec<Vec<u8>>
Filter reads from a fasta file based on a condition.
§Arguments
- seq_path- A path to the fasta file containing the reads.
- filter- A closure that takes a fasta record and a set of kmers and returns a boolean.
§Returns
A vector of the kept reads.
§Panics
This function will panic if it cannot read the fasta file.
Sourcepub fn union_of_kmers(&self) -> HashSet<Vec<u8>>
 
pub fn union_of_kmers(&self) -> HashSet<Vec<u8>>
Get the union of kmers from all LdBGs in the MLdBG.
Sourcepub fn get(&self, index: usize) -> Option<&LdBG>
 
pub fn get(&self, index: usize) -> Option<&LdBG>
Get a reference to the LdBG at a specific index.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MLdBG
impl RefUnwindSafe for MLdBG
impl Send for MLdBG
impl Sync for MLdBG
impl Unpin for MLdBG
impl UnwindSafe for MLdBG
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
 
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
 
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
    SS: SubsetOf<SP>,
 
impl<SS, SP> SupersetOf<SS> for SPwhere
    SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
 
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
 
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
 
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
 
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.