about summary refs log tree commit diff
path: root/test/python
diff options
context:
space:
mode:
authorPjotr Prins <pjotr.public01@thebird.nl>2026-11-15 04:08:15 +0000
committerPjotr Prins <pjotr.public01@thebird.nl>2026-11-15 04:08:15 +0000
commit07bf685a30c2e0d740fd22958a3a47ebaf48f98f (patch)
tree013e00292145db4d19bf74197274511f26dcde5c /test/python
parenta2f47b25669568f84965c8efd3b6f9ecac572144 (diff)
downloadgenenetwork4-07bf685a30c2e0d740fd22958a3a47ebaf48f98f.tar.gz
correlation: run over the group's sample axis, and report a perfect correlation as 0.0
Two divergences from the live genenetwork.org, both measured against it.

**The sample axis.** GN2's `get_sample_r_and_p_values` walks
`target_dataset.group.samplelist` and takes the reference value by name:
the correlation runs over the group's animals, not over every individual
the trait happens to have a value for. Trait 1427571_at of HC_M2_0606_P
carries 99 values, the BXD panel holds 67 of those individuals, and the
answer changes materially -- GN2's top hit is a -0.845 probe that does
not appear in our top five at all. `corr_samples_group` now takes
`samples_primary` (default, the group's genotype panel, which is where
GN2's list comes from) or `samples_all` (the old behaviour); the panel is
read with `genotypes::resolve`, falling back to the group's
used-for-mapping strains where a group has no genotype file on this
machine. `samples_other` is refused rather than guessed.

**A perfect correlation.** The engine's r can land at 1.0000000000000002,
which makes 1 - r^2 negative and its p-value NaN. The live API answers
0.0 for that row (scipy's pearsonr), so the reply now clamps: r to +-1 and
p to 0.0. That is the reference's *output* being reproduced, not a
computation being redone -- #96 stays resolved in the same direction.

With the axis fixed, n agrees with the live site exactly (67) and r
agrees with GN2's own published per-sample values to 1.4e-8. What does
not yet agree is GN2's reported r itself: over the same 67 individuals,
its `/correlation` endpoint says -0.8446202819617522 for 1447043_at while
correlating the values its own `/sample_data` endpoint publishes for the
same two traits gives -0.8393085803732605; on a second pair the gap is
-0.8479321530363810 against -0.8451666639589470. Both pairs are off in
the same direction and by a similar amount, so the two GN2 endpoints are
reading different values for the same samples -- not a difference of
sample sets (all four BXD genotype files give the same 67) and not a
transform (2**v, 10**v, exp, v**2 and log were all tried). Until that is
settled, our numbers are the reference's published values correlated
correctly, and the ranking cannot be identical to a number we cannot
reproduce from the reference's own data.
Diffstat (limited to 'test/python')
0 files changed, 0 insertions, 0 deletions