about summary refs log tree commit diff
path: root/test/python/test_mapping_methods.py
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-11-11 05:41:56 +0000
committerPjotr <wrk@bosa.lan>2026-11-11 05:41:56 +0000
commit3022797b55bae96322439770ea48e74eb2e0eb8d (patch)
tree6c8386c2e9682431b49b0248bb0d295710ba1027 /test/python/test_mapping_methods.py
parentb4246412072773819f4500cb008f71c3f3101fdf (diff)
downloadgenenetwork4-3022797b55bae96322439770ea48e74eb2e0eb8d.tar.gz
bulklmm: an LMM scan that can be asked for thresholds
GEMMA's LOCO scan is the reference for a biallelic panel, but its p-values
have no threshold we can compute: a GEMMA permutation repeats the whole
scan, which is why /compute/gemma refuses nperm. R/qtl's nperm is the usual
stand-in and it is the wrong null -- it shuffles phenotypes as if the
individuals were unrelated. BulkLMM.jl fits an LMM per marker with a global
kinship matrix and permutes by rotating the data through the kinship's
eigen decomposition, so a threshold costs seconds.

  POST /compute/bulklmm {group, genotype_version, samples|basket,
                         nperm, seed, reml, assumption}

Rows are marker, chr, pos (Mb), lod, beta, h2. BXD trait 16627 (BXD.8,
35 phenotyped animals, 21056 markers) in 22 s: peak rsm10000000888 chr2
4.92 Mb, LOD 9.59, and thresholds alpha 0.10 -> 3.51, 0.05 -> 3.81,
0.01 -> 4.47 from 200 rotations with seed 42. That is the trait's
published locus and LOD, and a significant peak against a threshold this
API could not compute before.

Two differences from GEMMA are in every reply, not implied: a global
kinship matrix rather than leave-one-chromosome-out, and h2_null saying
how much relatedness was found (here ~0, so the fit is effectively
fixed-effects -- which is why it agrees with R/qtl where GEMMA differs).

  * src/bulklmm.rs prepares what Julia reads -- the BIMBAM dosages as a
    strains x markers matrix (our BIMBAM pair is already the allele
    dosages BulkLMM wants), a marker map, the phenotype and covariates
    -- runs the driver through streaming::run_streaming_with_env, and
    reads the CSV back. A row whose LOD is NaN is dropped: NaN is a valid
    f64 in Rust and would otherwise be reported as a value.
  * scripts/bulklmm_scan.jl is the driver (scan/calcKinship/get_thresholds),
    with the seed recorded so a threshold set is reproducible.
  * gate::bulklmm (2 slots, GEMMA-sized threshold): a permutation here is
    cheap, unlike R/qtl's.
  * Julia comes from the deployment's own store binary with a prepared
    depot -- 79 packages, 139 MB, no GPU/CUDA stack -- and every request
    runs JULIA_PKG_OFFLINE=true, so a scan can never download anything.
    `--project=<path>`, not `--project <path>`: Julia 1.8 takes the
    space-separated form as a program argument.

tests/bulklmm.rs: the peak stays on chr2 above LOD 3, the thresholds and
seed are in the notes, and a scan without permutations says there is no
threshold rather than leaving a bare LOD to be read as significant.
Diffstat (limited to 'test/python/test_mapping_methods.py')
0 files changed, 0 insertions, 0 deletions