From da2c90cb8f479c1bb2ff9878a7b205aafdb1bc10 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" Date: Fri, 16 Oct 2026 04:49:00 +0100 Subject: [PATCH] test(differential): the absence-path ml fit needs fittable counts The glmGamPoi-absence testset asserted all(r.status .== "ok") on a 4-sample matrix of small counts. MEASURED with MASS::glm.nb (R 4.5, MASS 7.3-60): that data cannot reach status ok -- one taxon's theta runs to its upper bound (status boundary) and the other's alternating fit produced NaNs (status failed). The test's CI runs were cancelled before completing on the feature branch, so the first completed run on main (da9754f) was the first to expose it. The test now fits the injected-effect dataset with a TSS offset -- the dataset the "Negative-binomial fit recovers an injected effect" testset already proves fits -- keeping the assertion's intent: the requireNamespace override defers to base, so the default dispersion still fits. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- test/unit/test_differential.jl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/unit/test_differential.jl b/test/unit/test_differential.jl index 36e98158..e46559f4 100644 --- a/test/unit/test_differential.jl +++ b/test/unit/test_differential.jl @@ -755,8 +755,15 @@ end @test e isa GlmGamPoiUnavailable @test occursin("renv::restore()", sprint(showerror, e)) # The override defers to base for everything else, so the default - # dispersion must still fit normally with it in place. - r = fit_nb([5 6; 7 3; 9 4; 4 8], ["A", "A", "B", "B"], [0.0, 0.0, 0.0, 0.0]; + # dispersion must still fit normally with it in place. The + # injected-effect dataset, not the minimal matrix above: + # MEASURED with MASS::glm.nb, with 4 samples of small counts the + # alternating fit runs theta to its upper bound (status boundary) + # and one taxon's fit even produced NaNs (status failed), so that + # data never reaches status ok on any machine; the dataset + # "Negative-binomial fit recovers an injected effect" already + # proves fits. + r = fit_nb(effect, effect_groups, log.(tss_factors(effect, effect_samples)); levels=("A", "B")) @test all(r.status .== "ok") finally