Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MRG: rename internal file & functions to use 'rocksdb' #494

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/fastmultigather.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/mastiff_manygather.rs → src/fastmultigather_rocksdb.rs
Original file line number Diff line number Diff line change
@@ -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::*;
Expand All @@ -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,
Expand Down
15 changes: 8 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ mod check;
mod cluster;
mod fastgather;
mod fastmultigather;
mod fastmultigather_rocksdb;
mod index;
mod manysearch;
mod manysearch_rocksdb;
mod manysketch;
mod mastiff_manygather;
mod mastiff_manysearch;
mod multisearch;
mod pairwise;
mod singlesketch;
Expand All @@ -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,
Expand All @@ -45,10 +46,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,
Expand Down Expand Up @@ -133,9 +134,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(),
Expand Down
4 changes: 2 additions & 2 deletions src/mastiff_manysearch.rs → src/manysearch_rocksdb.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/multisearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/singlesketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn singlesketch(
};

// Build signature templates based on parsed parameters and detected moltype
let mut sigs = crate::manysketch::build_siginfo(&params_vec, &moltype);
let mut sigs = crate::manysketch::build_siginfo(&params_vec, moltype);

if sigs.is_empty() {
bail!("No signatures to build for the given parameters.");
Expand Down
2 changes: 1 addition & 1 deletion src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
};
Expand Down
Loading