fix(annotations): preserve negative transmembrane predictions - #406
fix(annotations): preserve negative transmembrane predictions#406FlorinSenoner wants to merge 8 commits into
Conversation
|
CI blocker: the required Bundle format contract check fails before installing dependencies or running this PR's code. |
| elif has_beta: | ||
| return "beta-barrel" | ||
| return "none" | ||
| return "non-transmembrane" |
There was a problem hiding this comment.
[P1] Preserve missing TMbed payloads
biocentral-api 1.2.1 declares Prediction.value as optional. On this head, constructing its real Prediction model with value=None or value="" reaches topology = "" above and this line returns non-transmembrane for both cases. That invents a completed negative biological prediction when TMbed supplied no payload, violating the new OpenSpec scenario that unavailable predictions remain missing. Please return "" before scanning when pred.value is absent/empty (and add focused None/empty-payload tests plus a contract assertion that the missing row stays N/A).
There was a problem hiding this comment.
Fixed in 5ec9fe2. The extractor now returns the established missing representation when the real Biocentral Prediction.value is None or empty, before scanning topology labels. Added focused real-model tests for both payloads and generated-bundle contract coverage proving the indexed missing value reaches TypeScript as NA, while a completed non-empty inside/outside topology remains non-transmembrane. Fresh local results: focused 16 passed, bundle contract 13 passed, full ProtSpace suite 789 passed (6 deselected), Ruff clean, strict OpenSpec valid, and pnpm precommit passed.
Automated reviewDoes it solve #339? Yes — I confirmed the root cause against the reporter's bundle: Found 2 issues:
protspace/apps/protspace/src/protspace/cli/annotate.py Lines 98 to 104 in 5ec9fe2
🤖 Generated with Claude Code |
|
Verified independently against current head
Neither case is addressed on this head. Current CI is green, but its existing tests do not exercise these paths. |
|
Implemented both actionable items in
Fresh verification: focused Python 19 passed; hosted-prep full suite passed; ProtSpace non-slow suite 792 passed, 6 deselected; bundle contract 14 passed; Ruff clean; strict OpenSpec valid; |
| return "" | ||
| if pred.value is None or pred.value == "": | ||
| return None | ||
| return str(pred.value) |
There was a problem hiding this comment.
[P2] Reject malformed TMbed payloads before deriving categories
biocentral-api 1.2.1 generates Prediction.value as Optional[Any], so the real model accepts non-string values. The new str() fallback makes them look like topology: in a fresh reproduction, 0, [], {}, and whitespace all produced signal peptide False plus non-transmembrane; b"abc" and "garbage" even produced beta-barrel because their string representations contain b. Those are malformed/unavailable payloads, not completed negative calls. Please require a non-blank string containing only supported TMbed topology labels before returning it (otherwise preserve missing), with real-model and bundle-visible regressions for malformed payloads.
There was a problem hiding this comment.
Fixed in a30032a. The shared extractor now accepts only non-empty strings composed of supported TMbed labels (B/b, H/h, S, i/o, .); non-string, blank, and unsupported payloads remain missing for both derived annotations. Added real generated-model coverage for zero/list/dict/blank/bytes/unsupported text plus a generated-bundle assertion that malformed signal/transmembrane values reach TypeScript as N/A. Fresh verification: focused 26 passed, contract 15 passed, full ProtSpace 799 passed (6 deselected), hosted-prep full suite passed, Ruff, strict OpenSpec, and pnpm precommit passed.
| - **AND** the derived signal-peptide annotation is also exposed as `N/A` rather than | ||
| `False` | ||
|
|
||
| ### Requirement: FASTA annotation inputs retain their sequences |
There was a problem hiding this comment.
[P2] Keep the FASTA-input contract in its own capability
This delta lives under bundle-format-contract, whose canonical spec is explicitly scoped to .parquetbundle layout, encoding, fixture behavior, and the cross-language CI boundary. Lines 34–45 specify standalone protspace annotate input behavior instead, so archiving this change would put an unrelated runtime requirement into the bundle-format source of truth even though strict validation passes. Please move this requirement to a dedicated annotation-input/producer capability within the same change and update the proposal capability list accordingly.
There was a problem hiding this comment.
Fixed in a30032a. The FASTA sequence requirement now lives only under the annotation-input capability delta in the existing change; bundle-format-contract retains only the producer/bundle/TypeScript output contract. The proposal declares annotation-input under New Capabilities, and strict OpenSpec validation passes.
- Replace the re.search([Hh])/([Bb]) topology probes in BiocentralPredictionRetriever._extract_transmembrane with plain substring membership tests, and drop the now-unused `import re`. - Re-pad the Biocentral annotation table in apps/protspace/docs/annotations.md so every Description cell is 47 characters wide again; apps/protspace/ is prettier-ignored, so the column alignment has to be maintained by hand. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016qoU16kDQxz6U3H2UWbbm2
Adversarial reviewReviewed in an isolated worktree by three independent lenses (code quality, adversarial correctness, issue-resolution audit), with every finding then put through a refuter whose default position was that it is a false positive. 9 raised, 4 survived refutation. Applied and pushed (
|
|
Addressed the actionable items from the 2026-08-06 review in
Red/green evidence: the new source-precedence and sequence-free CLI tests first failed with InterPro receiving |
Root cause
Biocentral TMbed emitted the valid negative category
none, while the web bundle consumer intentionally reservesnoneas a missing-value sentinel. Completed negative predictions were therefore normalized to N/A and became indistinguishable from absent predictions.Fix
non-transmembranefor completed TMbed predictions with no alpha-helical or beta-barrel segment.Reproduction and verification
Using the issue attachments, the original 149-protein bundle displayed
N/A: 149for Transmembrane even though its annotation table contained 37nonepredictions and 112 empty values. A regenerated validation bundle now displaysnon-transmembrane: 37andN/A: 112, with no browser warnings or errors.Tests
pytest apps/protspace/tests/test_biocentral_retriever.py -q— 14 passedruff checkandruff format --checkforapps/protspace— passedpytest -m "not slow" -q— 787 passed, 6 deselectedpnpm precommit— passed before commit and pushopenspec validate fix-biocentral-transmembrane-sentinel --strict— passedCloses #339