From 812d9412012db6ebf160a88fd467bb1ee2dc9adc Mon Sep 17 00:00:00 2001 From: AroneyS Date: Thu, 23 Nov 2023 14:16:30 +1000 Subject: [PATCH] Implement method_name() in PreclusterDistanceFinder --- src/cluster_argument_parsing.rs | 8 ++++++++ src/dashing.rs | 4 ++++ src/finch.rs | 4 ++++ src/lib.rs | 2 ++ src/skani.rs | 4 ++++ 5 files changed, 22 insertions(+) diff --git a/src/cluster_argument_parsing.rs b/src/cluster_argument_parsing.rs index 6f9c205..222ed42 100644 --- a/src/cluster_argument_parsing.rs +++ b/src/cluster_argument_parsing.rs @@ -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 { diff --git a/src/dashing.rs b/src/dashing.rs index c0986c3..26e7060 100644 --- a/src/dashing.rs +++ b/src/dashing.rs @@ -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( diff --git a/src/finch.rs b/src/finch.rs index ddacd3e..cd7554f 100644 --- a/src/finch.rs +++ b/src/finch.rs @@ -17,6 +17,10 @@ impl PreclusterDistanceFinder for FinchPreclusterer { self.kmer_length, ) } + + fn method_name(&self) -> &str { + "finch" + } } pub fn distances( diff --git a/src/lib.rs b/src/lib.rs index 8a1e1a6..0aada20 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 { diff --git a/src/skani.rs b/src/skani.rs index fddefd3..89149f4 100644 --- a/src/skani.rs +++ b/src/skani.rs @@ -24,6 +24,10 @@ impl PreclusterDistanceFinder for SkaniPreclusterer { self.min_aligned_threshold, ) } + + fn method_name(&self) -> &str { + "skani" + } } fn precluster_skani(