Skip to content

feat: replace charge proxy with Henderson-Hasselbalch net charge at pH 7.4 - #34

Merged
cschanhniem merged 4 commits into
mainfrom
feat/net-charge-ph74
Jun 28, 2026
Merged

cschanhniem merged 4 commits into
mainfrom
feat/net-charge-ph74

Conversation

@cschanhniem

Copy link
Copy Markdown
Collaborator

Summary

  • net_charge_at_ph74() — new function in physchem.py using Henderson-Hasselbalch with peptide-context pKa values (R: 12.5, K: 10.5, H: 6.5, D: 3.9, E: 4.1). His is partially protonated at pH 7.4 (+0.114 vs +1.0 in the integer proxy).
  • compute_features() now returns two new keys: net_charge_ph74 (float) and charge_density_ph74 (float), alongside the existing net_charge_proxy and charge_density for backward compatibility.
  • activity_likeness_score() uses charge_density_ph74 by default, falling back to charge_density for manually constructed feature dicts that predate this field.
  • 24 new tests covering His partial protonation math, neutral AA pass-through, multi-His additivity, proxy comparison, and compute_features() integration.

Impact on nominees

24/88 nominees contain His residues. The proxy overestimates charge by ~0.89 per His. With charge_density weight 0.27 in the scoring function and typical lengths 14–22 aa, the per-candidate score correction is ~0.01–0.017 points. Nominees whose ranking was inflated by proxy His-counting will drop slightly; those with accurate R/K charge sources are unaffected.

Test plan

  • pytest tests/test_net_charge_ph74.py — 24/24 pass
  • Full suite pytest — 896/896 pass (pre-push hook verified)
  • net_charge_at_ph74("H") ≈ 0.1117 (Henderson-Hasselbalch at pH 7.4, pKa 6.5)
  • net_charge_at_ph74("KRIVQRIKDFLR") == 4.0 (no His, pure K+R)
  • activity.py fallback verified: manually constructed dicts with only charge_density key still score correctly

Breaking news probability update

No change to stated probability range (10–25%) — this fix corrects a systematic bias but does not add new discriminative signal. His-containing nominees with high scoring were likely slightly overrated; the correction tightens accuracy of the pipeline rather than boosting hit rate.

…H 7.4

Add net_charge_at_ph74() using physiologically accurate pKa values
(R: 12.5, K: 10.5, H: 6.5, D: 3.9, E: 4.1). His is partially protonated
at pH 7.4 (~+0.11 vs +1.0 in proxy), correcting charge overestimation in
24/88 nominees containing His residues (~0.89 per His overestimation).

- physchem.py: add net_charge_at_ph74(), expose net_charge_ph74 and
  charge_density_ph74 fields from compute_features()
- activity.py: use charge_density_ph74 (falls back to charge_density for
  manually constructed dicts without the new field)
- tests/test_net_charge_ph74.py: 24 tests covering His partial protonation,
  proxy comparison, neutral AA handling, and compute_features integration
cschanhniem added a commit that referenced this pull request Jun 28, 2026
…ne (#35)

* feat: add Chou-Fasman helix propensity scoring (Pα) to feature pipeline

Add helix_propensity_score() using Chou-Fasman (1974) Pα parameters. The
mean Pα across all residues quantifies helical-forming tendency: >1.03 is
helix-forming, <0.75 is helix-breaking (Pro=0.57, Gly=0.57). All 5 pilot
panel seed families rely on helical amphipathicity for membrane disruption,
so this feature adds discriminative signal against proline-rich or random
sequence backgrounds.

- physchem.py: _HELIX_PROPENSITY table + helix_propensity_score(); exposes
  helix_propensity key in compute_features() return dict
- activity.py: helix_bonus (max +0.01) added; amphipathicity weight reduced
  0.15→0.14 to maintain score ceiling below 1.0
- tests/test_helix_propensity.py: 23 tests (Pα values, helix vs proline-rich
  sequences, compute_features integration, activity score fallback)
- tests/test_scoring_activity.py: update hardcoded weight assertion 0.075→0.07
- docs/DISCOVERY_PREDICTION.md: mark PR #34 done, add item 5 for Chou-Fasman

* fix: remove unused pytest import (ruff F401)
@cschanhniem
cschanhniem merged commit 7f27a7e into main Jun 28, 2026
3 checks passed
@cschanhniem
cschanhniem deleted the feat/net-charge-ph74 branch June 28, 2026 05:08
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