diff options
| author | Pjotr Prins <pjotr.public01@thebird.nl> | 2026-11-15 04:09:45 +0000 |
|---|---|---|
| committer | Pjotr Prins <pjotr.public01@thebird.nl> | 2026-11-15 04:09:45 +0000 |
| commit | 6dc92df74ebfc1f54889d247946a16ba6af6c056 (patch) | |
| tree | a498c7ccd4dea6c997286119bd7440529d106b82 /src | |
| parent | 07bf685a30c2e0d740fd22958a3a47ebaf48f98f (diff) | |
| download | genenetwork4-6dc92df74ebfc1f54889d247946a16ba6af6c056.tar.gz | |
correlation: the live site answers Spearman whatever method it is asked for
Recorded next to `Method` so the next comparison does not chase a 0.005
disagreement in r for an afternoon.
GN2's `get_sample_r_and_p_values` takes a parameter called `type` and is
called with `corr_params['type']` -- "sample" -- where the method belongs,
so `if type == 'pearson'` is never true and `scipy.stats.spearmanr` always
runs. The method is used only on the tissue path.
Evidence, from the live site with `method=pearson&type=sample`:
1427571_at vs 1447043_at reported -0.8446202819617522
spearman -0.8446202819617523
pearson -0.8393085803732605
1427571_at vs 1427641_at reported -0.8479321530363810
spearman -0.8479321530363810
pearson -0.8451666639589470
BXDPublish 10001 vs 17084 reported 1.0
spearman 1.0000000000000000
pearson 0.9757237677298747
Asked for spearman, our endpoint reproduces the live site's whole reply:
the same five traits in the same order, r to 2.2e-16, p to 5e-10
relative. Asked for pearson it reproduces the Pearson r of the values the
same site publishes, to 1.4e-8 (their sample_data endpoint rounds to three
decimals).
The live site stays the reference for the sample axis, the six-pair
overlap, the |r|-descending order and the reply shape. The statistic it is
asked for is the one place where it is not: it ignores the request.
Diffstat (limited to 'src')
| -rw-r--r-- | src/correlation.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/correlation.rs b/src/correlation.rs index cb16e6c..3564f08 100644 --- a/src/correlation.rs +++ b/src/correlation.rs @@ -31,6 +31,24 @@ pub const DEFAULT_TOP_N: usize = 500; /// The largest top-N we will run: GN2's menu tops out at 20000. pub const MAX_TOP_N: usize = 20_000; +/// Which correlation is computed. +/// +/// Worth knowing when comparing against the live site: GN2's JSON API +/// (`/api/v_pre1/correlation`) silently answers **Spearman** whatever method it +/// is asked for. `get_sample_r_and_p_values` takes a parameter named `type` and +/// is called with `corr_params['type']` -- "sample" -- instead of the method, so +/// `if type == 'pearson'` is never true and the `spearmanr` branch always runs. +/// +/// Measured, with `method=pearson&type=sample` on the live site: the r it +/// returns for HC_M2_0606_P's 1427571_at against 1447043_at is +/// -0.8446202819617522, which is the Spearman rho over its own published sample +/// values to 1e-16, not the Pearson r (-0.8393085803732605). Asked for +/// spearman, our endpoint reproduces the live site's five rows exactly -- same +/// traits, same order, r to 2.2e-16, p to 5e-10 relative. +/// +/// So the live site is the reference for the sample axis, the overlap, the +/// ordering and the reply shape, but not for the choice of statistic: it does +/// not honour the method it is given, which is a bug rather than a convention. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Method { Pearson, |
