Skip to content

feat: serum stability score, pilot diversity cap, discovery probability docs - #31

Merged
cschanhniem merged 2 commits into
mainfrom
feat/serum-stability-diversity-prediction
Jun 28, 2026
Merged

cschanhniem merged 2 commits into
mainfrom
feat/serum-stability-diversity-prediction

Conversation

@cschanhniem

Copy link
Copy Markdown
Collaborator

Summary

Three pre-synthesis improvements that directly raise the probability of wet-lab discovery:

  • Serum stability score (stability.py, physchem.py): New interior_protease_sites() function counts interior K/R (trypsin) and F/W/Y (chymotrypsin) sites. New serum_stability_score() predicts relative serum longevity from combined protease-site density (Hilpert et al. 2006 basis). Exposed in batch pack summary: mean_serum_stability=0.58 for the 88 nominees.
  • Pilot panel family diversity cap (pilot.py, cli.py, Makefile): New max_per_seed parameter caps nominees per seed family. Default --max-per-seed 4 in Makefile. Previous panel was 16/20 SEED-003; new panel is 4 per family across all 5 seeds — dramatically reduces correlated failure risk.
  • Discovery probability assessment (docs/DISCOVERY_PREDICTION.md): Honest stage-by-stage breakdown: synthesis ~90%, MIC ~55–65%, selectivity ~35–50%, serum stability ~10–20%, scaffold novelty ~10–15%. Combined "breaking news" probability: ~5–12%. Root-cause analysis and roadmap (D-amino acid variants, MDR strain panel, reference expansion).

Test plan

  • 853 tests passing (27 new serum stability + 5 new pilot diversity)
  • make ci passes (lint + test)
  • Pre-push hook passes
  • Pilot panel regenerated: 4 candidates per seed family (SEED-001 through SEED-005)
  • Batch pack regenerated: mean_serum_stability=0.5807, n_high_serum_stability=47/88
  • DISCOVERY_PREDICTION.md reviewed for scientific accuracy and honest caveats

🤖 Generated with Claude Code

…bability assessment

Three changes to raise wet-lab discovery probability before synthesis ordering:

1. Serum stability score (stability.py, physchem.py)
   - Add interior_protease_sites() to compute_features(): counts interior K/R (trypsin)
     and F/W/Y (chymotrypsin) sites, excluding C-terminal position
   - Add trypsin_site_density, interior_trypsin_sites, interior_chymotrypsin_sites features
   - New serum_stability_score() predicts relative serum longevity from combined protease
     site density (literature basis: Hilpert et al. 2006)
   - Expose mean_serum_stability and n_high_serum_stability in batch pack summary
   - Regenerated phase3 outputs: mean_serum_stability=0.5807, 47/88 nominees ≥0.50

2. Pilot panel family diversity cap (pilot.py, cli.py, Makefile)
   - Add max_per_seed parameter to select_pilot_panel()
   - Expose --max-per-seed CLI flag; default Makefile uses --max-per-seed 4
   - Previous pilot panel: 16/20 SEED-003; new panel: 4 per seed family (5 seeds = 20)
   - Higher family diversity reduces correlated failure risk in wet-lab

3. Discovery probability assessment (docs/DISCOVERY_PREDICTION.md)
   - Honest stage-by-stage probability breakdown: synthesis ~90%, MIC ~55-65%,
     selectivity ~35-50%, serum stability ~10-20%, scaffold novelty ~10-15%
   - Combined "breaking news" probability: ~5-12%
   - Root cause analysis of the gap, roadmap to higher probability (D-amino acids,
     MDR strain panel, reference set expansion)
   - Best pilot panel bets ranked with scientific rationale

Tests: 853 passing (27 new serum stability + 5 new pilot diversity tests)
- stability.py: import clamp01 from activity.py (eliminate duplication);
  use chymotrypsin_site_density (pre-computed in features) instead of
  re-deriving from raw count — symmetric schema
- physchem.py: add chymotrypsin_site_density to compute_features();
  add comment clarifying CHYMOTRYPSIN_SITES == AROMATIC is intentional
- pilot.py: add logging.warning when Phase 3 fires and max_per_seed
  would have been violated (observable signal for callers)
- batch_pack.py: guard stability computation against rows with no
  features key (avoids silent score inflation to 1.0)
- cli.py: use args.max_per_seed directly (no getattr needed)
- tests: add chymotrypsin_density key coverage and symmetric-schema test

857 tests passing
@cschanhniem
cschanhniem merged commit 54cff6b into main Jun 28, 2026
1 check passed
@cschanhniem
cschanhniem deleted the feat/serum-stability-diversity-prediction branch June 28, 2026 03:33
cschanhniem added a commit that referenced this pull request Jun 28, 2026
…ity assessment (#33)

- Add 29 well-characterized AMP sequences from published literature to the
  curated reference set, spanning LL-37 fragments (KR-12, FK-13, FK-16),
  cathelicidins (BMAP-27, BMAP-28, mCRAMP), proline-rich (apidaecin, oncocin,
  pyrrhocoricin), marine (pleurocidin, clavanin A), and engineered (WLBU2,
  BP100, omiganan) families — total 44 → 72 unique sequences
- Remove duplicate REF-GIG-001 (identical to REF-MAG-001)
- Add tests/test_reference_set.py: 14 tests guarding structure, uniqueness,
  canonical amino acids, family coverage (≥20 families, ≥70 sequences)
- Update docs/DISCOVERY_PREDICTION.md: mark PRs #31–#32 completed, revise
  serum stability probability 10–20% → 25–40% based on updated pilot panel
  composition, revise combined "breaking news" probability 5–12% → 10–25%
  with root cause analysis of remaining gap
cschanhniem added a commit that referenced this pull request Jun 28, 2026
)

* feat: add C-terminal amidation recommendation to presynth QC module

~70% of natural helical AMPs are C-terminally amidated. Amidation adds
~+0.5–1.0 net charge, improves carboxypeptidase resistance (serum stability),
and enhances membrane binding at no synthesis cost (specify CONH₂ in order).

Logic: recommend when C-terminal residue is NOT K or R (neutral) AND
charge_pH7.4 < 3.0. The flag is informational — the synthesis vendor just
needs CONH₂ specified in the order form.

Primary beneficiary: SEED-004 variants (charge_pH7.4 ≈ 0.8, ends in L);
amidation would push them above the LOW_CHARGE threshold and improve the
Stage 3 (serum stability) outlook.

- presynth_check.py: add c_amidation_recommended (bool) + c_amidation_reason
  (str) to SynthQC dataclass; populate in check_sequence(); emit
  C_AMIDATION_RECOMMENDED flag in flags list; expose both in to_dict()
- tests/test_presynth_qc.py: 11 new tests in TestCTerminalAmidation covering
  low-charge/neutral-cterm, K/R C-term exclusions, flag presence, to_dict()
  key coverage, and empty-sequence safety

* docs: update discovery probability to 12-28% after PRs #31-#36

* fix: remove unused imports and fix f-strings without placeholders (ruff)
cschanhniem added a commit that referenced this pull request Jun 28, 2026
Resolve DISCOVERY_PREDICTION.md conflict: keep PR #38 (SEED-006) content
which already incorporates all completed PR improvements #31–#38.
cschanhniem added a commit that referenced this pull request Jun 28, 2026
)

* docs: update ROADMAP, add AUROC reproducibility note, update RISK_REVIEW

ROADMAP.md:
- Mark v0.1-v0.5 as complete (✓) with specifics of what was delivered in each milestone
- Add v0.5.x section documenting the pre-wet-lab scoring enhancements (PRs #31-#54):
  serum stability, selectivity proxy, pilot priority, aggregation, proline penalty,
  helix bonus, amidation/acetylation recommendations, DISCOVERY_PREDICTION model

METHODS.md Section 8:
- Add 'To reproduce: make validate-scoring' note so reviewers can reproduce AUROC 0.8164
  from the repository without external tooling (addresses code review feedback that
  the headline performance number was not reproducible from visible code)

RISK_REVIEW.md Section 2:
- Add selectivity proxy / HIGH_CYTOTOX_RISK as a dedicated filtered risk row; both the
  safety scorer (μH penalty, pH-7.4 charge) and pilot panel (cytotox_penalty) now
  double-mitigate cytotoxicity risk
- Update hydrophobicity row to mention μH > 0.55 signal added in PR #53
- Update charge density row to note charge_density_ph74 for accuracy
- Add proline content as a reported risk row
- Update action-required note to flag HIGH_CYTOTOX_RISK candidates for hemolysis assay

* docs: fix CLI command in METHODS.md reproducibility note (code review PR #56)

validate-scoring is a top-level command, not a bench subcommand.
'cli bench validate-scoring' would raise argparse error.
Corrected to 'cli validate-scoring' to match the actual Makefile target.
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