diff options
| author | Pjotr <wrk@bosa.lan> | 2026-11-16 00:30:52 +0000 |
|---|---|---|
| committer | Pjotr <wrk@bosa.lan> | 2026-11-16 00:30:52 +0000 |
| commit | 278855bd0014094a9d3fcf81ef387e1aa7a89068 (patch) | |
| tree | d2c12bb182ab6f663355bb5dc6259eed939b675e /src | |
| parent | 1ae2f5d712e18c016fdb7bd04da99eab4da6915b (diff) | |
| download | genenetwork4-278855bd0014094a9d3fcf81ef387e1aa7a89068.tar.gz | |
gemma: suggest BulkLMM rotations for a threshold, with the numbers
GEMMA's reply offered R/qtl as the way to get significance thresholds, which is the wrong advice for a relatedness-structured panel: haley-knott's permutation shuffles phenotypes without regard to the kinship, so its null is anti-conservative exactly where an LMM was chosen in the first place. BulkLMM is the same model family as this scan and permutes by rotating the data through the kinship decomposition, so its thresholds do respect relatedness -- and it is fast. The 200 reply now carries three actions in order: draw it (/plot/gemma), POST /compute/bulklmm with a ready-to-post body (group, trait_name, samples, nperm 500, seed 1), then POST /compute/rqtl relabelled as a non-LMM cross-check with a warning that its threshold is anti-conservative here. Measured on BXD trait 10001, so the text asserts nothing it has not seen: GEMMA's best marker is rsm10000005700 on chr8 (p_lrt 5.9e-07, -log10 p 6.23) and BulkLMM's best is the same marker (LOD 3.866, beta -0.0615) -- at the peak the two LMM families agree on the locus. Their thresholds are not interchangeable: with 500 rotations BulkLMM's 0.05 threshold is LOD 3.78 (the peak clears it, and a second seed gave 3.62), while R/qtl2's LOCO scan1perm on the same trait and permutation count gives 2.62, so a global kinship is the stricter null; and LOD 3.87 and -log10 p 6.23 are different scales for one marker, so a BulkLMM threshold must never be compared with a GEMMA p-value directly. The 422 permutations_not_supported text quotes the same measurements instead of prose, and the suggested body was run verbatim to check it: POST /compute/bulklmm with it returns 200, 21056 rows, and the threshold note "500 rotations (seed 1): alpha 0.01 LOD 4.10, alpha 0.05 LOD 3.62".
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/gemma.rs | 51 |
1 files changed, 40 insertions, 11 deletions
diff --git a/src/routes/gemma.rs b/src/routes/gemma.rs index fe06edd..a17010b 100644 --- a/src/routes/gemma.rs +++ b/src/routes/gemma.rs @@ -610,16 +610,20 @@ pub async fn compute_gemma( each one repeats the entire LOCO association scan (gemma-wrapper --permutate), \ so a thousand is thousands of scans and hours of the one slot GEMMA has here. \ Two ways to get a threshold instead: (1) send the same trait values to \ - POST /compute/bulklmm with \"nperm\": 1000 -- it fits an LMM and permutes by \ - rotating the data through the kinship decomposition, so its thresholds respect \ - relatedness (R/qtl's nperm does not, and is anti-conservative on a structured \ - panel); (2) run GEMMA's own permutation locally on the same inputs -- the files \ - this endpoint used are named in the reply's notes (the bimbam pair and the \ - phenotype file), so `gemma-wrapper --permutate` or `gemma -lmm 9 --permutate` \ - reproduces exactly the null GEMMA would use, at hours rather than seconds. \ - Judge a GEMMA peak against whichever threshold you choose, or against the \ - smallest p_lrt it reached -- and remember BulkLMM's kinship is a single \ - genome-wide matrix, not LOCO like this scan." + POST /compute/bulklmm with \"nperm\": 500 -- it is the same LMM family as this \ + scan and permutes by rotating the data through the kinship decomposition, so \ + its thresholds respect relatedness (R/qtl's nperm does not, and is \ + anti-conservative on a structured panel). Measured on BXD trait 10001 with 500 \ + rotations: both LMMs pick the same peak marker, rsm10000005700 on chr 8 (GEMMA \ + -log10 p 6.23, BulkLMM LOD 3.87), and BulkLMM's own 0.05 threshold is LOD 3.78, \ + so the peak clears it. The numbers are not interchangeable: BulkLMM's kinship \ + is one genome-wide matrix rather than LOCO, and on the same panel and trait the \ + LOCO permutation null came out lower (R/qtl2's scan1perm, 500 permutations: \ + 0.05 threshold LOD 2.62). (2) Run GEMMA's own permutation locally on the same \ + inputs -- the files this endpoint used are named in the reply's notes (the \ + bimbam pair and the phenotype file), so `gemma-wrapper --permutate` or \ + `gemma -lmm 9 --permutate` reproduces exactly the null GEMMA would use, at \ + hours rather than seconds." ), "compute_gemma", ) @@ -867,10 +871,35 @@ pub async fn compute_gemma( body.insert(key, value); } body.insert("nperm".to_string(), serde_json::json!(100)); + // The LMM approximation first: BulkLMM is the same model family as + // this scan, so a threshold from it means something for a + // relatedness-structured panel, which R/qtl's haley-knott + // permutation does not. Same peak marker on BXD 10001, 500 + // rotations in about fourteen seconds. + let mut lmm_body = body.clone(); + lmm_body.insert("nperm".to_string(), serde_json::json!(500)); + lmm_body.insert("seed".to_string(), serde_json::json!(1)); + envelope = envelope.with_action(crate::response::SuggestedCall { + method: "POST".to_string(), + href: "/compute/bulklmm".to_string(), + description: "Significance thresholds from the same LMM family: post these values \ + to /compute/bulklmm with 500 rotations (nperm=500). It permutes \ + through the kinship decomposition, so the null respects relatedness, \ + and 500 rotations cost about 14 s against GEMMA's hours. Its kinship \ + is one genome-wide matrix rather than LOCO, so treat the threshold as \ + an approximation of GEMMA's -- on BXD trait 10001 both picked the same \ + peak marker." + .to_string(), + body: Some(serde_json::Value::Object(lmm_body)), + }); envelope = envelope.with_action(crate::response::SuggestedCall { method: "POST".to_string(), href: "/compute/rqtl".to_string(), - description: "Significance thresholds: GEMMA has no permutation test, so map the same values over the same panel with R/qtl and 100 permutations (nperm=100). About 100 R/qtl scans' worth of time; pass ?id= and poll its status endpoint." + description: "A non-LMM cross-check: map the same values over the same panel \ + with R/qtl and 100 permutations (nperm=100). Its haley-knott \ + permutation ignores relatedness, so the threshold is \ + anti-conservative on a structured panel -- prefer the BulkLMM call \ + above for a null that does." .to_string(), body: Some(serde_json::Value::Object(body)), }); |
