Skip to content

test: scoring, physchem, data-loader coverage (516→620 tests) - #19

Merged
cschanhniem merged 2 commits into
mainfrom
feat/scoring-physchem-loader-tests
Jun 28, 2026
Merged

cschanhniem merged 2 commits into
mainfrom
feat/scoring-physchem-loader-tests

Conversation

@cschanhniem

Copy link
Copy Markdown
Collaborator

Summary

  • 104 new unit tests across four modules that directly affect which peptides get nominated for synthesis
  • Any regression in these modules now fails immediately rather than silently mis-ranking candidates

Coverage added

File Tests Module covered
test_scoring_synthesis.py 17 scoring/synthesis.py — length penalties, cysteine/repeat-run flags, cumulative clamping
test_scoring_ensemble.py 27 scoring/ensemble.py — weighted average, clamping, zero-weight guard, selection_reasons, known_failure_modes
test_data_loaders.py 15 data/loaders.py — normalize_sequence, is_valid_sequence (all 20 canonical AA, rejection cases), load_candidates_csv
test_physchem.py 44 features/physchem.py — net_charge_proxy, fraction, longest_repeat_run, compute_features (all keys, empty sequence, numeric invariants)

Why these matter before wet-lab

  • synthesis_feasibility_score directly gates which candidates are ordered; an off-by-one in the length penalty boundary (31 vs 30) would silently mis-score candidates.
  • ensemble_score is the final ranking function; the zero-weight edge case and clamping behaviour were untested.
  • compute_features feeds every scorer — a missing key or wrong fraction would corrupt all downstream scores.
  • load_candidates_csv is the entry point for all user-supplied sequence data; wrong id/source defaults were undocumented.

Test plan

  • pytest -q — 620 passed
  • ruff check — no issues
  • Pre-push hook passes

Four modules that directly affect candidate scoring and selection had no
or minimal dedicated tests. Any bug in them would silently pick the wrong
candidates before synthesis.

- test_scoring_synthesis.py (17 tests): synthesis_feasibility_score —
  length penalty boundaries, cysteine/repeat-run flags, cumulative caps
- test_scoring_ensemble.py (27 tests): ensemble_score (weighted avg,
  clamping, zero-weight guard), selection_reasons (all threshold branches),
  known_failure_modes (novelty/safety/synthesis/disagreement flags)
- test_data_loaders.py (15 tests): normalize_sequence, is_valid_sequence
  (all 20 canonical AA, non-canonical rejection), load_candidates_csv
  (id/source defaults, sequence normalisation, smoke-test on demo file)
- test_physchem.py (44 tests, expanded from 2): net_charge_proxy,
  fraction (hydrophobic/aromatic/custom), longest_repeat_run (boundary
  cases), compute_features (all keys, value correctness, empty sequence)

Total: 516 → 620 tests. All lint-clean.
@cschanhniem
cschanhniem merged commit c4c97d9 into main Jun 28, 2026
1 check failed
@cschanhniem
cschanhniem deleted the feat/scoring-physchem-loader-tests branch June 28, 2026 00:52
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