Skip to content

feat: face segregation bonus in activity scoring (+AUROC 0.8348→0.8420) - #72

Merged
cschanhniem merged 2 commits into
mainfrom
feat/face-segregation-bonus
Jun 28, 2026
Merged

cschanhniem merged 2 commits into
mainfrom
feat/face-segregation-bonus

Conversation

@cschanhniem

Copy link
Copy Markdown
Collaborator

Summary

  • Adds helix_wheel_amphipathic_score × 0.05 as an eighth scoring term in activity_likeness_score(), capturing face-segregation quality (whether hydrophobic and cationic residues are properly partitioned onto opposite helical faces)
  • Benchmark improvements: pipeline AUROC 0.8348→0.8420 (+0.0072), phase3 AUROC 0.8126→0.8266 (+0.0140); AUPRC pipeline 0.8443→0.8627, phase3 0.8357→0.8479
  • Raises max_disagreement from 0.40→0.45 in both configs: face_segregation_bonus correctly raises SEED-008 Trp-rich activity scores by ~0.03, pushing their disagreement from ~0.40 to ~0.43; no non-Trp-rich candidate in the 709-sequence pool exceeds 0.41
  • 6 new tests; score ceiling test split (0.97 without hw key, 1.0 clamped with hw=1.0); all 1245 tests pass

Biological Motivation

The existing amphipathicity term measures hydrophobic moment magnitude (μH). Face segregation is complementary: it measures whether cationic residues are correctly positioned on the hydrophilic face. A peptide can have high μH from a hydrophobic cluster but place cationic residues on the hydrophobic face — which is biologically suboptimal for the membrane-disruption mechanism. The helix-wheel analysis (PR #71) already computes this; this PR wires it into scoring with conservative weight 0.05.

max_disagreement Rationale

Threshold Affected candidates Trp-rich Non-Trp-rich
>0.40 51 49 2
>0.45 1 1 0

All 49+ candidates shifted above 0.40 are SEED-008 (puroindoline-a) Trp-rich variants — a documented mechanism-divergence class, not prediction uncertainty. Raising to 0.45 accommodates them without admitting genuinely uncertain candidates.

Test Plan

🤖 Generated with Claude Code

Adds helix_wheel_amphipathic_score × 0.05 as an eighth term to
activity_likeness_score(), capturing whether hydrophobic and cationic
residues are properly segregated onto opposite helical faces. This is
orthogonal to μH (moment magnitude) — the existing amphipathicity term
measures how large the moment is; the face segregation bonus measures
whether the charge distribution is architecturally correct.

Benchmark improvement:
- pipeline AUROC: 0.8348 → 0.8420 (+0.0072)
- phase3  AUROC: 0.8126 → 0.8266 (+0.0140)
- pipeline AUPRC: 0.8443 → 0.8627
- phase3  AUPRC: 0.8357 → 0.8479

Side-effect fix: face_segregation_bonus raises SEED-008 Trp-rich
activity scores by ~0.03 (correct: their Trp clusters form a genuine
hydrophobic face), which pushes disagreement from ~0.40 to ~0.43.
Raises max_disagreement from 0.40 → 0.45 in both pipeline.yaml and
phase3.yaml. No non-Trp-rich candidate in the 709-sequence phase3 pool
exceeds disagreement=0.41, so the new threshold still blocks genuinely
uncertain candidates.

Tests: 6 new tests for face_segregation_bonus; score ceiling test split
into no-hw (0.97) and with-hw-clamped (1.0); retrospective sentinels
updated (phase3 ≥0.81 / <0.84); disagreement config test updated to 0.45;
SEED-008 mechanism-divergence zone test updated to [0.40, 0.45].
Total: 1245 tests passing.
- activity.py: fix "seven" → "eight" term count in ceiling comment
- activity.py: add min(..., 1.0) defensive clamp on hw_amphipathic input
- METHODS.md: update intro paragraph term count (seven→eight) and ceiling
  value (0.97→1.02 pre-clamp, bounded to ≤1.0 by clamp01)
- test_pipeline_filters.py: update all stale 0.40 references to 0.45 in
  test docstrings and assertion messages (KDKDKDKD, PPPPPPPP, SEED-008 tests)
- test_pipeline_filters.py: collapse redundant triple-assertion in SEED-008
  test to single `0.40 < dis < 0.45` open interval
- test_scoring_activity.py: add hw_score > 0.40 strength assertion for
  Magainin-2 in test_high_hw_score_improves_score_for_known_amp
@cschanhniem
cschanhniem merged commit 0c1fe5a into main Jun 28, 2026
3 checks passed
@cschanhniem
cschanhniem deleted the feat/face-segregation-bonus branch June 28, 2026 13:55
cschanhniem added a commit that referenced this pull request Jun 28, 2026
- Pipeline AUROC 0.8348→0.8420 (bootstrap CI₉₅: 0.76–0.91)
- Phase3 AUROC 0.8126→0.8266; AUPRC 0.8443→0.8627
- max_disagreement gate 0.40→0.45 in all narrative text
- SEED-008 Trp-rich disagreement updated 0.37→~0.43
- Summary table header updated to "After PRs #61–72 (current)"
- Recall@20 updated 43%→44%
cschanhniem added a commit that referenced this pull request Jun 28, 2026
* chore: update ROADMAP.md with current metrics, add coverage gate to make coverage

- AUROC 0.8164→0.8420 (bootstrap CI₉₅: 0.76–0.91) in v0.4 milestone entry
- Add v0.6.x section documenting PRs #61–#72 scoring improvements
- Mark AUPRC gap as Done (PR #58, pipeline AUPRC=0.8627)
- Update large-scale benchmark gap row with corrected n=87 and CI
- coverage target: add --cov-fail-under=80 so make coverage exits non-zero
  below 80%; currently passes at 87.40%

* docs: fix v0.6.x chain gap (add PR #65) and AUPRC attribution
cschanhniem added a commit that referenced this pull request Jun 28, 2026
…#72) (#76)

PR #72 face_segregation_bonus improved magainin-1 (SEED-001) competitive ranking:
- Synthesis pool: 6→7 scaffold families; SEED-001 contributes 5 candidates
- SEED-002 remains excluded; all other counts updated
- Candidate family priority table updated with current pool counts
- Pilot panel serum stability section updated with correct family count

All 20 pilot panel candidates still pass disagreement gate (max dis=0.4449 < 0.45)
cschanhniem added a commit that referenced this pull request Jun 28, 2026
* docs: sync pre-lab docs with 7-scaffold pool (PRs #61-76)

- docs/NOMINATION_REPORT.md: add historical-record banner directing readers
  to current outputs/ for the post-PR #72 synthesis pool
- reports/external_predict.py: document Macrel v1.6.0 ONNX model bug where
  log-softmax scores are compared against 0.5 (causing ALL sequences to be
  classified as NAMP, including canonical AMPs like magainin-2 and LL-37);
  recommend web server as reliable alternative and add --keep-negatives flag
  to CLI instructions

* fix: correct Macrel v1.6.0 bug description and URL per review

- Use package-documented URL (big-data-biology.org/software/macrel) instead
  of unverified subdomain
- Change "range [-1, 0]" to "always <= 0; observed ~-0.8 to -0.05 on
  canonical AMPs" (log-softmax is bounded above by 0 but not below)
- Update module docstring to match web-server-preferred stance and link to
  bug note
cschanhniem added a commit that referenced this pull request Jun 28, 2026
* docs: sync WET_LAB_HANDOFF.md and ROADMAP.md with 7-scaffold pool

WET_LAB_HANDOFF.md was still referencing "6 pilot panel seed families"
after SEED-001 (magainin-1) was re-added as the 7th scaffold family in
PR #72. This PR corrects all stale counts and adds missing coverage for
the two newly relevant seeds.

Changes:
- "other 5 seeds" → "other 6 seeds" in SEED-006 special notes
- Serum stability section heading and body updated: 6→7 families,
  3→5 flagged families, SEED-001 and SEED-009 rows added to table
  - SEED-001 (score 0.49): natural magainin derivatives have documented
    serum t½ 15-30 min; model score may be accurate (not an underestimate);
    N-Ac/C-NH₂ modifications recommended in QC; D-Lys Wave 2 plan ready
  - SEED-009 (score 0.57): Pro-rich backbone resists protease cleavage
    10-50× vs Lys/Arg-X bonds; model likely underestimates actual t½
- SEED-006 and SEED-007 stability range corrected (0.61-0.67 / 0.64-0.66)
- Added SEED-001 (Magainin-1) Special Notes section: mechanism (carpet/
  toroidal pore), novelty caveat (low — serves as positive control),
  synthesis guidance (N-Ac + C-NH₂ both recommended), assay
  interpretation matrix including what SEED-001 inactivity means

ROADMAP.md:
- External predictor row updated: tool list corrected (CAMPR4, AMPScanner,
  dbAMP, AntiCP2, Macrel), checklist status noted, Macrel v1.6.0 CLI
  ONNX bug documented (all sequences misclassified as NAMP; use web server)

* docs: fix 7 code-review findings in WET_LAB_HANDOFF and ROADMAP

HIGH:
- Fix SEED-009 length contradiction: helix-wheel table showed "9 AA" while
  stability table (added this PR) correctly shows "12 AA"; aligned to 12 AA
  throughout (confirmed from pilot panel sequences)
- SEED-009 stability row: replace unsupported "10-50x slower" kinetic claim
  with mechanistic explanation — Pro nitrogen lacks free H for serine protease
  oxyanion hole (Pro-X bonds uncleaved); X-Pro bonds hindered by cis-trans
  isomerisation (Vanhoof et al. 1995, FASEB J 9:736-744)

MEDIUM:
- SEED-001 mechanism: distinguish toroidal-pore (primary, NMR-supported;
  Matsuzaki 1996, Huang 2006) from carpet mechanism (secondary at high conc;
  Brogden 2005); add assay signature guidance to help distinguish in vitro
- SEED-001 disagreement: document scorer conflict (activity=0.81 vs
  boman=0.43, disagreement=0.377) so wet-lab team can interpret potential
  inactivity
- SEED-003 stability: remove Radzishevsky 2007 (lipopeptides, not relevant
  to conventional short AMPs); reframe as known model calibration limitation
  for <15 AA sequences

LOW:
- N-Ac/C-NH2 claim: remove unsupported "2-3x" multiplier; keep qualitative
  statement that modifications reduce exopeptidase exposure
- ROADMAP: note AMPlify excluded due to GPU/ONNX env incompatibility
cschanhniem added a commit that referenced this pull request Jun 28, 2026
AUROC 0.8420 was achieved in PR #72 (face_segregation_bonus), not in the
initial 5-seed benchmark generation run. Clarify that the generation section
describes the initial corpus and the AUROC figure reflects scoring improvements
through PR #72. Also note that the 87-sequence eval set was finalized in PR #66.
cschanhniem added a commit that referenced this pull request Jun 28, 2026
* docs: update METHODS.md version tag and annotate 7-seed synthesis pool expansion

The methods document was last updated for PRs #47-54. Since then the synthesis
pool was expanded from 5 to 7 scaffold families (SEED-006 through SEED-009 in
expansion PRs; SEED-001 re-entered in PR #72 via face_segregation_bonus).

Changes:
- Version line: "PRs #47-54" → "PRs #47-78"
- Generation section: added blockquote note distinguishing the initial 5-seed
  benchmark run (383 variants, 87-candidate eval set, AUROC 0.8420) from the
  current 7-seed synthesis pool (100 candidates)
- No scoring formulas or benchmark numbers changed

* docs: fix AUROC attribution in METHODS.md 7-seed note

AUROC 0.8420 was achieved in PR #72 (face_segregation_bonus), not in the
initial 5-seed benchmark generation run. Clarify that the generation section
describes the initial corpus and the AUROC figure reflects scoring improvements
through PR #72. Also note that the 87-sequence eval set was finalized in PR #66.
cschanhniem added a commit that referenced this pull request Jun 28, 2026
…fix (#81)

* docs: add wet-lab probability analysis, gold standard calibration, fix AUROC

- docs/WET_LAB_PROBABILITY.md: quantified per-family and composite discovery
  probability for 20-candidate pilot panel across 7 scaffold families; includes
  attrition model, breaking-news criteria, assay sequence guidance, and
  documented epistemic ceiling on computational prediction
- docs/GOLD_STANDARD_CALIBRATION.md: committed calibration report showing known
  AMPs (Magainin-2, Melittin, Defensin-HNP1, Temporin-A) score within/above the
  current 7-family pilot panel (mean ensemble 0.821); confirms pipeline calibration
- cli.py: fix AUROC=0.8047→0.8420 in gold_standard disclaimer text (AUROC 0.8047
  was the pre-PR #66 duplicate-corrected value; 0.8420 is the PR #72 final value)

* fix: address code review findings on calibration and probability docs

GOLD_STANDARD_CALIBRATION.md:
- [HIGH] Fix Melittin blind-spot text: safety model assigns Safety=1.0 for Melittin
  (a confirmed model failure for curvature-mediated hemolysis); warn that Safety=1.0
  cannot be used as evidence of non-hemolysis for any panel candidate
- [MEDIUM] Acknowledge LL-37/Cecropin-A scoring below panel floor — indicates
  pipeline is optimised for magainin/mastoparan class; LL-37-like mechanisms may
  be under-scored
- [MEDIUM] Rephrase AUROC disclaimer: "retrospective benchmark, not external
  prospective validation" (avoids conflating benchmark performance with independence)
- [LOW] Fix Temporin-A SEED-004 reference for readers without history context

WET_LAB_PROBABILITY.md:
- [HIGH] Fix arithmetic error in pessimistic composite: 0.000127 → 0.000635,
  "99.99%" → "99.94%"
- [MEDIUM] Fix SEED-009 mechanism description: ribosome exit tunnel binding (Gagnon
  2016) and DnaK chaperone binding are distinct intracellular targets, not one pathway
- [LOW] Fix "lowest serum stability" text: SEED-003 and SEED-008 (not SEED-003 and
  SEED-005) have the lowest model-estimated stability scores
- Downgrade hemolysis probability estimates in conditional table: safety model is
  blind to curvature-mediated hemolysis (Melittin confirmed); estimate from structural
  class literature instead; adjust P(active AND passes hemolysis) 55-70% → 45-60%
cschanhniem added a commit that referenced this pull request Jun 28, 2026
The External Calibration section said "6 effective scaffolds" after PR #61,
but PR #72 (face_segregation_bonus) reinstated SEED-001 (magainin-1) into the
synthesis pool as the 7th scaffold family. Update the calibrated probability
calculation accordingly:

  P(≥1 from 7 at 1.6%) ≈ 11%, at 2.4% ≈ 16%, at 3.1% ≈ 20%
  Calibrated range: 10–20% (was 10–18% for 6 scaffolds)

Also:
- Update executive summary to show post-PR #72 numbers (AUROC 0.8420, 7 families)
- Add cross-reference to docs/WET_LAB_PROBABILITY.md for per-family breakdown
- Clarify "publishable novel result" vs "breaking news" distinction in the table
- Fix "calibrated estimate n=6" table column header → n=7
cschanhniem added a commit that referenced this pull request Jun 28, 2026
#91)

Adds two feature columns extracted from the scoring pipeline's feature dict
into the pilot panel CSV output, giving wet-lab teams direct access to the
most informative physicochemical signals for within-family prioritization:

- amphipathic_score: helix_wheel_amphipathic_score [0,1] — measures helical
  face segregation (hydrophobic vs hydrophilic); key predictor of membrane
  disruption AMP activity; drove AUROC improvement to 0.8420 in PR #72
- charge_ph74: net_charge_ph74 — actual net charge at physiological pH 7.4;
  directly predicts electrostatic membrane affinity; distinct from the
  charge_density (per-residue) already present in the scoring pipeline

Both columns fall back to 0.0 when the feature dict is absent (CSV round-trip
compatibility). 3 new tests cover exact extraction, correct column set, and
graceful fallback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant