Skip to content

Clean four-state competitive models around free receptor#16

Merged
choutkaj merged 4 commits into
mainfrom
clean-four-state-free-receptor
May 1, 2026
Merged

Clean four-state competitive models around free receptor#16
choutkaj merged 4 commits into
mainfrom
clean-four-state-free-receptor

Conversation

@choutkaj

@choutkaj choutkaj commented May 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Refactor four-state competitive models to solve the quintic in true free receptor concentration R rather than r_equiv.
  • Compute tracer-bound fraction from the actual four-state species population RS + RLS.
  • Keep the total/nonspecific model as the same machinery with Kd_eff = (1 + N) * Kd.
  • Update four-state root-selection tests, including the degenerate Kds == Kd3 quartic case.
  • Rewrite algebra/derive_four_state_r_equivalent_coefficients.ipynb so it derives the free-receptor quintic and validates the runtime coefficient helper.
  • Add sympy to the notebook dependency group for the derivation notebook.

Validation

  • Locally sanity-checked the derived free-receptor coefficients against an independent mass-balance solve for typical, cooperative, anti-cooperative, and Kds == Kd3 degenerate cases.
  • Existing mass-balance validation tests should continue to compare model output against the numerical species-balance solver.

Note: the old .qmd documentation was intentionally left untouched.

@choutkaj choutkaj merged commit 1e31fcf into main May 1, 2026
0 of 5 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e768cac6e3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


a = 1.0 + receptor_free / Kds
b = 1.0 + receptor_free / Kd
c = receptor_free / (Kd * Kd3)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Guard free-species solve against zero Kd or Kd3

This introduces an unguarded division by Kd * Kd3; when either parameter is 0.0 (both are allowed at their lower bounds in this model, and Kd can be hit during fitting), c becomes inf/nan, which then propagates through the quadratic and returns invalid model responses. The previous implementation did not divide by Kd or Kd3 in the response mapping, so this is a regression that can break fits or produce NaN curves at boundary parameter values.

Useful? React with 👍 / 👎.

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