Skip to content

Commit

Permalink
better help; avoid recalc threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
bluegenes committed Aug 30, 2023
1 parent cb10883 commit 886ecc5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crate-type = ["cdylib"]
pyo3 = { version = "0.18.1", features = ["extension-module", "anyhow"] }
rayon = "1.5.1"
serde = { version = "1.0.136", features = ["derive"] }
sourmash = { git = "https://github.com/sourmash-bio/sourmash", branch = "ntp/mastiff_roaring_prot" }
sourmash = { git = "https://github.com/sourmash-bio/sourmash", "rev" = "ff1092f8f366339caa59d7203f623813228f4356" }
clap = { version = "3.1.0", features = ["derive"] }
serde_json = "1.0.79"
niffler = "2.4.0"
Expand Down
7 changes: 2 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,6 @@ fn mastiff_manysearch<P: AsRef<Path>>(
queries_file: P,
index: P,
template: Sketch,
threshold_bp: usize,
minimum_containment: f64,
output: Option<P>,
) -> Result<(), Box<dyn std::error::Error>> {
Expand Down Expand Up @@ -923,10 +922,9 @@ fn mastiff_manysearch<P: AsRef<Path>>(
if let Ok(query_sig) = Signature::from_path(filename) {
if let Some(query) = prepare_query(&query_sig, &template) {
let query_size = query.minhash.size() as f64;
let threshold = threshold_bp / query.minhash.scaled() as usize;
// search mastiff db
let counter = db.counter_for_query(&query.minhash);
let matches = db.matches_from_counter(counter, threshold);
let matches = db.matches_from_counter(counter, minimum_containment as usize);

// filter the matches for containment

Expand Down Expand Up @@ -1142,8 +1140,7 @@ fn do_manysearch(querylist_path: String,
// if siglist_path is revindex, run mastiff_manysearch; otherwise run manysearch
if is_revindex_database(siglist_path.as_ref()) {
let template = build_template(ksize, scaled);
let threshold_bp = (threshold * scaled as f64) as usize;
match mastiff_manysearch(querylist_path, siglist_path, template, threshold_bp, threshold, output_path) {
match mastiff_manysearch(querylist_path, siglist_path, template, threshold, output_path) {
Ok(_) => Ok(0),
Err(e) => {
eprintln!("Error: {e}");
Expand Down
3 changes: 2 additions & 1 deletion src/python/pyo3_branchwater/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ class Branchwater_Fastgather(CommandLinePlugin):
def __init__(self, p):
super().__init__(p)
p.add_argument('query_sig', help="metagenome sketch")
p.add_argument('against_paths', help="a text file containing paths to .sig/.sig.gz files")
p.add_argument('against_paths', help="a text file containing paths to .sig/.sig.gz files \
OR a branchwater indexed database generated with 'sourmash scripts index'")
p.add_argument('-o', '--output-gather', required=True,
help="save gather output (minimum metagenome cover) to this file")
p.add_argument('--output-prefetch',
Expand Down

0 comments on commit 886ecc5

Please sign in to comment.