Conversation
Use the published one-region tubule balance with the existing permeability estimate. Anchor the effective surface area to the Scotcher calibration point, without fitting to Cmax loss. Document the model limits and out-of-scope mechanisms, add focused checks, and record the headline-neutral validation.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6c1fd6afe
ℹ️ 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".
| """ | ||
| cl_renal = _GFR_L_PER_H * fup.mean | ||
| # peff (x10^-4 cm/s) * TSA (cm^2) -> L/h | ||
| ps_l_per_h = peff.mean * 1e-4 * 3600.0 * _TUBULAR_SURFACE_AREA_CM2 / 1000.0 |
There was a problem hiding this comment.
Recompute renal clearance after Peff posterior updates
When SBI or TDM varies Peff, apply_theta_to_drug, _build_drug_from_3d, and _apply_multipliers replace drug.peff while deliberately retaining the nominal renal_clearance. After making clearance depend on peff.mean here, those posterior particles therefore simulate absorption with the updated Peff but elimination with clearance derived from a different Peff, biasing inference for high-fup or renally cleared drugs. Recompute renal clearance whenever these paths update Peff, or derive it dynamically from the current drug parameters.
Useful? React with 👍 / 👎.
|
|
||
| # Estimate renal clearance | ||
| renal_cl = _estimate_renal_clearance(adme.fup, profile) | ||
| renal_cl = _estimate_renal_clearance(adme.fup, adme.peff) |
There was a problem hiding this comment.
Retrain the surrogate with the new renal model
The shipped surrogate and its training generator still use filtration-only clearance: scripts/train_surrogate.py:123 constructs renal_clearance=7.5*fup, whereas production drugs now receive this Peff-dependent value. Because the training data made renal clearance collinear with fup and never modeled its Peff interaction, the existing range guard can accept these inputs while returning predictions learned from the old elimination dynamics; even rerunning the current training script would preserve the mismatch. Update the generator and regenerate the surrogate artifacts before using the surrogate MC/TDM backends.
Useful? React with 👍 / 👎.
Summary
_estimate_renal_clearancepreviously usedCL_renal = GFR * fupfor every compound, the zero-permeability limit in which filtered drug is never reabsorbed. This overestimates renal clearance for permeable, weakly protein-bound compounds. The new one-region, well-stirred tubule balance uses the existingpeffprediction:CL_renal = fup * UF * (GFR + PS) / (UF + PS), withPS = peff * TSA, urine flowUF = 0.06 L/h, and effective surface areaTSA = 57.8 cm².This is the single-region reduction of Scotcher et al. 2016, algebraically identical to its
fup * GFR * (1 - F_reabs)form, whereF_reabs = F' * (1 - UF/GFR)andF' = PS / (PS + UF). It recoversfup * GFRasPS -> 0and approachesfup * UFasPS -> infinity. The effective surface area is back-calculated from that paper's ownF' = 0.5calibration at Caco-2 Papp14.8e-6 cm/s, through the existingadme._CACO2_TO_INVIVO_OFFSET. It was never fitted to this project's Cmax loss, consistent with Invariant #8.This model does not cover active tubular secretion, pH/ionisation-dependent uptake, or
peffuncertainty; the returned CV still tracksfuponly.Validation
The change ships on correctness. Its 107-drug holdout headline is neutral: Meta AAFE
2.7428 -> 2.7416(delta-0.0012), Engine4.2779 -> 4.2548(delta-0.0232), and ML unchanged. Meta 2-fold and 3-fold coverage are unchanged; Engine 2-fold coverage is unchanged, while 3-fold coverage moves43.9% -> 43.0%. Engine Cmax moves for 37/107 drugs, each by no more than 4%. The local stack reproduces the committed cache bit-identically, and DE-43 already documents how fixed meta weights damp engine changes; renal is a minor elimination route for most holdout drugs. The holdout cache was not regenerated on macOS.Renal CL fold error versus clinical values improves for caffeine
52.6 -> 13.0, antipyrine25.6 -> 5.3, theophylline10.9 -> 3.4, paracetamol9.5 -> 3.4, and midazolam11.9 -> 3.4. Secretion-dominant metformin, atenolol, and lisinopril remain underpredicted, as expected without secretion. Full results are indata/validation/renal_reabsorption_2026-09-22.json.ruff check src tests: passed.python3 scripts/check_no_internal_refs.py: passed.