feat(dada): add --failed-uniques diagnostic (issue #60)#62
Merged
Conversation
Emit the unique sequences that failed to denoise (final p-value < omega_c, `map == null`) as a tidy long-format TSV (`sequence<TAB>sample<TAB>reads`, one row per failed unique per sample), so users can answer "what failed to denoise and how many reads did it cost?" without hand-joining the dada `map` to the derep uniques. Motivated by benjjneb/dada2#1899. Available on `dada`, `dada-pseudo`, and `dada-pooled`, with semantics that follow the subcommand: `dada`/`dada-pseudo` report per-sample failures (`map == null`, decided in pseudo's round-2 pass); `dada-pooled` reports global failures (`result.map == null` on the merged unique table), expanded to one row per sample the failed merged unique appears in. The pooled per-sample-`map`-null ambiguity noted in the issue is unreachable: a unique present in a sample always carries >=1 read into its cluster, so a per-sample `map == null` always means a genuine denoising failure. - new module src/failed_uniques.rs (Row + write_tsv, deterministic sort) - denoise_and_serialize returns (json, Vec<Row>) gated by collect_failed - integration test: dada_failed_uniques_matches_map_nulls - docs/diagnostics.md: new --failed-uniques section Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #60.
What
Adds
--failed-uniques <FILE>todada,dada-pseudo, anddada-pooled. It emits the unique sequences that failed to denoise (final p-value <omega_c,map == null— R's$map == NA) as a tidy long-format TSV:One row per failed unique per sample it appears in, with the reads it cost. This answers "what failed to denoise and how many reads did it cost?" without hand-joining the dada
mapto the derep uniques. Motivated by benjjneb/dada2#1899.Semantics follow the subcommand
readsisdada,dada-pseudomap == null; for pseudo, in the round-2 pass)dada-pooledresult.map == nullon the merged unique table)Rows are sorted by sample / descending reads / sequence, so output is deterministic regardless of concurrent denoising order.
Note on the issue's caveat
The issue flagged that a pooled per-sample
mapnull could mean either a denoising failure or a cluster with zero reads in that sample. That second case is unreachable: a unique present in a sample always carries ≥1 read into its cluster, so a per-samplemap == nullalways means a genuine denoising failure. The TSV reports only real failures.Changes
src/failed_uniques.rs(Row+write_tsv, deterministic sort)denoise_and_serializereturns(json, Vec<Row>)gated by acollect_failedbooldada, bothdada-pseudoround-2 closures, and thedada-pooledoutput loopdada_failed_uniques_matches_map_nulls(TSV row count ≡ JSONmapnull count)docs/diagnostics.md: new--failed-uniquessection, cross-linked tokdist-calibrate --from-dadaTesting
mapnull count exactly🤖 Generated with Claude Code