feat(kdist-calibrate): --from-dada post-inference mode#61
Merged
Conversation
Adds a third mode to the hidden `kdist-calibrate` subcommand that operates on `dada` output instead of derep input, so every pairwise comparison is labelled by what inference actually decided. Pairs each dada output JSON with its derep input (via --derep-dir, matched by sample name so indices line up with dada's `map`) and classifies each input unique: - member -> its own center (a real error copy denoising corrected) - failed -> nearest center (shed by the abundance test, unassigned) - center_pair -> another center (two surviving ASVs; resolution floor) Each row carries the partner center's birth_type/birth_pval, so prior-born ASVs (pseudo-pool) and births near OMEGA_A are visible in the same table. Because labels come from dada's actual abundance-p-value partition (not the nearest-more-abundant proxy of --nearest-parent), this is the ground-truth version of the headroom question, and the failed class is a population the proxy can't see. Verbose output breaks the failed class down by abundance: failed singletons (which can never seed an ASV under the default >=2-read rule, toggled by --detect-singletons) are reported separately from genuinely distant uniques, with the within/beyond-cutoff split. Documents the mode, columns, prior-tracing recipe, and the `failed != distant noise` caveat in docs/diagnostics.md. 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.
Summary
Adds a third mode to the hidden
kdist-calibratediagnostic —--from-dada— that operates ondadaoutput instead of derep input, so every pairwise comparison is labelled by what inference actually decided rather than by what the screen saw beforehand.Each
dadaoutput JSON is paired with its derep input (via--derep-dir, matched by sample name so indices line up with dada'smap), and every input unique is classified and aligned against the relevant cluster center:classmemberfailedmap == null), unassignedcenter_pairEach row carries the partner center's
birth_type/birth_pval, so prior-born ASVs (pseudo-pool) and births nearOMEGA_Aare visible in the same table.Why
--nearest-parent— this is the ground-truth version of the headroom question, and thefailedclass is a population the proxy can't see at all.dada-pseudo, filter onbirth_type == Priorto see which ASVs exist only because a cross-sample prior rescued them pastOMEGA_P, and how close each sits to the nearest abundance-born survivor.birth_pvalsorts every ASV by how confident its split was.failed≠ distant noiseVerbose output splits the
failedclass by abundance. Failed singletons (which can never seed an ASV under the default≥2 readsrule, toggled by--detect-singletons) are reported separately from genuinely distant uniques, with the within/beyond-cutoff split:On the test sample all 59 failed uniques are singletons — so "didn't survive" is the read-count tradeoff, not screen distance. The within-cutoff singletons are plausible error copies / real low-abundance variants that just lacked a second read.
Testing
Ran end-to-end on real data (
dadaanddada-pseudo, single- and multi-sample). Builds,cargo clippy, andcargo fmtall clean; pre-commit hooks pass.Docs
docs/diagnostics.mddocuments the mode, CSV columns, the prior-tracing recipe, the verbose failed-class breakdown, and thefailed != distant noisecaveat pointing at--detect-singletons.🤖 Generated with Claude Code