about summary refs log tree commit diff
AgeCommit message (Collapse)Author
8 dayscorrelation: the sample-axis engine path, with the decided semanticsPjotr Prins
src/correlation.rs now holds the part the engine does not offer in memory, and nothing of the arithmetic: `Pearson`/`Spearman` and their p-values are correlation_rust's (and GSL's). What is ours is the alignment into the engine's parser, the minimum-overlap gate, the ordering and top-N: - alignment is by individual, never by position: an individual the target trait lacks becomes "NA", which the engine's parser drops together with its reference value, so a missing observation costs one pair, not the row; - minimum overlap 6, so a two- or four-point +-1 cannot appear; - ordering reuses correlation_rust's own `custom_float_sorter` -- |r| descending, NaNs last -- so GN2, GN3 and GN4 sort identically; - top-N after the sort, clamped to GN2's 20000 ceiling; - bicor is refused by name with the methods that exist, rather than answered with something else. Tests cover both methods, the six-pair minimum, name alignment across a reordered and sparse candidate, the ordering with top-N, and the method parsing. The route is still the stub; wiring it to the bulk fetch is next.
8 dayscorrelation: vendor the engine's git dependencyPjotr Prins
Cargo.toml pins gn-rust-correlation 12c2a37 from the genenetwork forge (refs/heads/main there; GitHub still sits at 473ad82). The lock grows by exactly the four packages this brings in -- correlation_rust, GSL, GSL-sys, assert_approx_eq -- and nothing else moves. Following the xapian-rs precedent for a git dependency, since guix's cargo build is offline and the registry replacement only knows crates.io: - rust-package.scm gains the git origin as a bare `origin' (not a crate-source: unpack-rust-crates copies a *directory* input into guix-vendor/, so a checkout is exactly what it wants), plus crate sources for the three new registry crates; - guix.scm lists them and adds a second source-replacement stanza beside xapian's, keyed `git+<url>?rev=<rev>` because cargo resolves a git source by the exact id in Cargo.lock; - both git checkouts get the empty `.cargo-checksum.json` stub; - gsl is a native input: the p-values come from GSL's t-distribution through rgsl, found with pkg-config at build time. One fix in the vendoring phase itself: the gawk that back-fills package checksums named vendor directories from the lock entry verbatim, which is right for lowercase crates with no underscores and wrong for `GSL` and `GSL-sys` (crate-source lowercases, via crate-name->package-name). It lowercases now, so the two agree. Cargo cannot fetch this repo at all -- its HEAD is dangling, so cargo's "fetch HEAD and every head" fails where guix's fetch-by-sha does not. Generating the lock therefore needed CARGO_NET_OFFLINE with the crate pre-cloned into ~/.cargo/git/db; nothing about that affects the build, which vendors the checkout.
8 dayscorrelations: the design decisions, and the reference is reachable after allPjotr Prins
Synchronous, no redis, no job: one POST computes and answers. Use the correlation_rust engine in-process (already packaged, rev 473ad82), reuse its maths rather than rewriting the p-value, and implement only the sort and top-N. Minimum overlap 6 (gn3/python, not the engine's 4), pearson and spearman only, the engine's exact |r|-descending/NaN-last ordering, top-N as a request option applied after the sort, and the sample axis first. Verification is against the live genenetwork.org mapping page: it answers HTTP 200 in ~31 s, so the earlier "-m 20 curl" made it look unreachable when it is merely slow. Budget ~31 s per reference page in the parity loop.
8 daysdocs: what GeneNetwork correlates, and what correlation_rust doesPjotr
Answers the question that blocks duplicating the correlation_rust path: what is actually correlated. Four kinds over three axes -- sample (one trait vs every trait of a dataset, over individuals), tissue (gene vs gene over 26-32 tissue systems), literature (a table lookup in LCorrRamin3, no n at all) and partial (conditioned, GN3 only, async). Records the engine's contract as it is: JSON in, CSV out, one trait per line positionally aligned to x_vals, non-floats dropped pairwise, rows under 4 pairs refused, output sorted by |r| descending with NaNs last, top-N applied afterwards in Python, and no bicor in the engine at all -- which matters because GN3's Python path uses a minimum of 6 and the engine uses 4. Measured read-only against db_webqtl: ProbeSetData 5 314 694 464 rows, PublishData 3 288 638, TissueProbeSetData 90 562 DataIds with 26-32 values each (avg 29.0), LCorrRamin3 127 368 780. Hence no path loads a dataset whole, and the value fetch -- not the arithmetic -- is the cost. Ends with the two shapes a GN4 integration can take (thin: keep the file dance; direct: reuse parser::parse_rows_with_names and Pearson/Spearman in memory) and the four semantics that must be decided either way.
8 daysravanan-slurm: what happens when Slurm goes awayPjotr
Measured against the slurm container, 20 chromosomes, 40 jobs: baseline 200/21 055 rows in 205.5 s; slurmrestd unreachable -> 502 in 3.7 s; container killed 45 s into a request -> 502 in 50.2 s with 0 rows (no partial results); the same request after Slurm returns -> 200 in 163.3 s, i.e. the retry reuses the steps that had finished, because ravanan's store lives in RAVANAN_CACHE_DIR and not in Slurm. So: no automatic failover, no fallback to single-machine, nothing sticky, and a retry that is cheaper than cold. The 502's detail is ravanan's Guile backtrace, so the one useful line sits at its end; a pre-flight /slurm/v0.0.41/ping would make that a 503 naming the endpoint, and there is no timeout on the ravanan child for a Slurm that accepts connections and never runs the job -- both recorded as gaps.
9 dayscache: say when ravanan's cache cannot survive a restart, and document what doesPjotr Prins
Ravanan's reuse key is (script, inputs) and both live in its --store under RAVANAN_CACHE_DIR, so the cache's lifetime is that directory's, not the container's. Measured: 13.6 s cold, then 3.6 s for the identical request after restarting the container, with the store unchanged at 14 files -- Slurm's own spool state is lost and irrelevant to reuse. The default cache dir is under /tmp, which is neither durable nor visible inside a container that bind-mounts one host path, so a job cannot read the interned inputs. The reply now carries a note when the cache dir is under /tmp, naming the fix, rather than leaving it to be discovered as a slow or failing run. docs/ravanan-slurm.md gains a "What survives a restart" table (ravanan store, scratch, token registry, gemma-wrapper cache, Slurm state) and a path checklist; the README points at it.
9 daysgemma: read ccwl's YAML when checking the workflow's inputs, and fix two ↵Pjotr Prins
stale tests `ccwl compile` emits CWL as YAML (its only other target is dot), so the new input check must read that shape -- it was parsing JSON and would have turned a working request into a 502. A hand-written scan of the `inputs:` block, deliberately not a YAML dependency: ccwl's output is machine-generated and unvaried, and adding serde_yaml would mean regenerating the crate list in guix.scm for one small check. Two tests were stale in ways only the package's own check phase shows: - tests/auth.rs built AuthToken literals without the new `scheme`/`id` fields, so the crate's integration tests did not compile; - test/python/test_envelope.py asserted that /version carries no `next` links, which stopped being true when every read endpoint gained them ("always offer the next step"). The deployed build fails that test too, so it is not a regression from this work -- but it did block `guix build -f guix.scm` at the python-rest-test phase. Verified with the packaged binary (guix build -f guix.scm, all phases including both test suites): POST /compute/gemma/ravanan through ravanan and the Slurm container returned 200 with 636 rows in 13.6 s, on a request authenticated with a gn4ai_ short token -- the log line naming user zachs, scheme opaque and token smoke-2.
9 daysgemma: refuse a workflow from another commit, by namePjotr Prins
cwl/gemma/gemma-loco.scm is read from the deployment's checkout at request time (GEMMA_RAVANAN_WORKFLOW), not compiled into the binary, so a checkout and a binary from different commits can meet. When they do, cwltool answers "Type mismatch for input `kinship_pheno_file'; expected `File' but got `null'" -- which says nothing about the cause. Found by pointing the deployed f64a708 binary at the current workflow. The compiled CWL now has its declared inputs compared with what this build is about to send, before anything is staged for ravanan: a missing input or an undeclared one is refused with both lists named, plus the instruction to take the .scm and the binary from the same commit.
9 dayslog: name the person and the credential, and resolve handles from the registryPjotr Prins
The access log said who (`user`) but not with what: with short tokens a request can be made by a shared credential, so "which person" and "which credential" are now separate fields -- `scheme` ("jwt" | "opaque") and, for an opaque token, `token` (its registry handle, e.g. `agent-ravanan-3`). Never the token or its hash, and the path still carries no query string. The line also gains `ts` (RFC 3339 UTC), so a redirected stderr file is self-describing rather than relying on journald's prefix. Hand-rolled civil-from-days rather than a new crate: one format, and no Cargo.lock drift. scripts/gn4-log.py reads such a log and shows it as a table with the handle joined against tokens.sqlite: the subject as the registry has it now (flagging a handle whose subject has been repointed), and the token's status today -- [revoked], [expired], [unknown] -- which is how "an agent was working at 14:02" is told apart from "an agent was working at 14:02 with a credential revoked since". It reads the registry read-only, passes non-JSON lines through in table mode (the process log interleaves backtraces), and offers --json and --summary for jq and for counting. CallerSlot now carries the whole Caller (scheme, id, subject) rather than just the subject string.
9 daystokens: short opaque API tokens in a single tokens.sqlitePjotr Prins
A second credential format beside gn-auth's JWT, for agents and scripts: `gn4ai_` + 56 body characters + 2 checksum characters = 64, from an alphabet with no look-alikes, so a typo is refused before the registry is consulted. Opaque by design -- nothing is stored in the token; every fact lives in one SQLite database (`tokens.sqlite`, GN4_API_TOKENS_DB, mode 0600, gitignored) keyed by the SHA-256 of the secret. Revoking is a row, takes effect on the next request, and a token in a log line reveals nothing; lose the registry and every short token stops working. Administration is local-only: GET/POST /tokens, DELETE /tokens/{id} and GET /tokens/who are behind a router layer that refuses any caller whose TCP peer is not 127.x.x.x/::1, and any request claiming to come through a proxy. A layer rather than a per-handler check, so nothing of a remote request is parsed before it is refused; there is no configuration switch, because minting credentials must never be reachable from the network. A short token reads public data only: every token-only endpoint, and `#[gnauth(secured)]` endpoints for public rows; a confidential dataset is refused with a 403 that names the JWT route, since gn-auth cannot validate an opaque token (the on-the-fly-bridge and registry-grant alternatives were both rejected for v1). scripts/gn4-token.py create|list|revoke|who drives the routes, so there is one implementation of the format and the revocation rules; the token is printed exactly once. Tests: the localhost guard over all four routes (remote peer, no peer, proxied header), and mint -> authenticate -> who -> revoke -> 401.
9 daysskills: ravanan is the default GEMMA runner, gemma-wrapper is the referencePjotr Prins
docs/www/SKILL.md: the workflow example now calls /compute/gemma/ravanan, and a new "Which GEMMA endpoint" section says when not to: Slurm down or submission failing, the user asks, a field ravanan refuses (covariates, normalization), or verifying results -- where the wrapper endpoint is the reference and scripts/gemma-compare.py is the check. docs/dev/SKILL.md: the same rule from the developer side, in Testing -- verify mapping changes by sending one body to both endpoints and never 'fix' a difference by switching endpoints, plus the reminder that the wrapper's cache only hits from 5eb53fa on, so a stale gemma-wrapper on PATH looks like a broken cache.
9 daysravanan: key the kinship step on the animal set, so K is shared across traitsPjotr Prins
gemma -gk reads the phenotype file only to learn which individuals are analysed -- the matrix comes from the genotypes -- so the workflow now gives the kinship step a constant-valued pheno file carrying just the trait's missing-data pattern, and gives gwa the real values. Verified byte-for-byte: -gk on a real trait and on its constant-valued twin produce identical .cXX.txt files, and trait 2's assoc checksums are identical whether K came from the constant pheno or the real one. Consequence, measured on the BXD fixture: a second trait over the same animals costs +1.0 MB of store and 7.5 s (20 GWA jobs) instead of +13 MB and 14.6 s (a second kinship scatter), because the 20 K matrices are identical inputs for both traits. Three keys now: workflow (the ccwl source), kinship (genotype + snps + lmm + the NA pattern) and trait (kinship key + the values), so the compiled CWL and the kinship pheno file are shared and only the trait's pheno file and inputs YAML are per-trait. This is also stricter than gemma-wrapper's own key, which ignores the phenotype entirely and would reuse a K computed for a different set of animals.
9 dayslogs: one access line per request, naming the callerPjotr
The proxy logs the caller through x-gn4-user, but the process log -- the one an operator tails while a job runs -- named nobody, so "who started this GEMMA run" meant going to the nginx log or guessing. genenetwork4 now writes one compact JSON line per request on stderr: {"event":"request","method":"GET","path":"/groups/BXD","status":200, "took_ms":10,"request_id":"…","user":"zachs"} Decisions in it: `user` is absent, not "-", when no token was verified (a dash is a value a reader can mistake for a user name); the path is logged without its query string, because a query can carry a credential and has no business in a log; the token value itself is never logged, only its subject; and the line carries the `request_id`, so it sits beside the existing `event: error` lines for 5xx and one grep joins a failure to the request that caused it. `GN4_ACCESS_LOG=false` turns it off where the proxy's log is the record of truth. Verified on a probe instance: with the test token the line says user "gn4-test-stub", with zachs's token user "zachs", and an unauthenticated 401 has no user field at all. docs/www/operator-checklist.md claimed "genenetwork4 does not log the token's sub" -- true until now, which is exactly the kind of sentence that rots; it is replaced by the line above, what it contains and what it deliberately omits. README's x-gn4-user paragraph gains the same, next to the identity it already described.
9 dayscwl: record the cold and warm LOCO timings, Slurm includedPjotr Prins
Full 20-chromosome LOCO mapping on the BXD fixture: 14.3 s cold and 1.6 s warm single-machine, 275.6 s cold and 1.6 s warm through the Slurm test container -- 40 jobs, 7320 rows, identical .assoc.txt checksums in every case. Slurm costs ~6.9 s per job here against ~0.36 s single-machine, which is container and scheduling overhead rather than gemma: the first request is cheaper locally, and only a repeated request (answered from ravanan's store) is fast either way.
9 daysdocs: always offer one sentence of what to do next, unless disabledPjotr
The API already computes every reply's options -- `next` are GETs that answer 200, `actions` are the POSTs to run next -- and a caller that reads them learned nothing extra from being told "you could now do X" in prose. What was missing was the instruction: an answer that stops at the result leaves the reader to work out the graph. docs/www/SKILL.md gains "Always offer the next step": end every answer with ONE sentence built from that reply's own next/actions -- after a compute run, a lookup, a plot, an upload, a basket edit. Prefer the action href over a hand-built call. A refusal is an answer too: its next or detail names the alternative (bulklmm for a GEMMA permutation, /compute/gemma for a covariate fit). Do not stack suggestions; one next plus at most one genuinely different alternative. "Skip the suggestions" / "just the result" turns it off for the session -- it is the sentence that is disabled, not the content. And never propose a step the API cannot do: if nothing in next/actions fits, say so. README states the same bargain where the next-link promise is described: the server's half is that the suggestion is always reachable, the assistant's half is that it is one sentence and it is a link the reply actually carries.
9 daysravanan: name the workflow inputs by content, so a repeat request is warmPjotr Prins
compute_ravanan wrote <pid>-<nanos>-pheno.txt, -ravanan-inputs.yaml and -gemma-loco.cwl, so ravanan's (script, inputs) work-reuse key was new on every call and a repeat of the identical request recomputed all 40 steps. Naming them by a hash of the request's inputs (genotype path and size, snps contents, trait values, lmm) makes an identical request hit the store instead. Measured on the BXD fixture, full 20-chromosome LOCO mapping, single-machine: 14.3 s cold, 1.6 s warm, identical .assoc.txt checksums. For comparison the gemma-wrapper stack costs 11.9 s cold and 12.1 s warm -- its own cache did not hit on a repeat here -- so the ravanan path is now the cheaper one for any repeated request and the slightly dearer one for a first request. The run log stays per-call: it is what a caller streams by run_id. The three shared files are written aside and renamed, so two concurrent identical requests cannot read a half-written file.
9 daysravanan+gemma: call gemma itself, not gemma-wrapperPjotr Prins
gemma-wrapper was doing two things ravanan now does or GEMMA already does: the parallel fan-out (ravanan's CWL scatter replaced it long ago, which is why every job passed --no-parallel) and LOCO orchestration -- gemma 0.98.6 documents `-loco [chr]` natively for both -gk and -lmm and takes the annotation file it needs. What was left was a content-hash K cache and a --json record with results packed into .tar.xz archives. So cwl/gemma/gemma-loco.scm now runs two gemma invocations per chromosome: `-gk -loco <chr> -o <chr>-kin`, then `-k <that matrix> -lmm <n> -loco <chr> -pve -o <chr>-gwa`, with `-outdir .` for flat, deterministic names. The kinship matrix travels from one step to the other as a CWL File output, and each job's .assoc.txt and .log.txt are the workflow's outputs -- so compute_ravanan reads files instead of parsing a wrapper JSON record and unpacking archives, and the pve note comes straight out of the jobs' logs. Measured on tests/test_data/BXD (chr 1 and chr 2): identical rows -- 636/636 and 583/583 on beta, se, l_mle, p_lrt. One chromosome end to end: 496 ms (gemma) vs 1140 ms (wrapper), 2.3x per job. The wrapper also needed Ruby and pfff on PATH, and named its outputs with the extension doubled (...1.assoc.txt.assoc.txt). /compute/gemma keeps gemma-wrapper, deliberately: that is what makes the two endpoints comparable rather than two copies of one stack. scripts/gemma-compare.py runs the same body through both and reports row-level differences and timings. The gemma-wrapper content-hash K cache is the one thing given up; a repeat request recomputes (271 ms of kinship on this fixture).
9 daysgroups: the design in /groups/{group}, and a drift check against GN2's ParInfoPjotr
Two follow-ups to the parental-design endpoint. /groups/{group} now carries the headline in its notes -- "Parental design: C57BL/6J (maternal) x DBA/2J (paternal), F1s B6D2F1 / D2B6F1; a mapping excludes the parents and F1s by default" -- plus a next link to the full design. "Which cross is this?" is two strain names, and needing a second request to see them was the only reason the endpoint had to be called first. A group with no metadata says so in the same note, pointing at parents_and_f1s.json and at `individuals.exclude`, rather than leaving the reader to wonder why nothing was dropped. The metadata is the same fact in two places (GN2's ParInfo, our JSON) and it drifted once already, silently: the paternal/maternal labels were swapped against GN2's unpacking, and nothing noticed because the exclusion rule takes both strains regardless of role. scripts/check-parental-metadata.py parses ParInfo with ast (no gn2 import) and compares it group by group, reporting disagreements per role and treating groups the JSON knows but GN2 does not as informational. tests/parental_metadata.rs runs it while a GN2 checkout is present (GN2_CHECKOUT, or a sibling path) and skips once GN2 is retired -- at which point the JSON is the only copy and there is nothing to drift from. It reports 23 groups reproduced, 1 extra (BXD-Longevity).
9 daysgroups: an endpoint for a family's parental designPjotr
GET /groups/{group}/parents-and-f1s answers the question the mapping notes only implied. It reports the F1 strains, the maternal and paternal strain (from the deployment's parents_and_f1s.json, ported from GN2's ParInfo -- all 24 groups), the @type of the group's genotype file, the individuals each role names where the metadata names them (BXD-Longevity does, most do not), and -- the part a caller needs -- which members of the current panel the default rule drops and which the `F1` name heuristic catches. Two things that came out of building it and comparison with GN2: * the JSON's paternal/maternal labels were INVERTED against GN2's reading. GN2 unpacks ParInfo as `f1, f12, maternal, paternal`, so BXD's maternal strain is C57BL/6J; our file said paternal. No mapping was affected (non_strains takes both regardless of role) but the metadata was wrong, and anything using "maternal" later -- reciprocal F1 direction, the @mat/@pat note -- would have been backwards. The file is rewritten from ParInfo itself (ast-parsed, not retyped), 23 groups' roles filled in and the 24th (BXD-Longevity, which GN2 does not have) left as it was. * an RI set has two kinds of F1 name: the design's (B6D2F1) and the panel's own intercross individuals (C57BL/6JxBXD037F1). The endpoint reports excluded_from_panel and excluded_by_name separately and says which is doing the work, because "0 declared, 37 by name" is otherwise confusing. Empty F1 names (C57BL-6JxC57BL-6NJF2 has two) are dropped rather than becoming exclusion entries that match nothing. genotypes::non_strains is rebuilt on the same typed parser (DesignRole / ParentalDesign), so the rule and the endpoint cannot disagree. tests: a unit test for the roles, empty-name handling and the unlisted-group source, and an integration test asserting BXD's maternal/paternal orientation and the note.
9 daysindividuals: select who enters a mapping, by namePjotr
Parents and F1s are excluded by default (as in GeneNetwork2/3), with include_parents_f1 to keep them all. That boolean was not enough for what was asked -- "include these, drop that substrain" -- and the exclusion list itself is data (parents_and_f1s.json, seven groups) that no request can reach. F1 names also differ per group (B6D2F1 for BXD, BHF1/HBF1 for BXH, C57BL/6JxBXD037F1 for the intercross F1s), so pattern matching is the wrong tool. Every group-mapping endpoint -- /compute/gemma, /compute/gemma/ravanan, /compute/rqtl, /compute/qtl2, /compute/fitqtl, /compute/bulklmm -- now takes "individuals": {"include": [...], "exclude": [...]} applied after the parent/F1 rule, exclude winning over include. An unknown name is a 422 invalid_individuals whose message lists the panel: a silently dropped animal changes a kinship matrix without anyone noticing, so the failure has to be loud. genotypes::select_panel is the one implementation, and it returns what it did (dropped parents/F1s, re-included by name, excluded by name) so the Genotype note can say it: "197 individuals, 38 parents/F1s dropped; 1 excluded by name". The note now also spells out the distinction that makes this option treacherous: the kinship uses *every* individual in the genotype file, the association uses only those with a trait value -- GEMMA reads no phenotypes for the kinship. So "include the F1s" changes the relatedness structure without putting the F1s in the fit, and a request can legitimately have 234 individuals in the genotype file and 34 in the association. Verified on BXD.8: excluding BXD1 gives 197 individuals / 33 values; include_parents_f1 with an F1 re-included and a substrain excluded gives 234 / 34. A basket supplies values by name, so a selection applies to a basket-fed mapping the same way: the individuals excluded are simply not in the panel any more, and their basket values are ignored. GenotypeError gains Invalid for this (422) so a caller's typo is not reported as a missing genotype file; the read-only endpoints that can never see one map it the same way for exhaustiveness.
10 daysbnw: module scores as trait values, and BNW's worked examplesPjotr
Two additions that make the endpoint usable rather than merely correct. POST /compute/bnw/features -- from a network to a mappable trait. Every node with at least one parent at the threshold is a module (the node plus its parents), scored per sample by the first principal component of the module's standardised members, sign-corrected so the score rises with the node. Without ?module= the reply is one row per module -- module, members, size, variance_explained -- where variance_explained says whether the score is a fair summary at all. With ?module=NAME it is that module's per-sample scores in the {name, value} shape every mapping endpoint already takes, so the chain runs network -> module -> /compute/rqtl or /compute/gemma with no translation layer. That is what BNW is for in GeneNetwork; the diagram is a by-product. The notes name the construction (a citable module score must say what it is) and repeat the caveat: a module is a correlation structure, not a QTL. GET /compute/bnw/examples and /compute/bnw/examples/{name} -- BNW's own worked examples, for an agent to explore instead of inventing data. The five datasets its tutorial and examples pages present are listed with their sizes, and each is served as a matrix in the values shape /compute/bnw takes, with a ready-to-post action carrying the body. ?columns= restricts the matrix (the spleen example has 14 variables and a caller may want fewer). genotype_column warns that a column is a genotype code: this driver is continuous-only, so it enters the network as a number, the way the web application's GeneNetwork path treats it. Files come from BNW_EXAMPLES_DIR (a gn-bnw checkout's sourcecodes/ example_datasets); a deployment without it answers 404 no_examples. Measured on the dev instance: features over five BXD traits gives two modules (BXD::10001 with BXD::10003 and BXD::10041, 60.4% of variance; BXD::10044 with BXD::10001, 27.2%), and BXD::10001's 19 scores posted straight to /compute/rqtl and /compute/gemma both return 200 -- gemma peaks on chromosome 6. tests/bnw.rs covers the module list, one module's scores in mapping shape, the unknown-module 422, the example list, one example's matrix and its ready-to-post action, and a 404 for a name that does not exist.
10 daysplot/bnw: two SVG figures, drawn the way /plot/gemma draws onePjotr
Post the reply from /compute/bnw back and get an SVG: the same plumbing as /plot/gemma and /plot/bulklmm (plot::render, PLOT_PYTHON + BNW_PLOTTER, image/ svg+xml, the plotter's line in x-plot-summary), nothing recomputed. Two figures, because one cannot say what the other can: * the network (default): nodes on a circle, one arrow per edge that survived the threshold, arrow width and label = the edge's posterior, and the below-threshold edges as faint dotted lines -- so a reader sees what was *considered* as well as what survived, which is half of why the posterior table exists; * ?kind=posterior: every candidate edge as a cell in a matrix, dark = high posterior, outlined cells are the ones above the threshold. The diagram cannot show that an edge came within 0.02 of the threshold; this can. Pure-Python SVG, standard library only: no graphviz in the deployment. A circular layout is less pretty than a force-directed one and is deterministic, which matters more for a figure that accompanies a JSON result. Node labels keep the distinguishing tail of a long id, with the full name beside the node. Verified live on the dev instance: POST /plot/bnw with a saved /compute/bnw reply returns 200, image/svg+xml, 5 256 bytes, and x-plot-summary naming the strongest edge (Trait2 -> Trait1, posterior 1.000); ?kind=posterior returns the second figure. tests/plot.rs covers both figures plus the 422s (not a BNW result, unknown kind).
11 dayscompute/bnw: a Bayesian network over traits, called out to BNW's driverPjotr
POST /compute/bnw learns a network over a set of variables and returns one row per candidate edge: from, to, posterior, in_structure. Inputs are published traits of a group (group + traits) or an explicit matrix (values: one entry per variable with per-sample values), which covers the case the database cannot -- a basket's columns, a handful of probe sets. BNW's knowledge stays in the gn-bnw repository. GN4 writes a variables x samples matrix, runs `bnw learn` (BNW_CMD, BNW_BIN_DIR, BNW_CACHE_DIR) and parses the reply: nothing about the three C programs, the private work directory or the type line in the input file lives here, so BNW's pipeline can change without a GN4 release. The driver's failures map onto the API's own: bad input 422, a missing driver 502 bnw_not_installed (its exit 77), a failed computation 502 bnw_failed in the driver's words. Decisions worth recording: * parameters are BNW's own defaults -- maxparents 4, k 1, tiers 3, threshold 0.5, read from its create_tiers_gom_part1.php rather than chosen here -- and the reply names the values used, because a network at 0.5 and one at 0.9 are different answers to the same question; * at most 40 variables and at least 3 samples complete across every variable. The first is the structure search's exponential in-degree; the second is BNW modelling a complete multivariate normal, so a sample missing any value is dropped -- and the note says how many survived rather than silently shrinking the panel; * its own gate, always claimed (threshold 0): there is no such thing as a small BNW run, the cost is the search, not the number of individuals; * the notes say plainly that a posterior is not a p-value and that a network is not a QTL, because that is the easiest thing to over-read. tests/bnw.rs compares the endpoint against the answer the BNW *web application* gives for its own six-trait example (the same fixture as the driver's parity check, gn-bnw/test/golden/): the five edges must match, and the notes must name the parameters and carry the caveat. It skips when the driver or its binaries are absent. Not deployed to production.
11 daysdocs: say that project memory is how a session recovers, and where it livesPjotr
The ai-memory store already existed; what was missing was any mention that a reader should use it before starting work, and what they would find. Two concrete things a cold reader needs and cannot reconstruct from a diff: an operational RUNBOOK entry (the Slurm container from gn-machines, its fixed JWT, the environment /compute/gemma/ravanan needs, the four prerequisites that bit the first time, and the fastest test: one chromosome, 14 s), and the "why is this like this" entries behind endpoints that exist because something else was wrong (-pve reporting, the next-link graph, the reference-genome linkage). docs/www/SKILL.md gains section 7a with the three query forms, the topic names that exist (ravanan-slurm, reference-genomes, gemma-pve) and both measured costs; README gains the same note under Development, since that is where a maintainer looks first. States the limit honestly: the store is local, gitignored and per repository -- it survives a cleared session, not a lost machine, which is why every conclusion is also in a commit message and in these docs.
11 daysgemma/ravanan: resolve the same inputs as the direct runner; refuse what it ↵Pjotr
cannot do Two gaps, both invisible until a real request ran against a cluster. The endpoint read only genotype_file, snps_file and trait_values from the request; group, genotype_version and samples were accepted by the shared request type and silently dropped. A /compute/gemma-shaped request (group + samples) therefore arrived as empty paths and empty values and died with "I/O error: No such file or directory (os error 2)" from reading "". Running it exposed the second gap in the same breath: the gate sized the request from trait_values.len(), so a samples-only request was sized 0 and took no concurrency slot at all. resolve_inputs is now one function in routes/gemma.rs, called by both handlers: upload materialised into the pair the engine reads, basket resolved to named values, group prepared with the parent/F1 and empty-genotype rules, named samples aligned by name onto whatever individuals the file has, positional values checked against the panel size. That block was ~250 lines of duplicated rules inside compute_gemma, which is how it drifted in the first place; the direct runner now calls the same function and keeps only its covariates, normalization and gate. The ravanan reply also carries the input notes now (which genotype version, how many values aligned, what was dropped), so a run says what it mapped as well as where the peak is. Refused rather than ignored, because the CWL workflow has no step for either: covariates (422 covariates_not_supported) and normalize (422 normalization_not_supported), each naming /compute/gemma as the endpoint that can do it. A new test asserts both refusals happen before any job is submitted, so it needs no ravanan, ccwl or cluster. Verified against the Slurm container from gn-machines: group: BXD became 40 Slurm jobs (20 kinship + 20 GWA, scattered over the snps file's chromosomes), all completed, 21 055 rows in ~3.5 min. README and docs/ravanan-slurm.md record the four requirements that run turned up, three of them not obvious: ccwl on PATH, a ravanan build with the --slurm-api-endpoint fix, the *server's* HOME writable by the job user inside the cluster (gemma-wrapper locks $HOME/.<hash>.lck there), and GUIX_PACKAGE_PATH for the manifest.
11 daysdocs: which reference genome the coordinates are on, and what the index coversPjotr
Two things a reader needs before quoting a position from this API, both measured against db_webqtl rather than inferred from the schema: - No table stores an assembly id. The only labels are prose in Species.MenuName: human hg19, mouse mm10, rat "mRatBN7.2/rn7", fly dm6, nematode ce10, arabidopsis araTha1, medaka Oryl23, bat gsor23, killifish MPIA_NFZ_2, tomato GCF_001406875.1, soybean JGI-PGF v2 2021, barley and poplar unlabelled. - Every position column exists in three generations (Mb, Mb_2016, legacy mouse Mb_mm8; likewise Length/Length_2016/Length_mm8 on Chr_Length) and the labels do not all match the numbers. Human is hg19 in both generations (chr1 249,250,621; SOX2 chr3 181.43, not hg38's 181.71). Mouse Length_2016 chr1 = 197,195,432 is mm9 exactly, while current Length = 197,426,691 matches no standard build -- but mouse probes are mm10-era (Sox2 chr3 34.5). Rat current Length chr1 = 282,763,074 is rn6 exactly, though MenuName advertises rn7. Geno.Mb_2016 exists only for human, mouse, soybean, barley; the mouse-named Mb_mm8 is populated for barley too. docs/search-engines.md gains the coverage side: the index is a projection of MariaDB with no species filter (only confidentiality < 1 AND public > 0), so 14 species -- every Species row with public data -- with 44,842,506 gene and 22,601 phenotype documents, dominated by mouse (27.7M), human (15.2M) and rat (1.4M). The crawl reads the *current* columns, so the index inherits hg19 / mm10-era / rn6-era coordinates, never a modern assembly; and rat positions deserve suspicion (Sox2's 44 probes span chr2 1.2-117.6 Mb).
11 daysdocs: /compute/gemma/ravanan reports pve too, from its archivesPjotr
Says where the numbers come from and why that differs from /compute/gemma: a ravanan job runs the gemma-wrapper its own Guix manifest resolves, so the copy kept beside an archive (a 5eb53fa feature) may not exist there -- the .log.txt inside the archive always does, and compute_ravanan unpacks the archive anyway for the .assoc.txt.
11 daysgemma: pve on the ravanan/slurm path, read out of each archivePjotr
The ravanan path asks for the same variance components as the direct one: gemma-loco.scm's gwa step passes -pve, so each chromosome's job writes pve/se(pve)/vg/ve into its own .log.txt, and compute_ravanan turns them into the same note (every chromosome, plus the extremes with vg/ve) and the same unrounded "variance:" lines in the ?id= run log. It reads them from the extracted GWA archive rather than from the copy gemma-wrapper keeps beside it, and that is the point of doing it here: the copy beside the archive is a 5eb53fa feature, while a ravanan job runs whatever gemma-wrapper its own Guix manifest resolves, which need not be that new. The .log.txt has always been inside the archive, and the archive is unpacked anyway for the chromosome's .assoc.txt -- so read_variance_components_from_logs labels each log by the "-loco <chr>" in its command line, falling back to the <hash>.<chr>.assoc.txt.log.txt file name, and sorts chr1..chrX. Verification, precisely: the CWL compiles with -pve (ccwl compile, checked by hand), the archive reader is unit-tested (labelling from the command line, from the file name, numeric ordering, a log without the block dropped), and a real archive from this deployment does carry the block. An end-to-end ravanan request could NOT be completed on the dev box, for reasons that have nothing to do with -pve and are now written down in docs/ravanan-slurm.md: ravanan's own Guix evaluation of the manifest fails ("rust-pyo3-0.26.0: unbound variable" -- the ambient channel set, since the production process does not set GUIX_PACKAGE_PATH at all, so this endpoint cannot resolve gemma-wrapper there), its intern of inputs hard-links and so needs store and inputs on one filesystem ("Invalid cross-device link"), and the one job that did start sat "Waiting for lock" on gemma-wrapper's $HOME/<hash>.lck until the call timed out.
12 daysgemma: the pve note carries every chromosome, and the log carries the numbersPjotr
The note reported the range and named the two chromosomes that bounded it, which is not enough to answer the question the numbers exist for. Under --loco each pve belongs to a *different* kinship matrix, and GEMMA's per-chromosome .log.txt files live on the server -- so a caller told "0.31 to 0.95" could not ask which chromosome was which, or compare a single chromosome against BulkLMM. The note now lists all twenty, compactly, with the range and the two extremes keeping their vg/ve: GEMMA -pve, null model, per chromosome (LOCO): chr1 0.6674±0.3451, chr2 0.8426±0.3668, ..., chrX 0.8563±0.3525. That is pve 0.3118 to 0.9549 over 20 chromosomes; lowest chr8 pve 0.3118 ± 0.5009 (vg 23.3659, ve 12.3389), highest chr7 pve 0.9549 ± 0.3570 (vg 76.0933, ve 0.8661). and streaming::append_lines puts the unrounded values in the run log as variance: chr7 pve=0.954938 se_pve=0.357032 vg=76.0933 ve=0.86612 so a ?id= run's /compute/gemma/status stream carries them while the run is still in flight, rather than only in a reply someone has to keep. Both measured on BXD::10001 through the dev server before committing. The values are printed with four significant figures (scientific when the magnitude needs it), unchanged: rounding variance components to four decimals was the earlier bug, and these are the same numbers a reader compares with BulkLMM's h2. Docs: README's /compute/gemma section, SKILL's gemma bullet ("quote per-chromosome values, not an average: they are twenty different kinship matrices") and docs/bulklmm.md's example.
12 daysbulklmm: report Julia's error line, not its last linePjotr
A failing scan came back as BulkLMM failed: in expression starting at scripts/bulklmm_scan.jl:26 which names neither the package nor the reason. Julia had said it plainly, two lines up: ERROR: LoadError: ArgumentError: Package CSV not found in current path. - Run `import Pkg; Pkg.add("CSV")` to install the CSV package. The complaint finder looked for a line starting "Error" -- Julia writes "ERROR:" -- and fell back to the last non-empty line, which is the line number. That is the same defect as gemma-wrapper's Ruby backtrace, in our own error handling: the wrapped tool said why, and we threw it away. julia_complaint takes the first ERROR:/LoadError line plus Julia's hint line when there is one, with the last line kept only as a fallback for a driver that fails silently. Three unit tests cover the three shapes. The integration tests also stop failing on a half-instantiated Julia project: bulklmm_available used to accept any directory with a Project.toml, and /tmp/gj-env has one naming BulkLMM and nothing else, so the scan died on `using CSV` instead of skipping. It now requires the project to name the three packages the driver loads, which is what a usable env is.
12 daysnext: every link a client is offered is a call it can makePjotr
tests/envelope.rs follows every href in every reply, and running it end to end found six that were not addresses: - /species, /species/{name}/datasets and /groups/{group}/datasets offered /species/{species} and /datasets/{dataset} -- templates, which 404 when followed. Each now points at a real row from the listing in hand, and the description says any other name can go in its place. - /datasets/{name} offered /datasets/{dataset}/probesets/{probeset}: the listing it already links is the callable one, so the shape moved into that link's description. - /traits/{dataset}/{trait}/values offered a GET /traits/{ds}/{trait}/correlation, which does not exist: correlation is POST /compute/correlation and that reply already carries it in "actions". Removed, with the reason written where it was. - the same reply built its /groups/... links from the *dataset* name. BXDPublish's traits live in group BXD, and /groups/BXDPublish/phewas is a 404 (no genotype files for it). db::get_group_name resolves the group from InbredSet.Id and the links use it; when a dataset has no group the group links are simply absent. - /groups/{g}/phewas with no parameters is a 422 ("give either locus, or chr and mb"), so that link is now a shape with placeholders. Placeholders stay where the caller must supply a value (.../markers/{marker}/classes?trait={trait_id}), but the crawl now skips them only when the description says what to fill in -- otherwise a client reading the next list cannot tell a call from a template. Two stale expectations alongside: /version carries the root links now (it is the natural first call), and /search's results put its own follow-ups first and the root links after them. Tests are honest about their environment too: links skips when no search index is configured (an empty XAPIAN_DB_PATH answers 502), and the envelope crawl exempts /openapi.json, the API document, which is deliberately not enveloped.
12 daysdocs: the two engines agree on heritability -- measured, not assertedPjotr
Once both engines' variance components were readable, BXD::10001 (34 animals) gives: BulkLMM, global null h2 = 0.819 (sigma2_e 5.381) GEMMA, LOCO per chr pve 0.3125-0.9558, median 0.8015, mean 0.7769 0.80 against 0.82. The engines never disagreed about the variance split; they disagreed about which chromosome's kinship to hold the rest of the genome out from. That closes the question this comparison started with. Also says how to quote them: GEMMA's pve with its range because it is per chromosome, BulkLMM's h2 as one number because it is global, and neither set of p-values against the other.
12 daysdocs: how pve gets deployed, and what the deployed box runsPjotr
GEMMA_WRAPPER_CMD is the lever: the profile's gemma-wrapper may be older than the pin, and pointing the variable at the store path is enough -- -pve reaches GEMMA either way, but the per-run .log.txt files where pve lives are only kept beside the archive from 5eb53fa on. Recorded the verified production state too: both processes restarted with gemma-wrapper-1.00-pre1-4.5eb53fa, and POST /compute/gemma for BXD::10001 on the running instance returns pve 0.3125 to 0.9558 over 20 chromosomes -- measured there, not on a fixture.
12 daysgemma: report GEMMA's own pve for the null modelPjotr
The GWA step now passes -pve, and the reply gains a note with the variance components GEMMA computed for the null model. Under --loco there is one per chromosome, so the note gives their range and names the two that bound it: GEMMA -pve, null model, per chromosome (LOCO): pve 0.3118 to 0.9549 over 20 chromosomes -- lowest 8 pve 0.3118 +/- 0.5009 (vg 23.3659, ve 12.3389), highest 7 pve 0.9549 +/- 0.3570 (vg 76.0933, ve 0.8661). That is BXD::10001 measured, not assumed. pve is the proportion of variance the kinship explains -- the same quantity as /compute/bulklmm's h2, per chromosome rather than genome-wide -- which is what the 16627/16769 comparison against BulkLMM needed. Reading the numbers took three decisions worth stating: - Four decimals is wrong for variance components. The first live run reported 'vg 0.0000, ve 0.0000' for a BXD::16769 null fit whose real components are 3.411e-5 and 3.411e-10 -- both rounded to zero, which reads as 'no variance' when the split is 1.0. Components are printed with four significant figures, scientific when the magnitude needs it, the way GEMMA's own logs do with %g. - se(pve) is -nan on a boundary, and Rust parses -nan as a NaN f64, so the numeric parse alone let it through as NaN. Non-finite values are now 'not available': a boundary estimate has no standard error. - Twenty chromosomes of values bury the other notes, and every value is in the .log.txt beside the archive anyway, so the note names the ends. Requires gemma-wrapper 5eb53fa, which keeps each run's .log.txt beside its archive instead of only inside the .tar.xz. Docs: README's /compute/gemma section, SKILL's gemma bullet (compare pve with h2, never vg with sigma2_e -- pve is scale-free), and docs/bulklmm.md's 'what would settle it', which now says the plumbing is in rather than pending.
12 daysdocs: GEMMA's pve is one flag away, not a dead endPjotr
Tested -lmm 9 with -pve on a synthetic BIMBAM trio (40 individuals, 60 markers, GEMMA 0.98.6): the flag is accepted and the log carries ## pve estimate in the null model = ... ## se(pve) in the null model = -nan ## vg estimate in the null model = 0 ## ve estimate in the null model = 0 So what was missing is plumbing, not support. Two gemma-wrapper changes are in its working tree (5eb53fa): the per-run logs are copied beside the archive -- they were only inside the .tar.xz -- and a failing child's own ERROR lines are printed before the Ruby backtrace. Once pushed and pinned, /compute/gemma can pass -pve and report pve/vg/ve per chromosome beside l_mle, which is what the 16627 and 16769 comparison needs. Also recorded: on random data GEMMA returns se(pve) = -nan with vg = ve = 0, so a boundary pve is a direction rather than a proportion -- the same caveat as BulkLMM's h2, from the other engine.
12 daysdocs: -pve is untested, not refutedPjotr
The earlier note said passing -pve crashes gemma-wrapper. It does not -- my hand-made invocation fails identically with and without the flag, inside the parallel batch of per-chromosome jobs, so the flag was never isolated and its compatibility with -lmm 9 under --loco is unknown. What that control run did find is the real defect: the wrapper does not surface the failing job's error (the batch's stderr goes to a temporary directory that is removed), which hides every GEMMA failure, not just this one.
12 daysdocs: how far the GEMMA pve route gotPjotr
Tried it: passing -pve through gemma-wrapper after -- crashes the wrapper (Ruby backtrace, no output), and the logs the wrapper keeps are the kinship step's -- 223 .log.txt in the cache dir, none containing a pve block, because the per-chromosome LMM logs live in the wrapper's temp dirs and are not retained. Two routes remain, both written down: run GEMMA ourselves (-gk for a text K matrix, then -lmm 1 -pve on one marker, seconds each) and parse 'pve estimate in the null model'; or get -pve into the wrapper's allowlist upstream. The first needs the kinship as plain text, which the wrapper only caches as JSON.
12 daysdocs: why the two engines' h2 disagree, and the three measurements that ↵Pjotr
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.
12 daysgenes: the alias reply carries the entity's label and its gene link-outsPjotr
The GTEx problem -- it is human-only, and a mouse symbol there is an empty report -- is answered by the endpoint that already knows which entity it matched: /genes/{symbol}/aliases now returns label the entity's canonical symbol in that species ("Shh" for mouse, "SHH" for ?species=human) -- the symbol a human-only service needs links [{name, href, description}] built for that symbol and species: RGD, MGI, BioAlliance, NCBI Gene, Wikidata (the QID), UniProt, STRING, GeneMANIA and GeneCup, plus GTEx/Open Targets/Protein Atlas/GWAS Catalog for a human entity or BioGPS/Allen Brain Atlas for a mouse one So a mouse Shh reaches GTEx through the human ortholog's label rather than a guessed one, and a client no longer holds the URL vocabulary. Only links that answer are built: HomoloGene, UniGene, Genotation, GeneBridge and PhenoGen are gone, and Panther is browser-only (see SKILL.md "Gene link-outs", where each URL was checked). A cached entity written before the label was kept is refreshed rather than served -- otherwise the link-outs would be built on a symbol it does not have -- and `stale: true` still says when Wikidata was unreachable and the cached answer was used. tests/wikidata.rs: a mouse gene gets the mouse services and no GTEx; the human ortholog gets label SHH and a GTEx href built from it. Both halves skip when the reply is stale, since a Wikidata timeout is not a failure.
12 daysdocs: the gene link-outs GN2's trait page offers, checked and tabletedPjotr
GeneNetwork2's webqtlConfig.py holds the link-out URLs its trait page shows by gene symbol; twelve of them were still alive when checked (2026-11-11, HTTP 200 and, where the page is not a JavaScript shell, the gene found), and the SKILL now carries them as a table with descriptions and the URL templates to hand a user: RGD (gene search, mouse/rat/human -- the best single hub for both rodents), MGI, Alliance of Genome Resources, NCBI Gene, Wikidata (the QID /genes/{symbol}/aliases already returns), UniProt (symbol search or accession), Ensembl (gene id), GTEx (human symbols only), STRING, GeneMANIA (per species), Open Targets, Human Protein Atlas, GWBI GWAS Catalog, BioGPS, Allen Brain Atlas, GeneCup. Named so they are not offered by mistake: HomoloGene (NCBI retired it 2021), UniGene (410), Genotation and GeneBridge (dead), PhenoGen (404), chibi GEMMA, wiki-Pi; PANTHER answers 403 to a bot but works in a browser. Two conventions: quote the species the symbol came from, and pick the species-appropriate service (a mouse symbol in GTEx is an empty report). The API hook is noted but not built: a `links` array on /genes/{symbol}/aliases, so a client need not hold the URL vocabulary.
12 daysplot/bulklmm: the 0.05 and 0.01 lines, never 0.10 unless askedPjotr
Checked what the plot actually draws: it has never drawn the alpha 0.10 line -- the plotter matches 0.05 and 0.01 only. What lists all three is the reply's notes ("alpha 0.01: LOD 4.58, alpha 0.05: 3.65, alpha 0.1: 3.50"), which is where the 0.10 came from. Still, the point stands on its own: 0.10 is the loosest bar in the set and drawing it invites reading it as the line to clear. So the defaults are stated and pinned -- 0.05 and 0.01 on the plot, 0.10 only on request (?all_thresholds=true, or an explicit ?thresholds=) -- alongside GEMMA's Bonferroni, which is opt-in for the same reason: a reference line is an annotation, not a result. tests/bulklmm.rs counts the lines: exactly two by default, and no alpha 0.10 label.
12 daysdocs: say that /plot/gemma draws no line unless one is asked forPjotr
The OpenAPI description still promised "a Bonferroni reference line by default", and GEMMA's own suggested plot call said the same. Both now say what the code does, and where the number comes from: the plotter computes 0.05 over the analysed markers -- conservative under linkage and unrelated to relatedness -- and ?thresholds= takes one computed elsewhere, each line labelled with its source. Also corrected in the README's /plot section and in SKILL.md, where the same promise had been copied.
12 daysplot/gemma: no reference line by default; Bonferroni is one more labelled linePjotr
A line on a plot is an annotation, not part of the result, so the default is now no line at all. GEMMA's Bonferroni becomes opt-in like any other: ?bonferroni=true GEMMA's own line, labelled ?thresholds=3.65&threshold_labels=… another engine's, labelled (nothing) just the scan Which means a reader sees exactly the lines someone chose, each with its source in the label -- and the accidental "this plot says significant" impression of a default convention line is gone. The plotter's summary and its <desc> no longer mention Bonferroni unless it was drawn. tests/plot.rs: the plain plot has neither line; with thresholds the two BulkLMM lines are labelled and Bonferroni is absent; with ?bonferroni=true GEMMA's own line appears.
12 daysplot/gemma: draw thresholds computed elsewhere, labelled with their sourcePjotr
GEMMA has no permutation test here, so its plot carries a Bonferroni line. A threshold from /compute/bulklmm belongs to a different null and must not look like GEMMA's, so it is passed in and named: POST /plot/gemma?thresholds=3.50,3.65 &threshold_labels=bulklmm%20alpha%200.10,bulklmm%20alpha%200.05 Each is drawn dashed in the series colour with "label: value" beside the line, with GEMMA's Bonferroni line still there, and the plotter's x-plot-summary names the reference lines it drew. A threshold that is not a positive number is a 422 invalid_threshold rather than a silent omission. /compute/bulklmm's reply offers that href already, with its alpha 0.05 threshold filled in -- so "same values, two models, one picture" is one link from the scan, and the labels keep the two nulls apart. tests/plot.rs: the plain plot has no bulklmm line; with thresholds both are drawn and labelled; a non-numeric threshold is refused.
12 daysbulklmm: report the variance components, and say what a boundary meansPjotr
"is the kinship term doing anything?" should be answerable from the reply. The driver now prints h2 and the residual variance under the null model, and the reply carries both: Variance components: h2 = 0.000000, sigma2_e = 0.402171, estimated once under the null (intercept) model from y and K, not per marker. With a few dozen phenotyped individuals these estimates pile up at the boundaries 0 and 1 -- the likelihood is flat there -- so read h2 as "kinship matters a lot / not at all" rather than as a precise proportion. At a boundary (h2 ~ 0 the model is ordinary regression, which is why its LODs can match R/qtl's to the digit). Checked with a strain-ID-driven trait (values = rank of strain), which has h2 ~ 1 by construction: BulkLMM reports h2 = 1.000000, sigma2_e = 3e-06 and a peak of LOD 3.1 -- the kinship term absorbs the strain structure -- while R/qtl, which has no kinship term at all, reports a spurious peak of 5.06 on the same values. That is the discrimination the h2 column was missing.
12 daysbulklmm: BULKLMM_BLOCKS as a config option, default 4Pjotr
The marker blocks a single-trait scan is split into were the driver's default (Threads.nthreads()) and changed with --threads. They are a separate knob now: BULKLMM_THREADS Julia threads (--threads) default 4 BULKLMM_BLOCKS independent marker blocks, scanned default 4 in parallel (1 = serial scan) Blocks are exact either way -- LOD 9.589938 and the same permutation thresholds at 1 and 4 -- so the knob only buys wall clock. The reply says what ran ("split into 4 independent blocks and scanned on 4 Julia thread(s) (BULKLMM_BLOCKS / BULKLMM_THREADS ...)"), because the answer to "is it multicore?" should be in the response and not in the log.
12 daysgemma: the permutation refusal names both routes, including running GEMMA itselfPjotr
We do not run GEMMA permutations -- each repeats the whole LOCO scan and the gate gives GEMMA one slot -- but "not supported here" is not the same as "not available". The refusal now says both: 1. POST /compute/bulklmm with nperm: 1000 -- an LMM whose thresholds come from rotations that keep the kinship (R/qtl's nperm does not, and is anti-conservative on a structured panel); 2. run GEMMA's own permutation locally. The reply's notes already name the bimbam pair and the phenotype file, so `gemma-wrapper --permutate` or `gemma -lmm 9 --permutate` on those inputs reproduces exactly the null GEMMA would have used -- hours instead of seconds, which is the honest price of that particular null. docs/bulklmm.md gains the table this belongs in: three ways to get a threshold, ordered by how honest the null is for a structured panel (rotation with kinship; GEMMA's own LOCO permutation run locally; R/qtl's nperm as a sanity check only). SKILL.md says the same in two lines. tests/gemma.rs now asserts both halves of the refusal, and the earlier assertion on /compute/rqtl -- which stopped being true when the refusal was rewritten -- is replaced rather than left passing by accident.
12 daysdocs: what BulkLMM models, what its cores do, and how to package itPjotr
docs/bulklmm.md records the three things that are easy to get wrong when a BulkLMM result is quoted: * where it stands against the other engines -- Haley-Knott with no kinship (R/qtl), LOCO LMM whose permutations are refused (GEMMA), LOCO LMM on HMM probabilities (R/qtl2), and this: a global-kinship LMM whose permutation thresholds are rotation-based and therefore cheap -- the only engine here that can say "genome-wide significant at alpha 0.05" against a null that respects relatedness; * what it is not: global kinship rather than LOCO, so its p-values are not GEMMA's; h2_null says how much relatedness it found (near zero here, which is why it reproduces R/qtl's 9.59 where GEMMA differs); one degree of freedom, so multiparent scans stay with /compute/qtl2; and no standard errors in 1.2.2's scan(), so the rows are marker, chr, pos, lod, beta, h2; * the cores, measured: Threads.@threads is in bulkscan.jl and bulkscan_helpers.jl, never in scan.jl, so a single-trait scan is serial by design and the visible parallelism was BLAS (96 threads 10.5 s against 4 threads 7.7 s). What the driver does about it -- exact marker blocks, cached matrix and kinship, capped BLAS, and the breakdown printed into the reply -- with the numbers (20.9 s at one block against 18.3 s at four, same LOD 9.589938). Also the packaging picture, since it is not obvious from the outside: guix-bioinformatics has a working julia-bin and a julia-build-system, but only three of BulkLMM's closure are packaged, so a pure-Guix build is 35-45 recipes; the pragmatic route is julia-bin plus a depot built once from the pinned Manifest. scripts/prepare-julia-depot.sh is that step, written down, and the depot stays small and GPU-free (79 packages, 139 MB) with JULIA_PKG_OFFLINE=true at request time. The plot test learns that both thresholds are drawn, not one.
12 daysbulklmm: put the whole driver summary in the replyPjotr
The threads/blocks/read/scan breakdown and the permutation thresholds are two separate lines on stderr, and the reply only carried the last one -- so the answer to "is it multicore?" was in the log rather than in the response.
12 daysbulklmm: exact marker-block parallelism, and what the cores are actually doingPjotr
Reported: a BulkLMM run does not look multicore. It is not a misconfiguration. BulkLMM's single-trait `scan()` -- what this endpoint calls -- has no `Threads.@threads` at all; the package threads `bulkscan()` (many traits) and bulkscan_helpers, not scan. The parallelism that was visible before was BLAS (OpenBLAS defaulting to all 96 cores here), which is why `user` time ran 4x `real` while Julia threads made no difference: --threads 1 13.7 s, --threads 4 12.3 s. * The driver splits the markers into independent blocks and scans them on Julia threads (--blocks, default = BULKLMM_THREADS). It is exact: the LOD for each marker is independent given the null variance components, which depend on y and K only. Verified identical -- peak LOD 9.589938 and the same permutation thresholds at 1 and 4 blocks -- and permutation thresholds combine by taking each permutation's maximum across blocks before the quantiles, which is what a genome-wide threshold is. * The parsed matrix and the kinship are cached per panel (read 1.3 s -> 0.4 s, kinship 0.9 s -> 0), because both depend only on the cross. * The summary in `notes` now says what ran: julia threads, blocks, BLAS threads, and the read/scan split. * The hand parser is back: CSV.jl into a DataFrame is an order of magnitude slower for a 21056 x 235 matrix (14-17 s against 2 s). * BLAS is capped at 4 threads -- 96 was slower (10.5 s against 7.7 s for one scan). Measured on BXD.8 trait 16627 (21056 markers): 1 block 20.9 s, 4 blocks 18.3 s, same answer. The gain is modest because the LMM loop is ~8 s of the run and each block re-estimates its variance components. Where the cores pay is bulkscan() -- many traits in one process, threaded over trait blocks -- which is the shape the next endpoint wants; documented in the README rather than left as folklore.