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-13 14:02:52 +0000
committerPjotr <wrk@bosa.lan>2026-11-13 14:02:52 +0000
commita5d6437a90686e97b5c410af3a3479114e4ab9c5 (patch)
treea49835e5e5dc668b470d6b631ed3528d5d62e115 /test/python/test_groups.py
parente552bb6407718c986123e574a59494ca6184f2e2 (diff)
downloadgenenetwork4-a5d6437a90686e97b5c410af3a3479114e4ab9c5.tar.gz
bnw: module scores as trait values, and BNW's worked examples
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.
Diffstat (limited to 'test/python/test_groups.py')
0 files changed, 0 insertions, 0 deletions