Repository navigation
feat(eval): turn cafaeval's per-protein vectors into a joinable table - #784
Merged
Merged
Conversation
Three of the axes this project must report, sequence length, identity to the nearest donor and taxonomic relation to it, are properties of a PROTEIN. The stored evaluation is one number per (category, aspect) cell, so none of them can be recovered from it however it is sliced. That is why the board can only stratify by the two axes cafaeval happens to partition on. Adds the layer that reads a PerProteinSink and produces rows keyed by accession, so they join to protein.length and to the donor identities in go_prediction. The cafaeval pin moves to the build that can fill a sink. Three ways this could quietly produce a wrong table, each refused rather than guessed: Reading the wrong threshold column. cafaeval builds its thresholds as arange(th_step, 1, th_step); we rebuild that and assert the width matches the emitted arrays. An off-by-one would score every protein at a neighbouring threshold, which reads as a plausible number. The assertion already earned itself by catching a wrong fixture in its own test. Naming rows by the wrong protein. Two numberings are in play and the PK kernel is handed a subset, so a record without both the id map and the row index is dropped rather than written under a guess. This is the positional misalignment that cost a fortnight in the neighbour search. Emitting NaN. A protein that predicted nothing, or that has no ground truth, scores zero, because a NaN propagates into every stratum mean that contains it. Only the weighted variant is kept: f_micro_w is what every published cell here reports, and an unweighted row would be a different metric under the same column name. Parquet artifact rather than a table, so no migration is applied as a side effect of running an evaluation.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #784 +/- ##
===========================================
- Coverage 89.02% 87.66% -1.36%
===========================================
Files 246 264 +18
Lines 18669 20470 +1801
===========================================
+ Hits 16620 17945 +1325
- Misses 2049 2525 +476
🚀 New features to boost your workflow:
|
github-actions Bot
pushed a commit
that referenced
this pull request
Aug 19, 2026
…le (#785) #784 landed the transformation layer with its tests and nothing called it. This is the wiring: a sink per cafaeval invocation, and the table written beside the setting's other artefacts. ## Two decisions **Collected always**, not behind a flag. The cost is one array per namespace held for the length of the call. A flag would be off exactly when someone wants to stratify a result that has already been computed. **Never fatal.** The aggregate is the product; a supplementary table that cannot be written must not discard a sound evaluation. Both the empty and the failed case emit an event, so an absent file is distinguishable from one nobody asked for. ## Two defects found while wiring, neither in the new code **The namespace keys disagreed.** `parse_results` returns the short CAFA code (`BPO`) and the sink reports cafaeval's long namespace (`biological_process`). A mismatch produces an empty tau map, no rows, and no file, with nothing anywhere saying why. Fixed by inverting the project's own `_NS_LABELS` rather than writing a second mapping that could drift from it, with a test asserting the two still line up. **The sink import sat inside a broad `except Exception`.** An installed cafaeval without `PerProteinSink` was swallowed and reported as three settings that produced no results, so a wrong dependency version looked exactly like an evaluation that legitimately scored nothing. I hit this on my own machine: 91 driver tests failed with `cafa_eval.call_count == 0` and a green-looking run underneath. The import now sits in a helper that raises with a message naming the real problem. That second one is the reason I am flagging it here rather than fixing it quietly: I introduced it in this branch by adding an import to a protected block, which is the same failure family this work exists to remove. ## Checks 91 driver tests, 5 wiring tests, 11 transformation tests, all passing with the new dependency installed. `ruff` clean, smell budget unchanged.
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.
The layer that makes stratification possible, plus the cafaeval pin that feeds it
(frapercan/cafaeval-protea#25).
Why the board can only stratify by two axes today
Three of the axes this project is required to report are properties of a
protein: sequence length, identity to the nearest donor, taxonomic relation
to it. The stored evaluation is one number per
(category, aspect)cell, so noneof them is recoverable from it however it is sliced. Category and aspect are
reportable only because cafaeval happens to partition the ground truth on them
before aggregating.
PerProteinSinkhands over the vectors before.sum(axis=0)collapses them.This module turns one sink into rows keyed by accession, which join to
protein.lengthand toidentity_nw/taxonomic_relationingo_prediction.Three ways to be quietly wrong, each refused
Wrong threshold column. cafaeval builds thresholds as
arange(th_step, 1, th_step). We rebuild that and assert the width matches theemitted arrays rather than trusting the reconstruction; an off-by-one would score
every protein at a neighbouring threshold, which reads as a plausible number. The
assertion earned itself immediately by catching a wrong fixture in its own test.
Wrong protein. Two numberings are in play: the NK/LK kernel sees every row,
the PK kernel is handed
pred[proteins_has_gt]. A record lacking either the idmap or the row index, or whose row index length disagrees with the arrays, is
dropped rather than written under a guess. This is the positional
misalignment that cost this project a fortnight in its neighbour search.
NaN. A protein that predicted nothing, or that has no ground truth, scores
zero rather than NaN, because a NaN propagates into every stratum mean that
contains it and turns one empty cell into a blank row.
Two deliberate narrowings
Only the weighted variant is kept.
f_micro_wis what every published cellhere reports, and an unweighted row would be a different metric under the same
column name.
A parquet artifact, not a table. A table would need a migration, and
migrations here are validated offline and never applied as a side effect of
running an evaluation.
Checks
Eleven tests, one per failure mode above plus the arithmetic and a check that the
per-protein rows sum to the totals the aggregate is built from.
ruffclean,smell budget unchanged.