Repository navigation
feat(differential): MN/DM through MGLM as a second backend (upstream #22) - #327
Merged
Merged
Conversation
…LM as a second backend analysis.differential.mn_backend selects who fits the two joint compositional models: "julia" (the default, this fork's CompositionalModels) or "mglm", MGLM::MGLMreg.fit through RCall, the route upstream ruled on JoshuaJewell#22. The MGLM code (fit_mglm, its R script, MGLMUnavailable and the constants) is the same as on the upstream branch, so a later sync finds identical text. - The shared steps stay as they are: prevalence filter, separation refusal, reference choice and the half-the-samples reference rule. - mglm refuses a non-zero mn_penalty and dm_overdispersion_method mom, which it cannot honour, and does not use max_iter, tolerance or max_seconds. The config route and the cross-key check refuse the same combinations. - The multinomial is one model in both backends; the tests check that MGLM reproduces the Julia fit (estimates to 1e-6, standard errors to a relative 1e-6), the closed form, and the Julia route test's numbers. The Dirichlet-multinomials differ (MGLM has a concentration per group), so they are not compared; diagnostics.mglm.overdispersion reports each group. - MGLM 0.2.3 is pinned in renv.lock and checked in CI; MGLMUnavailable is a 503; the config editor, results panel, CSV line, README and ROADMAP name the backend. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZoFbrtmpRbKPqk25ok
The pull-request body, in upstream's template, and the comment for issue #22, for a person to post: the upstream repository is read-only from the session that built the branch. The README says where the upstream branch is, what it contains, and the order of sending. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZoFbrtmpRbKPqk25ok
|
Caution Review failedThe pull request is closed. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…ps are flat Review found that the mglm backend's boundary note and refusal said the Dirichlet-multinomial estimates equal the multinomial ones whenever either group showed no overdispersion. That holds only when both groups are flat: with one group overdispersed the contrasts differ and the multinomial would understate that group's variance. The note and the refusal now say which group is flat, and point to multinomial only when both are. theta is now computed in R, so an infinite concentration (theta = 0) is still flagged. The shared MGLM code is re-copied from the upstream branch, which has the same fix; a test covers the one-flat-group table. The upstream package in docs/proposals/upstream-issue-22/ is updated to the amended upstream commit and the new counts. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZoFbrtmpRbKPqk25ok
The upstream branch exists only in the session that built it, and that session may push to this fork's working branch alone. The patch applies with git am onto upstream 89be534 and gives the same tree as the signed commit 37c9ffa; applied elsewhere it must be signed again. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZoFbrtmpRbKPqk25ok
…template SonarCloud typescript:S4624 on the line this PR added to DifferentialPanel. The output text is unchanged; tsc and the frontend tests pass. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZoFbrtmpRbKPqk25ok
…T-stuff Owner's order (2026-11-12): the comment on upstream #22 goes first and asks whether Joshua still wants the change; the pull request follows only on a yes. The comment now points at upstream/issue-22-mglm (37c9ffa, Verified, 0 commits behind upstream main) instead of a PR number. The commit is submitted from the HoTT-stuff account, so the comment and the PR body each carry a line for the owner to name who answers for the code. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZoFbrtmpRbKPqk25ok
|
hyperpolymath
marked this pull request as ready for review
November 12, 2026 18:49
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Change and reason
Upstream ruled on JoshuaJewell/MetaManifold-WebUI#22 that multinomial (MN) and Dirichlet-multinomial (DM) regression come in as "MGLM through RCall, in line with CONTRIBUTING". This PR brings that route into the fork as a second backend, beside the fork's own Julia models.
analysis.differential.mn_backend:julia(the default,CompositionalModels, unchanged) ormglm(MGLM::MGLMreg.fitthrough RCall).fit_mglm, its R script,MGLMUnavailable, the constants) is the same text as on the upstream branch, so a later sync finds identical code.mglmrefuses a non-zeromn_penaltyanddm_overdispersion_method: mom, which it cannot honour. It does not usemax_iter,toleranceormax_seconds. The config route and the cross-key check refuse the same combinations.diagnostics.mglm.overdispersionreports each group.boundaryand keep their statistics. The note calls them the multinomial's estimates only when both groups are flat (fix in4a39525, after an independent review).docs/proposals/upstream-issue-22/holds the upstream pull-request body and the comment for Add AnalysisConfig + validators + Nickel/DEED schemas + provenance + issues - Milestone 3 #22, for a person to post.The upstream branch itself (one signed commit,
37c9ffa, on upstreammainat89be534) is not in this PR. Merging it here would also bring in the upstream commits this fork does not have yet, which is the separate sync innotes/upstream-sync.md.Validation
Ubuntu 24.04, Julia 1.12.5, R 4.5.0 (apt
4.5.0-3.2404.0), the R library restored fromrenv.lockwithrenv::restore(), MGLM 0.2.3, bun 1.4.4.4a39525:CI=true ... julia --project=. test/runtests.jl test_differential.jlgave 1864 of 1864 passed.CI=true RENV_CONFIG_AUTOLOADER_ENABLED=FALSE julia --project=. -t 2 test/runtests.jl --servergave 8863 passed, 6 failed, 12 broken. The 6 failures are thetest_provenance.jllive probes for cutadapt, fastqc, multiqc, vsearch, swarm and cd-hit, which that machine did not have; they are unrelated to this change. The fix touches onlydifferential.jland its tests.mn_backend: mglmthe route reproduces the Julia route test's numbers.warnoption is unchanged after a fit.cd frontend && bun run test: 82 pass, 0 fail;tsc --noEmitclean.--integration, and the frontend with the CI bun pin.Scope
renv.lockgains one entry, MGLM 0.2.3 (34 lines, nothing else changes). Themglmbackend loads it. MGLM is pure R with base-R imports only, licensed GPL (>= 2) like zCompositions.Contribution checks
main644cd9c, with no merge commits.)🤖 Generated with Claude Code
https://claude.ai/code/session_0136P7ZoFbrtmpRbKPqk25ok