about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-11-09 14:01:00 +0000
committerPjotr <wrk@bosa.lan>2026-11-09 14:01:00 +0000
commita698c48ee204cd68efc479b01132ae9c037213bb (patch)
tree9af621bc16457d1ea99ddb4ffa7a28588e5316a7 /scripts
parent195ee5d285da98bc911813d8e578f4f17e9ba7ba (diff)
downloadgenenetwork4-a698c48ee204cd68efc479b01132ae9c037213bb.tar.gz
covariates: refuse a mostly-numeric attribute, and teach the skill to use them
Fitting `SeqCvge` as a covariate came back as `502 gemma_failed` with a
message about LU decomposition: its values are depths (`40`, `41`) with a
few two-library entries (`36+39L`), so the attribute was coded as **twenty
categories** and GEMMA died on the resulting dummies. The failure named
GEMMA, which is the wrong place to look.

`code_case_attribute` now refuses that shape at the covariate step, naming
the values and what to send instead:

  422 invalid_covariate: case attribute 'SeqCvge': the attribute mixes
  numbers with number-like text (14 of 19 values look numeric, but e.g.
  '36+30L' does not), so coding it as categories would fit a quantity as a
  factor -- and GEMMA fails on the result. Pass an explicit `map` giving
  each of those a number (there are 5 such value(s): ...), or send the
  numbers inline.

The rule is deliberately narrow: an odd level with *no* digits (`1, 2,
unknown`) is still a level and still coded, so nothing that worked stops
working; only dirty numbers are caught.

Also, the skill's covariate coverage -- which the review above found thin:

* when a covariate is worth trying (metadata that could confound: sex, age,
  epoch, batch, sequencing depth), and the covariate step in the session
  outline;
* read `.data.descriptions` before choosing one -- they are the only place
  that says `SeqCvge` is sequencing depth and `Epoch` a family subgroup --
  and the endpoint table now says so;
* read the covariate line in `notes` for the coding and the complete-case
  n, and report that n beside any LOD/p change; plus `Cyro`/`Cryo` being
  two levels in BXD;
* the categorical-vs-numeric rule measured rather than asserted: `RRID`
  refused (82 distinct), `Status`/`Epoch` accepted, and the compound-value
  trap written up with the `map` workaround;
* GEMMA's dummy columns, the column it drops when a level has no fitted
  individual, and that R/qtl's note has no such line; missing values
  dropping individuals; the 8-covariate cap and the `group` requirement.

* src/covariates.rs: the refusal, with a unit test for both sides of it;
* tests/gemma.rs: `SeqCvge` is a 422 naming `map`, not a GEMMA failure;
* docs/www/SKILL.md: the covariate section, the session line, and the
  case-attributes rows in the endpoint table.

300 tests pass; the same four as before do not.
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions