Skip to content

Commit a1e4dcd

Browse files
committed
refactor(multiplex-quant): use forward/reverse for --sample-bc-ori
Per design discussion: keep the CLI vocabulary consistent with the chemistry preset JSON (`sample_bc_ori: "forward" | "reverse"`) and with alevin-fry's own `--sample-bc-ori` flag (also `forward` / `reverse`). Drop the `fw`/`rev` shorthand and the in-process translation layer.
1 parent e46c2bc commit a1e4dcd

2 files changed

Lines changed: 15 additions & 19 deletions

File tree

src/simpleaf_commands.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -573,13 +573,14 @@ pub struct MultiplexQuantOpts {
573573
#[arg(long, default_value = "both")]
574574
pub expected_ori: String,
575575

576-
/// Sample barcode orientation: `fw` (whitelist matches read as-is) or `rev`
577-
/// (reverse-complement the whitelist before lookup). Overrides the chemistry
578-
/// preset's `sample_bc_ori` when set. Useful for cycle-plan variants (e.g.
579-
/// 10x Flex Configuration B) where the sample BC is read off the opposite
580-
/// strand from the canonical preset. Shorthand mirrors `--expected-ori`.
576+
/// Sample barcode orientation: `forward` (whitelist matches read as-is) or
577+
/// `reverse` (reverse-complement the whitelist before lookup). Overrides
578+
/// the chemistry preset's `sample_bc_ori` when set. Useful for cycle-plan
579+
/// variants (e.g. 10x Flex Configuration B) where the sample BC is read
580+
/// off the opposite strand from the canonical preset. Vocabulary matches
581+
/// the preset JSON and alevin-fry's `--sample-bc-ori`.
581582
#[arg(long,
582-
value_parser = clap::builder::PossibleValuesParser::new(["fw", "rev"]))]
583+
value_parser = clap::builder::PossibleValuesParser::new(["forward", "reverse"]))]
583584
pub sample_bc_ori: Option<String>,
584585

585586
/// Sample barcode correction mode

src/simpleaf_commands/multiplex_quant.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -404,21 +404,16 @@ pub fn multiplex_map_and_quant(af_home: &Path, opts: MultiplexQuantOpts) -> anyh
404404
.arg(format!("{}", opts.min_reads));
405405

406406
// Forward the sample-barcode orientation to alevin-fry. Precedence:
407-
// 1. user-supplied --sample-bc-ori CLI override (`fw`/`rev` shorthand,
408-
// mirroring --expected-ori; translated to alevin-fry's
409-
// `forward`/`reverse` vocabulary below).
410-
// 2. the chemistry preset's declared sample_bc_ori string (passed as-is;
411-
// already `forward` / `reverse` in the JSON).
407+
// 1. user-supplied --sample-bc-ori CLI override (`forward` / `reverse`,
408+
// matching alevin-fry's vocabulary and the preset JSON).
409+
// 2. the chemistry preset's declared sample_bc_ori (e.g. 10x Flex v2
410+
// where the whitelist is the RC of what appears on the read).
412411
// 3. omit the flag (alevin-fry default).
413-
let sbc_ori_override = match opts.sample_bc_ori.as_deref() {
414-
Some("fw") => Some("forward"),
415-
Some("rev") => Some("reverse"),
416-
Some(_) => unreachable!("clap PossibleValuesParser restricts to fw/rev"),
417-
None => chem
418-
.as_ref()
412+
let sbc_ori_override = opts.sample_bc_ori.as_deref().or_else(|| {
413+
chem.as_ref()
419414
.and_then(|c| c.sample_bc_list.as_ref())
420-
.and_then(|s| s.sample_bc_ori.as_deref()),
421-
};
415+
.and_then(|s| s.sample_bc_ori.as_deref())
416+
});
422417
if let Some(ori) = sbc_ori_override {
423418
gpl_cmd.arg("--sample-bc-ori").arg(ori);
424419
}

0 commit comments

Comments
 (0)