Skip to content

Commit bead653

Browse files
committed
support modern bbmerge in real-data benchmarks
Resolve bbmerge before the legacy bbmerge.sh so current BBTools installs work without extra configuration, while still allowing BBMERGE_BIN overrides for custom environments. Update the benchmark README and tools.env example to reflect the modern binary name. Make the BBMerge command line work with the Pixi BBTools wrapper by disabling Java assertions and allowing output overwrites during Hyperfine warmups and repeated runs. Also tolerate Hyperfine's null stddev field for one-run smoke benchmarks.
1 parent f53a4d9 commit bead653

3 files changed

Lines changed: 32 additions & 5 deletions

File tree

‎benches/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Required tools:
99
- `hyperfine`
1010
- `curl`
1111
- `fastp`
12-
- `bbmerge.sh`
12+
- `bbmerge` or legacy `bbmerge.sh`
1313
- `vsearch`
1414
- `pairasm`, usually built with `cargo build --release`
1515

‎benches/config/tools.env.example‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
PAIRASM_BIN="target/release/pairasm"
44
FASTP_BIN="fastp"
55
VSEARCH_BIN="vsearch"
6-
BBMERGE_BIN="bbmerge.sh"
6+
BBMERGE_BIN="bbmerge"
77
HYPERFINE_BIN="hyperfine"

‎benches/src/main.rs‎

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ struct HyperfineReport {
172172
#[derive(Debug, Deserialize)]
173173
struct HyperfineResult {
174174
mean: f64,
175-
stddev: f64,
175+
stddev: Option<f64>,
176176
median: f64,
177177
min: f64,
178178
max: f64,
@@ -304,7 +304,7 @@ impl ToolPaths {
304304
Ok(Self {
305305
pairasm: resolve_pairasm(&file_env)?,
306306
fastp: resolve_tool("FASTP_BIN", "fastp", &file_env)?,
307-
bbmerge: resolve_tool("BBMERGE_BIN", "bbmerge.sh", &file_env)?,
307+
bbmerge: resolve_tool_any("BBMERGE_BIN", &["bbmerge", "bbmerge.sh"], &file_env)?,
308308
vsearch: resolve_tool("VSEARCH_BIN", "vsearch", &file_env)?,
309309
hyperfine: resolve_tool("HYPERFINE_BIN", "hyperfine", &file_env)?,
310310
})
@@ -389,6 +389,27 @@ fn resolve_tool(
389389
.ok_or_else(|| color_eyre::eyre::eyre!("required benchmark tool not found: {configured}"))
390390
}
391391

392+
fn resolve_tool_any(
393+
key: &str,
394+
default_names: &[&str],
395+
file_env: &BTreeMap<String, String>,
396+
) -> Result<PathBuf> {
397+
if let Some(configured) = env_or_file(key, file_env) {
398+
return resolve_tool(key, &configured, file_env);
399+
}
400+
401+
for default_name in default_names {
402+
if let Some(path) = find_on_path(OsStr::new(default_name)) {
403+
return Ok(path);
404+
}
405+
}
406+
407+
bail!(
408+
"required benchmark tool not found: set {key} or install one of: {}",
409+
default_names.join(", ")
410+
)
411+
}
412+
392413
fn find_on_path(binary: &OsStr) -> Option<PathBuf> {
393414
let path_var = env::var_os("PATH")?;
394415
env::split_paths(&path_var)
@@ -726,7 +747,7 @@ fn run_tool(
726747
options.output_compression,
727748
result.mean,
728749
result.median,
729-
result.stddev,
750+
optional_f64(result.stddev),
730751
result.min,
731752
result.max,
732753
result.user,
@@ -740,6 +761,10 @@ fn run_tool(
740761
Ok(())
741762
}
742763

764+
fn optional_f64(value: Option<f64>) -> String {
765+
value.map(|value| value.to_string()).unwrap_or_default()
766+
}
767+
743768
fn build_tool_command(
744769
paths: &ToolPaths,
745770
options: &RunOptions,
@@ -809,6 +834,7 @@ fn build_tool_command(
809834
],
810835
Tool::Bbmerge => vec![
811836
binary,
837+
"-da".to_owned(),
812838
format!("in1={r1}"),
813839
format!("in2={r2}"),
814840
format!("out={merged}"),
@@ -821,6 +847,7 @@ fn build_tool_command(
821847
out_dir.join("bbmerge.unmerged2.fastq").display()
822848
),
823849
format!("threads={}", options.threads),
850+
"ow=t".to_owned(),
824851
],
825852
Tool::Vsearch => vec![
826853
binary,

0 commit comments

Comments
 (0)