Skip to content

Enforce design requirements and fix optimizer correctness - #3

Merged
thomdehoog merged 3 commits into
mainfrom
codex/algorithm-correctness-and-constraints
Oct 11, 2026
Merged

thomdehoog merged 3 commits into
mainfrom
codex/algorithm-correctness-and-constraints

Conversation

@thomdehoog

@thomdehoog thomdehoog commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

A low weighted score previously could leave forbidden motifs in the output while the interface implied that all requirements had been met. Mandatory requirements now take priority over soft preferences, and an independent final validator returns explicit validity and unresolved regions. A bounded coordinated repair phase can escape single-codon traps without claiming that failed heuristic searches prove a design impossible.

The algorithm also now:

  • Uses length-stable global GC penalties and cools annealing on every iteration.
  • Preserves the original input baseline across restarts and reports the strongest hairpins across the full construct.
  • Supports fixed flanks, protected codons, explicit codon exclusions, and selectable mandatory criteria.
  • Makes splice screening opt-in, keeps automatic host selection conservative, and exposes strand policy.
  • Records the effective seed, search settings, table content/hash, backend metadata, and full configuration for replay.

This is a 0.3.0 behavior change: motif avoidance is mandatory by default, splice screening defaults to none, and optimized sequences/scores may differ from earlier versions. The interface changes show validity accurately and account for construct coordinates.

Validation:

  • Dependency-free Python suite: 246 passed, 2 skipped.
  • With the MaxEntScan source backend: 247 passed, 1 skipped.
  • 3,000 randomized synonymous edits checked incremental scores and mandatory counts against full recomputation.
  • Frontend type-check, committed-bundle verification, and build passed.
  • All GitHub CI jobs passed: Python 3.10–3.13, the MaxEntScan job, and all 13 Playwright browser tests, including unresolved-design reporting and cancellation.
  • Local Chromium downloads were unavailable; browser coverage was verified on GitHub Actions.

Repair remains a bounded heuristic. Validity applies to the configured sequence criteria; these checks do not establish experimental expression or replace thermodynamic RNA modelling.

@thomdehoog
thomdehoog marked this pull request as ready for review October 11, 2026 12:08
@thomdehoog
thomdehoog merged commit 43e4dea into main Oct 11, 2026
6 checks passed
thomdehoog pushed a commit that referenced this pull request Oct 11, 2026
…lean

Follow-up to the #3 review. Three limitations it left behind.

Violations lying wholly inside the fixed flanks were reported exactly like
violations in the coding sequence, so pasting a vector context that contains a
site you are avoiding in the insert -- the usual reason to avoid it -- produced
"not a valid design" for a CDS that was already optimal, with nothing the
optimizer or the user could do. Each criterion now splits its complete count
into reachable and unreachable, exactly rather than by sampling: every region
carries a fixed_context flag and every criterion a fixed_context_count. When
the two counts match, the report and the CLI say the coding sequence meets the
requirement and only the supplied context does not. Validity and the exit code
are unchanged: the construct really does contain the site.

The server now refuses protected codons without starting DNA, an out-of-range
protected index, and a residue whose every codon is excluded, instead of
accepting the job and failing in the worker thread.

The construct length cap compared flank bases against input residues, so the
limit it enforced depended on whether the caller pasted protein or DNA. It now
compares bases with bases and names the figure.

Verified against independent brute-force oracles: three-way agreement of
counts across 400 random configurations is unchanged, and the unreachable
count is confirmed invariant under re-encoding the CDS.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wq3oxFtutXhnAgmzKztG9g
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