From 92a38c4e0182e38a973be236aff76d496a43d5b7 Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Mon, 4 Nov 2024 08:04:15 -0800 Subject: [PATCH 1/2] rename internal file & functions to use 'rocksdb' --- ...ff_manygather.rs => fastmultigather_rocksdb.rs} | 4 ++-- src/lib.rs | 14 +++++++------- ...mastiff_manysearch.rs => manysearch_rocksdb.rs} | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) rename src/{mastiff_manygather.rs => fastmultigather_rocksdb.rs} (98%) rename src/{mastiff_manysearch.rs => manysearch_rocksdb.rs} (98%) diff --git a/src/mastiff_manygather.rs b/src/fastmultigather_rocksdb.rs similarity index 98% rename from src/mastiff_manygather.rs rename to src/fastmultigather_rocksdb.rs index 4d15f696..99ccb42c 100644 --- a/src/mastiff_manygather.rs +++ b/src/fastmultigather_rocksdb.rs @@ -1,4 +1,4 @@ -/// mastiff_manygather: mastiff-indexed version of fastmultigather. +/// fastmultigather_rocksdb: rocksdb-indexed version of fastmultigather. use anyhow::Result; use camino::Utf8PathBuf as PathBuf; use rayon::prelude::*; @@ -12,7 +12,7 @@ use crate::utils::{ csvwriter_thread, is_revindex_database, load_collection, BranchwaterGatherResult, ReportType, }; -pub fn mastiff_manygather( +pub fn fastmultigather_rocksdb( queries_file: String, index: PathBuf, selection: Selection, diff --git a/src/lib.rs b/src/lib.rs index 68f869af..b686b751 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,8 +18,8 @@ mod fastmultigather; mod index; mod manysearch; mod manysketch; -mod mastiff_manygather; -mod mastiff_manysearch; +mod fastmultigather_rocksdb; +mod manysearch_rocksdb; mod multisearch; mod pairwise; mod singlesketch; @@ -45,10 +45,10 @@ fn do_manysearch( let ignore_abundance = ignore_abundance.unwrap_or(false); - // if siglist_path is revindex, run mastiff_manysearch; otherwise run manysearch + // if siglist_path is revindex, run rocksdb manysearch; otherwise run manysearch if is_revindex_database(&againstfile_path) { - // note: mastiff_manysearch ignores abundance automatically. - match mastiff_manysearch::mastiff_manysearch( + // note: manysearch_rocksdb ignores abundance automatically. + match manysearch_rocksdb::manysearch_rocksdb( querylist_path, againstfile_path, selection, @@ -133,9 +133,9 @@ fn do_fastmultigather( let selection = build_selection(ksize, scaled, &moltype); let allow_failed_sigpaths = true; - // if a siglist path is a revindex, run mastiff_manygather. If not, run multigather + // if a siglist path is a revindex, run rocksdb fastmultigather. If not, run multigather if is_revindex_database(&againstfile_path) { - match mastiff_manygather::mastiff_manygather( + match fastmultigather_rocksdb::fastmultigather_rocksdb( query_filenames, againstfile_path, selection.clone(), diff --git a/src/mastiff_manysearch.rs b/src/manysearch_rocksdb.rs similarity index 98% rename from src/mastiff_manysearch.rs rename to src/manysearch_rocksdb.rs index ba0d7559..f0c54243 100644 --- a/src/mastiff_manysearch.rs +++ b/src/manysearch_rocksdb.rs @@ -1,4 +1,4 @@ -/// mastiff_manysearch: mastiff-indexed version of manysearch. +/// manysearch_rocksdb: rocksdb-indexed version of manysearch. use anyhow::Result; use camino::Utf8PathBuf as PathBuf; use log::debug; @@ -15,7 +15,7 @@ use crate::utils::{ csvwriter_thread, is_revindex_database, load_collection, ReportType, SearchResult, }; -pub fn mastiff_manysearch( +pub fn manysearch_rocksdb( queries_path: String, index: PathBuf, selection: Selection, From 4a47b9863d3acf47fbc1e4708e645847b92af723 Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Mon, 4 Nov 2024 08:19:32 -0800 Subject: [PATCH 2/2] fix fmt and clippy --- src/fastmultigather.rs | 3 ++- src/lib.rs | 5 +++-- src/multisearch.rs | 2 +- src/singlesketch.rs | 2 +- src/utils/mod.rs | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/fastmultigather.rs b/src/fastmultigather.rs index fa5295f8..6d3f57a7 100644 --- a/src/fastmultigather.rs +++ b/src/fastmultigather.rs @@ -25,6 +25,7 @@ use crate::utils::{ consume_query_by_gather, load_collection, write_prefetch, PrefetchResult, ReportType, }; +#[allow(clippy::too_many_arguments)] pub fn fastmultigather( query_filepath: String, against_filepath: String, @@ -48,7 +49,7 @@ pub fn fastmultigather( let scaled = match scaled { Some(s) => s, None => { - let scaled = query_collection.max_scaled().expect("no records!?").clone() as usize; + let scaled = *query_collection.max_scaled().expect("no records!?") as usize; eprintln!( "Setting scaled={} based on max scaled in query collection", scaled diff --git a/src/lib.rs b/src/lib.rs index b686b751..0edd5081 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,11 +15,11 @@ mod check; mod cluster; mod fastgather; mod fastmultigather; +mod fastmultigather_rocksdb; mod index; mod manysearch; -mod manysketch; -mod fastmultigather_rocksdb; mod manysearch_rocksdb; +mod manysketch; mod multisearch; mod pairwise; mod singlesketch; @@ -28,6 +28,7 @@ use camino::Utf8PathBuf as PathBuf; #[pyfunction] #[pyo3(signature = (querylist_path, siglist_path, threshold, ksize, scaled, moltype, output_path=None, ignore_abundance=false))] +#[allow(clippy::too_many_arguments)] fn do_manysearch( querylist_path: String, siglist_path: String, diff --git a/src/multisearch.rs b/src/multisearch.rs index f668dca0..f1045ddb 100644 --- a/src/multisearch.rs +++ b/src/multisearch.rs @@ -34,7 +34,7 @@ pub fn multisearch( let scaled = match selection.scaled() { Some(s) => s, None => { - let scaled = query_collection.max_scaled().expect("no records!?").clone() as u32; + let scaled = *query_collection.max_scaled().expect("no records!?") as u32; eprintln!( "Setting scaled={} based on max scaled in query collection", scaled diff --git a/src/singlesketch.rs b/src/singlesketch.rs index 546665b9..12231c9d 100644 --- a/src/singlesketch.rs +++ b/src/singlesketch.rs @@ -34,7 +34,7 @@ pub fn singlesketch( }; // Build signature templates based on parsed parameters and detected moltype - let mut sigs = crate::manysketch::build_siginfo(¶ms_vec, &moltype); + let mut sigs = crate::manysketch::build_siginfo(¶ms_vec, moltype); if sigs.is_empty() { bail!("No signatures to build for the given parameters."); diff --git a/src/utils/mod.rs b/src/utils/mod.rs index a29b794e..9791ae6e 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -737,7 +737,7 @@ pub fn branchwater_calculate_gather_stats( // If abundance, calculate abund-related metrics (vs current query) if calc_abund_stats { // take abunds from subtracted query - let (abunds, unique_weighted_found) = match match_mh.inflated_abundances(&query) { + let (abunds, unique_weighted_found) = match match_mh.inflated_abundances(query) { Ok((abunds, unique_weighted_found)) => (abunds, unique_weighted_found), Err(e) => return Err(e.into()), };