CALIB_01 — resampling code and verification

Files
  lib_spectrum.R       shared constants (marker panel, SEED_BASE = 20261020) and helpers
  s4_floor.R           resampling null: redraw (primary), within-sample bootstrap, Hanley-McNeil
  s4_compare.py        merge the per-dataset floor output; reconcile point estimates against the grid
  s1b_auroc_repro.R    repeat the AUROC chain twice for one dataset
  s1b_repro.sh         driver for the three datasets
  s1b_compare.py       byte-level comparison and reconciliation against the grid
  s5_theta.R           positive-control arm, step 1: true AUROC of each marker against each compartment
  s5_positive.R        positive-control arm, step 2: resample real labels at n = 20, 50, 100
  make_figures.py      redraw Figure 1 from auroc_floor.tsv and Figure 2 from s5_positive_all.tsv
  verify_numbers.py    re-derive every number in the manuscript from auroc_floor.tsv and s5_positive_all.tsv

Environment
  R 4.6.1, Seurat 5.6.0, Matrix; Python 3.13 (standard library only for the .py files).

Running
  Rscript s4_floor.R <dataset> <out.tsv> [replicates]
  Rscript s5_theta.R                      # writes work/s5_theta_<dataset>.tsv
  Rscript s5_positive.R                   # writes work/s5_positive_all.tsv (246 rows x 20 cols)
  Set SPECTRUM_HOME to the directory holding lib_spectrum.R and SPECTRUM_WORK to the
  directory holding the per-dataset <dataset>_annot.rds objects (counts + cell metadata from
  the annotation step). Defaults are /root/bioinfo/spectrum and $SPECTRUM_HOME/work; no
  other absolute path is compiled into the scripts.

  make_figures.py runs from the deposited files alone: point it at a directory that holds
  03_Additional_file_1_Table_S1.tsv and 09_Additional_file_6_positive_control.tsv (their
  deposited names are recognised as well as the working names auroc_floor.tsv and
  s5_positive_all.tsv) and it redraws both figures. verify_numbers.py instead expects the
  working layout it was written in, and every input it needs is reconstructible from this
  deposit:

    working name              comes from
    auroc_floor.tsv           03_Additional_file_1_Table_S1.tsv
    s5_positive_all.tsv       09_Additional_file_6_positive_control.tsv
    auroc_repro.txt           04_Additional_file_2_reproducibility_log.txt
    lib_spectrum.R            this zip
    probe_review.tsv, row_labels.tsv      sheets 1 and 2 of 06_Additional_file_4_text_probe.xlsx
    cellxgene_probe.tsv       the sheet of 07_Additional_file_5_atlas_probe.xlsx

  Copy them into _spectrum/out and _spectrum/lit next to the scripts and the verification
  script runs unchanged; it prints how many numbers it checked and exits non-zero on any
  mismatch it cannot trace.

Seeds
  SEED_BASE <- 20261020. Null arm: each n level uses SEED_BASE + 1000 * si, and that si is
  written in the output table; each replicate adds 200 + b.
  Positive-control arm: SEED_BASE + 5000 + 1000 * pair_index + 10 * n_index, one seed per
  (pair, n); the seed is written to the output table.

Output
  auroc_floor.tsv, 20 rows x 39 columns. Columns nA, nB and n_pool make the size of each
  draw self-checking: nA = nB = n_cells and 2n <= n_pool on every row, as s4_floor.R asserts
  before drawing. s5_positive_all.tsv has 246 rows x 20 columns.

Checks run on this deposit
  Both scripts are deterministic: rerunning s4_floor.R on the three datasets reproduced
  auroc_floor.tsv cell for cell (20/20 rows, every shared column identical), and two
  independent runs of the AUROC chain produced byte-identical files (Additional file 2).
  The point estimates also reproduce the preceding parameter grid to 1e-16 or better, and the
  one floor row that lies beyond that grid's ceiling is identified in Additional file 2 with
  the reason it has no grid counterpart.
