Skip to content

Commit

Permalink
Implement method_name() in
Browse files Browse the repository at this point in the history
PreclusterDistanceFinder
  • Loading branch information
AroneyS committed Nov 23, 2023
1 parent d888f64 commit 812d941
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/cluster_argument_parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ impl PreclusterDistanceFinder for Preclusterer {
Preclusterer::Skani(s) => s.distances(genome_fasta_paths),
}
}

fn method_name(&self) -> &str {
match self {
Preclusterer::Dashing(d) => d.method_name(),
Preclusterer::Finch(f) => f.method_name(),
Preclusterer::Skani(s) => s.method_name(),
}
}
}

pub enum Clusterer {
Expand Down
4 changes: 4 additions & 0 deletions src/dashing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ impl PreclusterDistanceFinder for DashingPreclusterer {
fn distances(&self, genome_fasta_paths: &[&str]) -> SortedPairGenomeDistanceCache {
distances(genome_fasta_paths, self.min_ani, self.threads)
}

fn method_name(&self) -> &str {
"dashing"
}
}

pub fn distances(
Expand Down
4 changes: 4 additions & 0 deletions src/finch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ impl PreclusterDistanceFinder for FinchPreclusterer {
self.kmer_length,
)
}

fn method_name(&self) -> &str {
"finch"
}
}

pub fn distances(
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ use crate::sorted_pair_genome_distance_cache::SortedPairGenomeDistanceCache;

pub trait PreclusterDistanceFinder {
fn distances(&self, genome_fasta_paths: &[&str]) -> SortedPairGenomeDistanceCache;

fn method_name(&self) -> &str;
}

pub trait ClusterDistanceFinder {
Expand Down
4 changes: 4 additions & 0 deletions src/skani.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ impl PreclusterDistanceFinder for SkaniPreclusterer {
self.min_aligned_threshold,
)
}

fn method_name(&self) -> &str {
"skani"
}
}

fn precluster_skani(
Expand Down

0 comments on commit 812d941

Please sign in to comment.