Follow-up to the module reorg in #66 (LOESS → loess.rs, WFA → wfa.rs, lib crate introduced). That pass deliberately left the two largest files untouched to keep the diff reviewable. This issue tracks the remaining structural cleanup.
main.rs (~4.6k lines)
It's a god-file: CLI dispatch plus the full inline orchestration for all ~21 Commands::X subcommands plus ~20 helpers. With the dada2_rs lib crate now in place (#66), command handlers can move out cleanly.
Options considered previously:
- Grouped handlers (recommended starting point): group related commands into a few modules — e.g.
commands/dada.rs (dada / dada-pooled / dada-pseudo), commands/chimera.rs, commands/taxonomy.rs (assign-taxonomy / assign-species / tax-to-tsv), commands/seqtable.rs (make-sequence-table / seqtable-to-tsv|fasta), commands/errors.rs (learn-errors / errors-from-sample / kdist-calibrate). main.rs shrinks to argument parsing + dispatch.
- Full per-command modules (
src/commands/<name>.rs per arm) — cleanest end state, most churn.
Constraint: keep each handler's logic behavior-preserving; verify with the existing concordance/parity tests + byte-identical outputs.
cli.rs (~2.2k lines)
Structurally fine (clap Commands enum + arg structs) but large. Lower priority — consider splitting the clap definitions per command group only if it aids navigation, or leave as-is.
Acceptance
- No behavior change (byte-identical outputs; full test suite green on default and
--features wfa).
main.rs reduced to dispatch + shared helpers.
- No performance regression (hot code already lives in the lib crate).
Follow-up to the module reorg in #66 (LOESS →
loess.rs, WFA →wfa.rs, lib crate introduced). That pass deliberately left the two largest files untouched to keep the diff reviewable. This issue tracks the remaining structural cleanup.main.rs(~4.6k lines)It's a god-file: CLI dispatch plus the full inline orchestration for all ~21
Commands::Xsubcommands plus ~20 helpers. With thedada2_rslib crate now in place (#66), command handlers can move out cleanly.Options considered previously:
commands/dada.rs(dada / dada-pooled / dada-pseudo),commands/chimera.rs,commands/taxonomy.rs(assign-taxonomy / assign-species / tax-to-tsv),commands/seqtable.rs(make-sequence-table / seqtable-to-tsv|fasta),commands/errors.rs(learn-errors / errors-from-sample / kdist-calibrate).main.rsshrinks to argument parsing + dispatch.src/commands/<name>.rsper arm) — cleanest end state, most churn.Constraint: keep each handler's logic behavior-preserving; verify with the existing concordance/parity tests + byte-identical outputs.
cli.rs(~2.2k lines)Structurally fine (clap
Commandsenum + arg structs) but large. Lower priority — consider splitting the clap definitions per command group only if it aids navigation, or leave as-is.Acceptance
--features wfa).main.rsreduced to dispatch + shared helpers.