own-baseline 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The own-baseline authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,525 @@
1
+ Metadata-Version: 2.4
2
+ Name: own-baseline
3
+ Version: 0.2.0
4
+ Summary: Does a single-cell potency score add anything beyond its own low-order primitive?
5
+ License: MIT License
6
+
7
+ Copyright (c) 2026 The own-baseline authors
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Project-URL: Repository, https://github.com/IskakovDamir/potency-ownbaseline
28
+ Project-URL: Issues, https://github.com/IskakovDamir/potency-ownbaseline/issues
29
+ Keywords: single-cell,scRNA-seq,potency,stemness,benchmarking,incremental-validity,null-calibration,CytoTRACE,SCENT
30
+ Classifier: Development Status :: 4 - Beta
31
+ Classifier: Environment :: Console
32
+ Classifier: Intended Audience :: Science/Research
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Operating System :: OS Independent
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.10
37
+ Classifier: Programming Language :: Python :: 3.11
38
+ Classifier: Programming Language :: Python :: 3.12
39
+ Classifier: Programming Language :: Python :: 3.13
40
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
41
+ Requires-Python: >=3.10
42
+ Description-Content-Type: text/markdown
43
+ License-File: LICENSE
44
+ Requires-Dist: numpy>=1.24
45
+ Requires-Dist: scipy>=1.10
46
+ Requires-Dist: scikit-learn>=1.2
47
+ Provides-Extra: full
48
+ Requires-Dist: pandas>=2.0; extra == "full"
49
+ Requires-Dist: anndata>=0.10; extra == "full"
50
+ Requires-Dist: matplotlib>=3.7; extra == "full"
51
+ Dynamic: license-file
52
+
53
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
54
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
55
+
56
+ # own-baseline
57
+
58
+ A single-cell potency or stemness score is usually validated by correlating it
59
+ against a pseudotime, a marker panel, or a known hierarchy. A score that
60
+ restates sequencing depth passes that test, and so does a score carrying real
61
+ ordering information — the criterion cannot separate them, because the thing
62
+ you are worried about correlates with the gold standard too. This repository
63
+ implements the check that can: residualize the score on the low-order statistic
64
+ its own authors say it approximates, and ask whether what is left still orders
65
+ cells. A score at rank correlation 0.93 with node degree can carry substantial
66
+ skill beyond it; another at 0.998 carries none. Pairwise correlation does not
67
+ tell you which you have, in either direction. Also in here: the field audit
68
+ that came out of applying this to thirteen published scores, and the finding
69
+ that our own strong hypothesis — that the whole family reduces to a fixed
70
+ low-order statistic — is false for most of them.
71
+
72
+ ## Quick start
73
+
74
+ ```bash
75
+ git clone https://github.com/IskakovDamir/potency-ownbaseline
76
+ cd potency-ownbaseline
77
+ pip install -e ".[full]"
78
+ ```
79
+
80
+ ### From the command line
81
+
82
+ ```bash
83
+ ownbaseline check cells.h5ad \
84
+ --score obs:cytotrace \
85
+ --ordinal obs:stage \
86
+ --ordinal-source experimental \
87
+ --json report.json
88
+ ```
89
+
90
+ All four primitives are computed unless you name one, the direction check is
91
+ printed above the first margin, and every value is placed against its own
92
+ measured null floor rather than against zero. `--ordinal-source` is required and
93
+ has no override: a pseudotime computed from the same expression matrix is not a
94
+ valid ground truth for this test, because the primitive predicts such an ordinal
95
+ too.
96
+
97
+ ```
98
+ ownbaseline floors --n 39505 --rho 0.4844 # the floor at that cell
99
+ ownbaseline floors --list-grid # the design points that exist
100
+ ownbaseline primitives cells.h5ad --out prim.npz
101
+ ownbaseline check cells.h5ad --primitives prim.npz ... # reuse them
102
+ ownbaseline verify report.json --rerun ... # does it still reproduce?
103
+ ```
104
+
105
+ `primitives` and `check` compose: the first writes the low-order statistics once,
106
+ with a provenance block recording the scaffold, the cell count and a sha256 per
107
+ vector, and the second reads them back instead of recomputing. On a large atlas
108
+ the degree primitive is the expensive one and this is the difference between
109
+ computing it once and computing it on every run.
110
+
111
+ The degree primitive needs an interaction scaffold, and none is bundled: an
112
+ interactome is 100 MB and the release you pick changes every number downstream.
113
+ Point at a prepared one, or build it from a STRING release:
114
+
115
+ ```bash
116
+ ownbaseline check cells.h5ad --score obs:ccat --ordinal obs:stage \
117
+ --ordinal-source experimental \
118
+ --scaffold prepared/string_cols.npz # col_idx + degree
119
+ # or
120
+ --string-links protein.links.v12.0.txt.gz \
121
+ --string-info protein.info.v12.0.txt.gz --string-threshold 700
122
+ ```
123
+
124
+ `--scaffold-null N` adds the degree-permutation control on top of that: it
125
+ permutes which gene carries which degree, keeping the degree distribution and
126
+ breaking the correspondence with expression. Read what it prints before using
127
+ the number. On the systems in the paper the gap over that null was 0.120 for
128
+ signalling entropy against 0.057 for CCAT while both sat at a conditional skill
129
+ of about zero, so a rule reading a larger gap as more genuine would have ranked
130
+ them backwards, and the entropy null itself came in below chance. It is a
131
+ diagnostic. The own baseline is the arbiter.
132
+
133
+ `check` wraps the conditional-skill estimator. It does not wrap
134
+ `run_own_baseline`, the marginal gap, which returns a pass when a score is
135
+ indistinguishable from gene counts and on sorted haematopoietic progenitors
136
+ returns the exact false positive this repository exists to expose.
137
+
138
+ Conventions, mostly from [clig.dev](https://clig.dev):
139
+
140
+ | | |
141
+ |---|---|
142
+ | `--json -` | the report on stdout, everything human on stderr, so it pipes |
143
+ | `-q`, `--quiet` | the numbers and the verdict, nothing else, and no progress line |
144
+ | `--no-color` | as does `NO_COLOR`; `FORCE_COLOR` turns it back on |
145
+ | exit `0` / `1` / `2` / `3` | ran / something asked for was unavailable / bad command line / the test does not apply |
146
+
147
+ Both global flags are accepted before or after the verb. Colour is off already
148
+ when stdout is not a terminal. The bootstrap prints its progress on stderr and
149
+ Ctrl-C stops it without a traceback and without writing anything.
150
+
151
+ ### From Python
152
+
153
+ ```python
154
+ import numpy as np
155
+ from own_baseline import conditional_skill_report
156
+
157
+ rng = np.random.default_rng(0)
158
+ n = 2000
159
+ ordinal = np.floor(6 * rng.random(n)) # stage, fixed before sequencing
160
+ primitive = ordinal + 1.5 * rng.standard_normal(n) # e.g. gene count per cell
161
+
162
+ honest = 0.5 * primitive + 1.5 * ordinal + rng.standard_normal(n)
163
+ sham = np.exp(primitive / 2) # a monotone function of it
164
+
165
+ conditional_skill_report(honest, ordinal, {'gene_count': primitive},
166
+ score_name='honest_score', n_boot=(100, 300))
167
+ conditional_skill_report(sham, ordinal, {'gene_count': primitive},
168
+ score_name='sham_score', n_boot=(100, 300))
169
+ ```
170
+
171
+ Real output, about thirty seconds:
172
+
173
+ ```
174
+ [conditional_skill] score=honest_score n=2000
175
+
176
+ vs primitive: gene_count
177
+ scipy_weightedtau marginal gap +0.1015 conditional skill +0.6786 CI[+0.6421,+0.7009] ADDS-BEYOND
178
+ kang_wdm_taub marginal gap +0.2365 conditional skill +0.4316 CI[+0.4100,+0.4506] ADDS-BEYOND
179
+ => ADDS-BEYOND
180
+ [conditional_skill] score=sham_score n=2000
181
+
182
+ vs primitive: gene_count
183
+ scipy_weightedtau marginal gap +0.0000 conditional skill -0.5439 CI[-0.5770,+0.8255] TAUTOLOG
184
+ kang_wdm_taub marginal gap +0.0000 conditional skill -0.6385 CI[-0.6491,+0.6440] TAUTOLOG
185
+ => TAUTOLOG
186
+ ```
187
+
188
+ `sham_score` is `exp(primitive / 2)` — a monotone reparametrization that adds
189
+ nothing. Its marginal gap is exactly `+0.0000` and its verdict is `TAUTOLOG`,
190
+ which is right. But its conditional skill should also be zero and reports
191
+ `-0.54` with an interval spanning most of [-1, 1]. That is not a near-null; it
192
+ is rounding debris being scored as signal, and the verdict lands correctly only
193
+ because the interval is wide enough to contain zero anyway. It is a real defect
194
+ in the estimator, documented below as **F-2**, recorded by a failing test, and
195
+ deliberately not patched.
196
+
197
+ Two entry points, in increasing strength:
198
+
199
+ | function | what it computes | when to use it |
200
+ |---|---|---|
201
+ | `run_own_baseline(adata, score, gt_ordinal)` | marginal gap `tau(score, ordinal) − tau(gene counts, ordinal)` | a first look; one line, no residualization |
202
+ | `conditional_skill_report(score, ordinal, primitives)` | rank residual on the primitive(s), scored under two kernels with a bootstrap interval, plus a direction check | the test the paper reports — **prefer this** |
203
+
204
+ The verdict vocabulary says which way the evidence points and is not a
205
+ pass/fail: `REDUCES-TO-PRIMITIVE`, `INCONCLUSIVE`, `ADDS-BEYOND-PRIMITIVE` for
206
+ the marginal gap; `TAUTOLOG`, `ADDS-BEYOND`, `SIGN-FLIPPED`,
207
+ `INCONCLUSIVE-kernel-disagree` for conditional skill.
208
+
209
+ **Check the direction before reading any margin.** In sorted haematopoietic
210
+ progenitors the gene-count primitive orders cells *below* chance — HSCs carry a
211
+ median 916 detected genes, the GMPs below them carry 1,404, and the primitive
212
+ scores AUROC 0.378 against the known hierarchy. A score that beats that
213
+ baseline has supplied a sign correction, not biology, and nothing in the margin
214
+ shows it. `conditional_skill_report` flags this; `run_own_baseline` does not.
215
+
216
+ ## Install
217
+
218
+ Straight from this repository, no checkout and no PyPI:
219
+
220
+ ```bash
221
+ uv tool install --python 3.12 "git+https://github.com/IskakovDamir/potency-ownbaseline"
222
+ ownbaseline # the splash, and the four verbs
223
+ ```
224
+
225
+ `uv` is a single binary and brings its own Python, which is why it is first here:
226
+ `curl -LsSf https://astral.sh/uv/install.sh | sh`, or `brew install uv`. Pinning
227
+ 3.12 keeps you on interpreters that numpy, scipy and scikit-learn publish wheels
228
+ for; on a very new Python those wheels may not exist yet and pip will try to
229
+ build them from source.
230
+
231
+ Equivalents, if you already have the tooling:
232
+
233
+ ```bash
234
+ pipx install "git+https://github.com/IskakovDamir/potency-ownbaseline"
235
+ pip install "git+https://github.com/IskakovDamir/potency-ownbaseline"
236
+ ```
237
+
238
+ Once released it will also be on PyPI as `own-baseline`, and the URL drops out:
239
+ `uv tool install own-baseline`.
240
+
241
+ **If pipx fails before it reaches this package.** An error naming `ensurepip`,
242
+ `venv --clear` or pipx's own `shared` directory is pipx repairing itself against
243
+ a Python it cannot bootstrap, and it happens with the newest Homebrew Python.
244
+ Nothing here is involved yet. Either use `uv` above, or repair pipx:
245
+
246
+ ```bash
247
+ rm -rf "$HOME/Library/Application Support/pipx/shared"
248
+ brew install python@3.12
249
+ pipx install --python "$(brew --prefix python@3.12)/bin/python3.12" \
250
+ "git+https://github.com/IskakovDamir/potency-ownbaseline"
251
+ ```
252
+
253
+ Or skip the installers entirely, which always works:
254
+
255
+ ```bash
256
+ python3 -m venv ~/.ownbaseline
257
+ ~/.ownbaseline/bin/pip install "git+https://github.com/IskakovDamir/potency-ownbaseline"
258
+ ~/.ownbaseline/bin/ownbaseline
259
+ ```
260
+
261
+ That gives the diagnostic, the shipped 200-seed null grid and the `ownbaseline`
262
+ command. It does not give the reproduction chain: the score implementations,
263
+ `reproduce.py` and the figures need the `[full]` extra and the datasets, which
264
+ is what the rest of this section is about.
265
+
266
+ From a checkout:
267
+
268
+ ```bash
269
+ pip install -e ".[full]" # or: pip install -r requirements.txt
270
+ python3 tests/run_tests.py # 25 pass, 1 known defect (F-2), 0 fail
271
+ python3 reproduce.py --self-test # the whole reproduction chain, synthetic data
272
+ ```
273
+
274
+ Verified on 2026-08-13 in a fresh `python3 -m venv` on macOS 15 (Darwin
275
+ 25.2.0), Python 3.14.3, resolving from PyPI: `numpy 2.5.2`, `scipy 1.18.0`,
276
+ `scikit-learn 1.9.0`, `pandas 3.0.5`, `matplotlib 3.11.1`, `anndata 0.13.2`.
277
+ Both commands above pass in that environment, and `import own_baseline` works
278
+ from outside the repository directory.
279
+
280
+ The core diagnostic needs only numpy, scipy and scikit-learn — with just those
281
+ three installed, 22 of the 25 tests pass and the 3 that do not are the ones
282
+ constructing an `AnnData`. `pandas`, `anndata` and `matplotlib` come with the
283
+ `[full]` extra and are needed by the score implementations, `reproduce.py` and
284
+ the figures. `requirements.txt` pins the exact versions the audit ran on.
285
+
286
+ The test suite needs no test runner: `python3 tests/run_tests.py` uses only the
287
+ runtime dependencies. `pytest tests/` collects the same functions if you prefer.
288
+
289
+ Two environment variables control where anything is read or written; both
290
+ default inside the repository and both defaults are git-ignored:
291
+
292
+ | variable | default | what lives there |
293
+ |---|---|---|
294
+ | `OWNBASELINE_DATA_ROOT` | `<repo>/data/runs` | downloads, prepared matrices, results |
295
+ | `OWNBASELINE_SCRATCH` | `<repo>/data/scratch` | the R ↔ Python handoff |
296
+
297
+ The R score wrappers read the same two variables, so setting them once lines
298
+ both halves up.
299
+
300
+ ## Reproduction
301
+
302
+ ```bash
303
+ python3 reproduce.py --ledger # what can and cannot be regenerated
304
+ python3 reproduce.py --self-test # whole chain on synthetic data, ~1 min
305
+ python3 reproduce.py # download ~135 MB and run
306
+ ```
307
+
308
+ **Reproducible end to end**, from public accessions with `pip` and no R: the
309
+ three primitives (gene count, `PCC(x, degree)` on STRING v12, Shannon entropy),
310
+ **CytoTRACE v1** (the full MVG → GCS → NNLS → Markov-diffusion port in
311
+ `scores/cytotrace_full.py`), and **SCENT's SR and CCAT** (the Python
312
+ implementations in `own_baseline/potency_metrics.py`).
313
+
314
+ This was run, not asserted. On 2026-08-13 `reproduce.py` downloaded
315
+ GSE106474 and STRING v12, rebuilt the scaffold, prepared **39,505 cells across
316
+ 12 stages** — the paper's n exactly — and regenerated four rows of the headline
317
+ table. They match the values behind the manuscript to every digit reported,
318
+ including both bootstrap bounds under both kernels:
319
+
320
+ | row | τ_b (reproduced) | 95% CI | weighted τ | 95% CI | verdict |
321
+ |---|---|---|---|---|---|
322
+ | CytoTRACE v1 \| gene count | +0.6531 | [+0.6479, +0.6579] | +0.7901 | [+0.7672, +0.8067] | ADDS-BEYOND |
323
+ | SR \| `PCC(x, degree)` | +0.4300 | [+0.4248, +0.4350] | +0.7366 | [+0.7174, +0.7611] | ADDS-BEYOND |
324
+ | SR \| CCAT | +0.4678 | [+0.4626, +0.4727] | +0.7522 | [+0.7347, +0.7766] | ADDS-BEYOND |
325
+ | CCAT \| `PCC(x, degree)` | −0.2209 | [−0.2267, −0.2151] | +0.1716 | [+0.1186, +0.2104] | INCONCLUSIVE-kernel-disagree |
326
+
327
+ That is the audit's largest effect (CytoTRACE, τ_b 0.653), the signalling-entropy
328
+ row the refutation turns on (SR, 0.430), and the CCAT row the reduction thesis
329
+ survives on. Read the last row with the scope note above and defect **F-2**
330
+ below in mind: the two kernels disagree at a near-null, and that disagreement is
331
+ also the signature of the F-2 artefact.
332
+
333
+ **Not reproducible here, and why.** Nothing below is silently skipped;
334
+ `reproduce.py` names the blocker for each.
335
+
336
+ | row | blocker |
337
+ |---|---|
338
+ | ORIGINS (τ_b 0.402) | needs `diff_edges.tsv` — `ORIGINS::differentiation_edges` dumped to TSV by hand. No script in this repository writes it. |
339
+ | SLICE (ρ 0.932) | needs the SLICE R package and its bundled `hs_kappasim.rda`; nothing here fetches it |
340
+ | dpath (τ_b 0.120) | GitHub-only R package with a documented R ≥ 4.2 incompatibility |
341
+ | NCG (τ_b 0.402) | needs the NCG repo cloned **with Git-LFS**; a plain clone yields pointer files |
342
+ | MCE | no public implementation exists |
343
+ | SPIDE | the formula is paywalled and was never obtained |
344
+ | scEnergy | requires MATLAB |
345
+ | StemID, cmEntropy | never measured. They equal a transcriptome-entropy primitive by construction, and the manuscript declines to report a number for them. |
346
+
347
+ The R cross-check of the Python SR/CCAT implementations is a separate matter
348
+ from computing them. The published check — Spearman 1.000, max |Δ| < 1e-13 on a
349
+ 500-cell subsample — needs the SCENT R sources placed under
350
+ `$OWNBASELINE_SCRATCH/scent_src`, which no script here does.
351
+ `reproduce.py` computes the scores and writes `scent_validation.json` recording
352
+ that the cross-check was **skipped**.
353
+
354
+ `reproduce.py` writes `reproduction/table.md`, `reproduction/table.json` and a
355
+ regenerated Figure 2 carrying the bootstrap intervals, computed from the raw
356
+ data. `figures/make_paper_a_figures.py` is a separate path to the same numbers:
357
+ it reads the frozen run artefacts in `data/run_record/` and does not recompute
358
+ anything. The two agree where both can run; `make_paper_a_figures.py
359
+ --crosscheck` prints the comparison.
360
+
361
+ ## What the audit found
362
+
363
+ On a 12-stage visually staged zebrafish ordinal (GSE106474, 39,505
364
+ whole-embryo cells), of the seven scores that could be placed on the ordinal,
365
+ five carry ordering skill beyond their own primitive — Kendall τ_b after rank
366
+ residualization, with the value after residualizing on all four low-order
367
+ statistics at once in brackets:
368
+
369
+ | score | primitive | τ_b | joint-4 |
370
+ |---|---|---|---|
371
+ | CytoTRACE v1 | gene count | 0.653 | 0.288 |
372
+ | SCENT SR | `PCC(x, degree)` | 0.430 | 0.183 |
373
+ | ORIGINS | `PCC(x, degree)` | 0.402 | 0.156 |
374
+ | NCG † | its own GO connectome | 0.402 | — |
375
+ | dpath † | Shannon entropy | 0.120 | 0.134 |
376
+ | CCAT | `PCC(x, degree)` | no measurable residual (ρ = 0.998) | — |
377
+ | SLICE † | Shannon entropy | near zero (ρ = 0.932) | — |
378
+
379
+ † on a fixed 3,000-cell subsample, not the full 39,505.
380
+
381
+ **The strong hypothesis is refuted.** This work set out to show that every
382
+ unsupervised potency score is a reparametrization of a fixed low-order
383
+ statistic, so that agreement between such scores across contexts is guaranteed
384
+ by construction rather than by biology. That holds for the identity and entropy
385
+ constructions — CCAT is its primitive by definition; StemID and cmEntropy equal
386
+ a transcriptome entropy by construction; SLICE tracks one it does not improve
387
+ on — and it is false for the entropy-rate and diffusion constructions.
388
+ Signalling entropy sits at ρ = 0.93 with the degree correlation and keeps skill
389
+ after four primitives are removed at once. What the surviving residual consists
390
+ of is open: a staged timecourse traces a developmental manifold, and a score
391
+ tracking that manifold keeps skill whether or not it measures potency in any
392
+ deeper sense.
393
+
394
+ ## Scope — what this does not do
395
+
396
+ - **It does not tell you a score is good.** `ADDS-BEYOND` means the score
397
+ orders cells beyond the primitive you named. It says nothing about whether
398
+ what it adds is potency rather than, say, position on a developmental
399
+ manifold.
400
+ - **It controls a realization of a primitive, not the construct.** The degree
401
+ primitive here is STRING v12 at confidence 700, largest connected component.
402
+ Threshold and interactome were not varied, and part of any residual may be
403
+ scaffold error.
404
+ - **It only nulls monotone reparametrizations.** A score that is an exact
405
+ non-monotone deterministic function of its primitive carries no information
406
+ and will still register skill.
407
+ - **A score reducing to a fifth statistic passes.** The primitive set is four,
408
+ each declared by the scores' own authors.
409
+ - **It needs a score-independent ordinal.** A pseudotime derived from the same
410
+ expression matrix is not one.
411
+ - **It is calibrated on development and the scores are deployed on patients.**
412
+ That gap is deliberate and it is still a gap.
413
+
414
+ ## Known defects
415
+
416
+ Recorded rather than patched, because fixing them changes what the estimator
417
+ computes and the manuscript's numbers were traced to specific runs of it. Full
418
+ detail in the commit messages and in `tests/test_estimator.py`.
419
+
420
+ - **F-2 — an exact monotone function of its primitive does not yield zero
421
+ conditional skill, and both kernels are affected.** When
422
+ `rank(score) == rank(primitive)` the least-squares fit is exact and the
423
+ residual is the rounding error of the subtraction, on the order of 1e-12
424
+ rather than an exact zero. That debris is monotone in the primitive rank, so
425
+ what a kernel returns depends on whether the primitive predicts the ordinal.
426
+ Where it does not, `weightedtau` returns up to +0.51 and Kendall τ_b stays
427
+ near 0.02, which is the fixture the defect was first recorded on and the
428
+ narrower case. Where it does, which is Null B and the case the audit faces,
429
+ the debris inherits that association: across four seeds and two coupling
430
+ strengths both kernels reach 0.87 in magnitude, with a sign that changes with
431
+ the seed. How large it is depends on the machine, because the debris is the
432
+ rounding error of a LAPACK least-squares fit: aarch64 with numpy 2.2 puts all
433
+ sixteen measured cells between 0.71 and 0.87, x86_64 with numpy 2.4 puts
434
+ fourteen there and collapses two toward zero. The sham score in the Quick
435
+ start above is this: its τ_b of −0.6385 is the rounding pattern, not a
436
+ measurement. What separates a residual from debris is its magnitude, not its
437
+ τ: `own_baseline.cli.residual_scale` returns `max|resid| / (eps * n)`, real
438
+ residuals sit at 1e14 to 1e15 on that ratio, and `ownbaseline check` refuses
439
+ to report a value below 1e6. Both residual implementations in this repository
440
+ have the defect. Pinned by
441
+ `tests/test_estimator.py::test_exact_monotone_function_of_primitive_has_zero_conditional_skill`
442
+ (expected failure) and by four tests in `tests/test_cli.py`.
443
+ - **`figures/make_paper_a_figures.py` contained no data — fixed 2026-08-29.**
444
+ Every number in it was a hard-coded literal; it had no `errorbar` call despite
445
+ the caption promising bootstrap intervals; it plotted StemID and cmEntropy at
446
+ ρ 0.990 / 1.000 and skill 0.000 as though measured, and NCG as pending
447
+ although the fix-1 run had measured it at τ_b +0.402. The script now reads
448
+ every value from `data/run_record/` and the null-calibration grid, draws each
449
+ score against its own measured null floor, and emits its caption and a
450
+ `fig2_values.json` from what it actually drew. The old script is kept at
451
+ `figures/deprecated/make_paper_a_figures.py` because its literals are what the
452
+ pre-2026-08 manuscript was traced against. The full before/after is
453
+ `04-experiments/2026-08-29-figure2-provenance.md` in the vault.
454
+ - **The figures were drawn to no page in particular — retargeted 2026-08-30.**
455
+ Figure 2 was emitted at 10.2 in wide, 1.6× the ML4H text block and 3.2× a
456
+ column, with a side table set in 6.6pt type. Nothing about it survived
457
+ reduction to a 3.18 in column. Figure 2 is now two variants built from the
458
+ same rows: `fig2_body.pdf` at 3.18 in (`\begin{figure}`) carrying only the
459
+ seven scores measured on the ordinal, and `fig2_appendix.pdf` at 6.50 in
460
+ (`\begin{figure*}`) carrying all fourteen rows, the n / floor / verdict table
461
+ and the by-construction band. Figure 3 is 6.50 in for a reason the script
462
+ measures and prints on every run: side by side in one column each panel gets
463
+ 1.03 in of plotting width, against 2.06 in for its own title and 1.38 in for
464
+ its two x tick labels at 7pt. Nothing on a retargeted figure is set below 7pt
465
+ at final size — `FontLedger.enforce()` raises rather than shrinking type —
466
+ and each run reads the rendered width back out of the written PDF's MediaBox
467
+ instead of trusting the `figsize` it asked for.
468
+ - **Two residual implementations, not merged.** `rank_resid_multi` (the
469
+ track-2 estimator) fits by least squares with an intercept and takes any
470
+ number of covariates. `rank_residual` / `_rank_residual` in `experiments/w4`,
471
+ `experiments/track4`, `experiments/cytotrace_v1` and `experiments/stemsc`
472
+ uses `np.cov(...)/np.var(...)`, which mixes `ddof=1` with `ddof=0` and so
473
+ inflates the slope by `n/(n−1)`, fits no intercept, and takes exactly one
474
+ covariate. Measured difference: |Δτ| up to 3.7e-2 at n = 106, 6.6e-07 at
475
+ n = 39,505. Which is correct is a numerical decision for the authors.
476
+
477
+ ## Layout
478
+
479
+ ```
480
+ own_baseline/ the diagnostic
481
+ own_baseline.py marginal gap + the Test-A error-model flavour
482
+ conditional_skill.py the track-2 conditional-skill estimator + the report API
483
+ potency_metrics.py the primitives, and SR / CCAT / CytoTRACE reimplementations
484
+ atlas_run/wdm_tau.py Kang wdm weighted-Kendall kernel (== R wdm::wdm)
485
+ paths.py / paths.R where this repository reads and writes
486
+ synthetic.py synthetic generators for the self-tests
487
+ scores/ score implementations used in the audit
488
+ cytotrace_full.py R-faithful CytoTRACE v1 port
489
+ run_*.R wrappers calling the real R packages
490
+ experiments/ every run script, verbatim, organized as it was run
491
+ figures/ the manuscript's figures, each value read from a run artefact
492
+ make_paper_a_figures.py reads data/run_record/ + the null-calibration grid
493
+ fig2_body.pdf 3.18 in, figure — the 7 rows measured on the ordinal
494
+ fig2_appendix.pdf 6.50 in, figure* — all 14 rows, side table, band
495
+ fig3.pdf 6.50 in, figure* — the depth confound, two panels
496
+ fig2_*_caption.txt the caption generated for each variant
497
+ deprecated/ the pre-2026-08-29 literal-only script, kept for tracing
498
+ tests/ known-answer tests
499
+ reproduce.py the reproduction entry point
500
+ data/README.md accessions and how to fetch them; no data is stored here
501
+ data/run_record/ the run JSONs the figures read, committed verbatim
502
+ ```
503
+
504
+ `experiments/` is a run record, not a library. Those scripts are kept as they
505
+ ran, apart from the path changes needed to make them import off the author's
506
+ machine.
507
+
508
+ ## Scores (R packages)
509
+
510
+ The audit ran published implementations wherever one existed: SCENT
511
+ (`aet21/SCENT`, SR + CCAT), SLICE (`xu-lab/SLICE`), dpath (`gongx030/dpath`),
512
+ ORIGINS (`danielasenraoka/ORIGINS`), NCG (`Xinzhe-Ni/NCG`). CytoTRACE v1 is a
513
+ port of the Gulati 2020 R algorithm. The SR, CCAT and ORIGINS **Python**
514
+ implementations were checked against the R packages on a 500-cell subsample
515
+ before use at scale — SR and CCAT to machine precision (Spearman 1.000,
516
+ max |Δ| < 1e-13), ORIGINS to rank agreement only (Spearman 1.000).
517
+
518
+ ## Citation
519
+
520
+ The manuscript is under review; this section will carry the DOI and BibTeX
521
+ entry once one is minted. Until then, cite the repository by URL and commit.
522
+
523
+ ## License
524
+
525
+ MIT — see [LICENSE](LICENSE).