about summary refs log tree commit diff
path: root/test/python/test_groups.py
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-11-11 15:22:07 +0000
committerPjotr <wrk@bosa.lan>2026-11-11 15:22:07 +0000
commit8a0b4059114d2628fe3362c816efcfc4262fc897 (patch)
treee095c0e348ad124efa0c05461f2c71be0932db0f /test/python/test_groups.py
parentee007a3731d186dc12c1b8b81589a03e8eb95acb (diff)
downloadgenenetwork4-8a0b4059114d2628fe3362c816efcfc4262fc897.tar.gz
docs: why the two engines' h2 disagree, and the three measurements that settle it
Written down from a real analysis (BXD.8, 35 phenotyped animals): trait
16769 has both engines saying kinship dominates (BulkLMM h2 = 1.000,
sigma2_e = 0; GEMMA clamps l_mle on every marker but the chr2 peak), while
16627 is a genuine disagreement (h2 = 0.000 against a clamped l_mle
everywhere). Both sit on a boundary, which is expected at n = 35 -- but
opposite boundaries mean the engines are estimating different things:

  * different kinship matrices (GEMMA's own relatedness from the BIMBAM
    dosages, one per chromosome under LOCO, against calcKinship's
    2*(X-0.5)(X-0.5)'/p + 0.5 with a unit diagonal);
  * different encodings (0/0.5/1 with NA, against the same dosages with
    missing values mean-imputed, against R/qtl's two-of-three codes) --
    and 16627 is nearly determined by the chr2 genotype;
  * different variance-component step (once under the null against
    per-chromosome LOCO, clamped differently at a boundary).

The three measurements that would settle it, with what is known about each:

  1. GEMMA's pve: it prints "pve estimate" when run with -pve, and
     gemma-wrapper keeps 223 per-chromosome .log.txt files under its cache
     dir -- none contain pve, because the flag is not passed. One argument
     on the GWA step plus a parser.
  2. BulkLMM's profile over an h2 grid: BulkLMM.profile_LL(y::Matrix, G,
     covar, K, h2_grid, markerID; reml) is internal (not exported) and
     returns (ll_list_null, ll_list_alt); it wants a one-column phenotype
     matrix and a covariate matrix. An attempt to call it from the driver
     is not landed -- the signature mismatch is the whole of the remaining
     work.
  3. The kinship matrices, or a summary: calcKinship is one line and can be
     written per panel, GEMMA's is already cached as *.k.json; correlating
     off-diagonals says whether the engines disagree about relatedness
     before arguing about variance components.

Until those exist, the reading in the analysis holds: BulkLMM's h2 and the
thresholds that rest on it are approximate on a boundary, and GEMMA's
16627 p-values come from a kinship-dominated model.
Diffstat (limited to 'test/python/test_groups.py')
0 files changed, 0 insertions, 0 deletions