junidude14 commited on
Commit
a195e67
·
verified ·
1 Parent(s): bc66894

Archive 4 checkpoints (1-4)

Browse files
.gitattributes CHANGED
@@ -231,3 +231,5 @@ paper-releases/pbisc-diffusion/updates/20261012T233237Z-figure-layout-todo/diffu
231
  paper-releases/pbisc-diffusion/updates/20261012T233237Z-figure-layout-todo/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/layout_preview_20261013/panels/Figure_5_layout.pdf filter=lfs diff=lfs merge=lfs -text
232
  paper-releases/pbisc-diffusion/updates/20261012T233237Z-figure-layout-todo/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/layout_preview_20261013/panels/Figure_6_layout.pdf filter=lfs diff=lfs merge=lfs -text
233
  paper-releases/pbisc-diffusion/updates/20261013T005008Z-reuse-audit-results-deck/diffusion/dataset/server_1/model8/EXPERIMENT_REUSE_INDEX.jsonl filter=lfs diff=lfs merge=lfs -text
 
 
 
231
  paper-releases/pbisc-diffusion/updates/20261012T233237Z-figure-layout-todo/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/layout_preview_20261013/panels/Figure_5_layout.pdf filter=lfs diff=lfs merge=lfs -text
232
  paper-releases/pbisc-diffusion/updates/20261012T233237Z-figure-layout-todo/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/layout_preview_20261013/panels/Figure_6_layout.pdf filter=lfs diff=lfs merge=lfs -text
233
  paper-releases/pbisc-diffusion/updates/20261013T005008Z-reuse-audit-results-deck/diffusion/dataset/server_1/model8/EXPERIMENT_REUSE_INDEX.jsonl filter=lfs diff=lfs merge=lfs -text
234
+ paper-releases/pbisc-diffusion/updates/20261013T005008Z-reuse-audit-results-deck/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/PBISC-Diffusion_results_review_20261013.pdf filter=lfs diff=lfs merge=lfs -text
235
+ paper-releases/pbisc-diffusion/updates/20261013T005008Z-reuse-audit-results-deck/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/PBISC-Diffusion_results_review_20261013.pptx filter=lfs diff=lfs merge=lfs -text
paper-releases/pbisc-diffusion/updates/20261013T005008Z-reuse-audit-results-deck/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/tools/finalize_campaign.py ADDED
@@ -0,0 +1,322 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Complete source-bound CPU analyses and render Figure 1–5 after the GPU campaign."""
2
+ from __future__ import annotations
3
+ import argparse
4
+ import json
5
+ from pathlib import Path
6
+ import shutil
7
+ import subprocess
8
+ import sys
9
+ import time
10
+
11
+ from runtime import Runtime, atomic_json, sha256, stamp
12
+ import campaign as C
13
+
14
+ ROOT = C.ROOT
15
+ ARMS = ("lora", "pairedcal", "scsemi", "raw", "refcal")
16
+ PDF_PY = "/home/sj_server_1/miniforge3/bin/python" # verified pptx, matplotlib, pandas environment
17
+
18
+
19
+ def assert_publication_ready(figures: dict, rare: dict) -> None:
20
+ if figures.get("status") != "complete":
21
+ raise ValueError("Figure 2–4 strict evidence is incomplete")
22
+ if rare.get("design") != "strict5pair" or rare.get("units") != 20:
23
+ raise ValueError("Figure 5 requires all 20 strict units; diagnostic results are insufficient")
24
+
25
+
26
+ def generated_arms(path: Path) -> dict[str, Path]:
27
+ cohort = C.read_support(path)["cohort"]
28
+ values = {a: C.gen_dir(path) / f"{a}.npz" for a in ("lora", "pairedcal", "scsemi")}
29
+ values.update({a: ROOT / "generated/global" / cohort / f"{a}.npz" for a in ("raw", "refcal")})
30
+ return values
31
+
32
+
33
+ def wait_cuda_idle() -> None:
34
+ while True:
35
+ result = subprocess.run(["nvidia-smi", "--query-compute-apps=pid,process_name,used_memory",
36
+ "--format=csv,noheader"], capture_output=True, text=True, check=True)
37
+ if not result.stdout.strip():
38
+ return
39
+ time.sleep(15)
40
+
41
+
42
+ def deconvolution(runtime: Runtime, units: list[Path]) -> None:
43
+ script = ROOT / "tools/deconv_strict.py"
44
+ for path in units:
45
+ support = C.read_support(path)
46
+ if support["cohort"] == "immicro":
47
+ continue
48
+ out = ROOT / "deconvolution" / C.relative(path)
49
+ reuse = support["cohort"] == "ye2026_sepsis"
50
+ if reuse and (out / "ADOPTION.json").exists():
51
+ # Runtime may skip an already receipted metadata operation. Verify
52
+ # live linked evidence before that skip can hide changed inputs.
53
+ from adopt_deconv_legacy import verify
54
+ verify(support, out)
55
+ split = "fewshot" + support["unit"].split("_", 1)[0].removeprefix("draw")
56
+ # Completed exact-support Sepsis methods must be adopted, never repeated.
57
+ actions = ("adopt", "score") if reuse else ("prepare", "bayesprism", "cibersortx", "score")
58
+ for action in actions:
59
+ if action != "adopt":
60
+ wait_cuda_idle()
61
+ outputs = {"adopt": [out / "ADOPTION.json"], "prepare": [out / "INPUTS.json"],
62
+ "bayesprism": [out / "inputs" / support["cohort"] / f"{split}_full/bp/DONE"],
63
+ "cibersortx": [out / "cibersortx" / support["cohort"] / f"{split}/out_fractions/DONE"],
64
+ "score": [out / "score/SUMMARY.json", out / "score/figure4_methods.csv",
65
+ out / "score/expression_signal.csv"]}[action]
66
+ runtime.execute(f"{C.name(path)}-deconv-{action}",
67
+ [C.CPU_PY, "-u", str(script), "--support-manifest", str(path),
68
+ "--action", action, "--threads", "4"], memory_gib=24,
69
+ inputs=[path, script, ROOT / "tools/adopt_deconv_legacy.py"], outputs=outputs,
70
+ previous_outputs=preserve_preview_outputs(runtime, f"{C.name(path)}-deconv-{action}", outputs)
71
+ if action in ("prepare", "adopt") else None)
72
+ if action == "score":
73
+ result = json.loads((out / "score/SUMMARY.json").read_text())
74
+ if result.get("status") not in ("complete", "complete_with_not_estimable"):
75
+ raise ValueError(f"deconvolution is not complete: {out}")
76
+
77
+
78
+ def rare_caches(runtime: Runtime, units: list[Path]) -> None:
79
+ script = ROOT / "tools/rare_cache_builder.py"
80
+ for path in units:
81
+ if C.read_support(path)["cohort"] == "immicro":
82
+ continue
83
+ out = ROOT / "work/rare_strict_caches" / C.relative(path)
84
+ score = ROOT / "scores" / C.relative(path) / "score"
85
+ argv = [C.CPU_PY, "-u", str(script), "--support-manifest", str(path),
86
+ "--score-dir", str(score), "--output-dir", str(out),
87
+ "--cell-budget", "1500", "--depth-target", "1000"]
88
+ for arm, source in generated_arms(path).items():
89
+ argv += ["--arm", f"{arm}={source}"]
90
+ runtime.execute(f"{C.name(path)}-rare-cache", argv, memory_gib=16,
91
+ inputs=[path, script, score / "summary.json", score.parent / "scoring_support.json"],
92
+ outputs=[out / "rare_manifest.json"])
93
+
94
+
95
+ def preserve_diagnostic() -> None:
96
+ """Keep the first diagnostic's source data when strict tables replace the live navigation files."""
97
+ dest = ROOT / "diagnostic_legacy_v1"
98
+ if dest.exists():
99
+ return
100
+ files = [*sorted((ROOT / "source_data").glob("rare_*")),
101
+ *sorted((ROOT / "reports").glob("rare_*")),
102
+ *sorted((ROOT / "figures").glob("fig5*diagnostic*"))]
103
+ records = []
104
+ for path in files:
105
+ if path.is_file():
106
+ target = dest / path.relative_to(ROOT)
107
+ target.parent.mkdir(parents=True, exist_ok=True)
108
+ shutil.copy2(path, target)
109
+ records.append({"path": str(target), "sha256": sha256(target)})
110
+ atomic_json(dest / "PRESERVED.json", {"at": stamp(), "design": "legacy_5donor_diagnostic", "files": records})
111
+
112
+
113
+ def preserve_preview_outputs(runtime: Runtime, name: str, paths: list[Path]) -> dict:
114
+ """A preview may be replaced only after preserving its exact bytes with an explicit receipt."""
115
+ if runtime.receipt_path(name).exists():
116
+ return {}
117
+ proof = {}
118
+ for path in paths:
119
+ if not path.exists():
120
+ continue
121
+ dest = ROOT / "previews/before_strict_final" / name / path.relative_to(ROOT)
122
+ dest.parent.mkdir(parents=True, exist_ok=True)
123
+ if dest.exists() and sha256(dest) != sha256(path):
124
+ raise ValueError(f"a different preview is already preserved: {dest}")
125
+ if not dest.exists():
126
+ shutil.copy2(path, dest)
127
+ proof[str(path)] = {"backup": str(dest), "sha256": sha256(path)}
128
+ if proof:
129
+ atomic_json(ROOT / "previews/before_strict_final" / f"{name}.json", {"at": stamp(), "outputs": proof})
130
+ return proof
131
+
132
+
133
+ def _run_preserving(runtime: Runtime, name: str, argv: list[str], *, memory_gib: int,
134
+ inputs: list[Path], outputs: list[Path]) -> None:
135
+ runtime.execute(name, argv, memory_gib=memory_gib, inputs=inputs, outputs=outputs,
136
+ previous_outputs=preserve_preview_outputs(runtime, name, outputs))
137
+
138
+
139
+ def cross_draw_statistics(runtime: Runtime, units: list[Path]) -> None:
140
+ script = ROOT / "tools/finalize_outputs.py"
141
+ disease = [p for p in units if C.read_support(p)["cohort"] != "immicro"]
142
+ if len(disease) != 20:
143
+ raise ValueError("cross-draw statistics require all 20 disease units")
144
+ inputs = [script, ROOT / "tools/score_strict.py", ROOT / "tools/donor_statistics.py"]
145
+ for path in disease:
146
+ base = ROOT / "scores" / C.relative(path)
147
+ inputs.extend([path, base / "scoring_support.json", base / "score/summary.json",
148
+ base / "score/per_donor.csv", base / "statistics/per_donor_long.csv",
149
+ base / "statistics/status.json"])
150
+ _run_preserving(runtime, "aggregate-five-draw-donor-ci",
151
+ [C.CPU_PY, str(script), "--action", "cross-draw", "--require-complete"],
152
+ memory_gib=8, inputs=inputs,
153
+ outputs=[ROOT / "source_data/fig4_cross_draw_donor_ci.csv",
154
+ ROOT / "source_data/fig4_cross_draw_donor_ci.json"])
155
+
156
+
157
+ def corrected_disease_signal(runtime: Runtime, units: list[Path]) -> None:
158
+ script = ROOT / "tools/disease_signal.py"
159
+ disease = [p for p in units if C.read_support(p)["cohort"] != "immicro"]
160
+ if len(disease) != 20:
161
+ raise ValueError("donor-aware disease signal requires all 20 disease units")
162
+ inputs = [script, ROOT / "tools/score_strict.py", ROOT / "tools/donor_statistics.py"]
163
+ for path in disease:
164
+ base = ROOT / "scores" / C.relative(path)
165
+ deg = base / "statistics/donor_deg"
166
+ inputs.extend([path, base / "scoring_support.json", base / "score/summary.json",
167
+ base / "statistics/status.json", deg / "genes_kept.csv",
168
+ deg / "donor_deg_summary.csv"])
169
+ inputs.extend(sorted(p for p in deg.glob("*/*/*") if p.is_file() and p.name in (
170
+ "donor_condition_pseudobulk.csv", "donor_limma_genes.csv", "limma_status.json")))
171
+ cohort = C.read_support(path)["cohort"]
172
+ inputs.extend([C.OLD / "data" / cohort / "features.npz", C.OLD / "data" / cohort / "folds.csv"])
173
+ names = ("fig4_donor_aware_signal.csv", "fig4_donor_aware_summary.csv",
174
+ "fig4_donor_aware_genes.csv", "fig4_donor_aware_cat.csv",
175
+ "fig4_donor_aware_provenance.json")
176
+ _run_preserving(runtime, "compute-donor-aware-disease-signal",
177
+ [C.CPU_PY, str(script), "--require-complete"], memory_gib=12,
178
+ inputs=inputs, outputs=[ROOT / "source_data" / name for name in names])
179
+
180
+
181
+ def _figure234_outputs() -> list[Path]:
182
+ names = ("fig2_ablation_and_support", "fig3_healthy_strict_oof", "fig3_realism_metrics",
183
+ "fig3_umap_by_celltype", "fig3_composition_fractions", "fig3_runtime_components",
184
+ "fig3_canonical_marker_dotplot", "fig4_disease_strict_draws", "fig4_disease_signal_strict",
185
+ "fig4_disease_signal_scatter", "fig4_disease_signal_heatmap", "fig4_disease_signal_cat",
186
+ "fig4_deconvolution_strict", "fig4_deconvolution_expression_strict",
187
+ "fig4_deconvolution_historical_signal", "fig4_deconvolution_covered_sensitivity",
188
+ "fig4_historical_5fold_separate")
189
+ files = [ROOT / "figures" / f"{name}.{ext}" for name in names for ext in ("pdf", "svg", "png")]
190
+ files += [ROOT / "source_data" / name for name in (
191
+ "fig2_historical_rank_full.csv", "fig2_strict_curve.csv", "fig3_per_sample.csv",
192
+ "fig3_extras.csv", "fig4_strict_per_sample.csv", "fig4_corrected_statistics.csv",
193
+ "fig4_strict_contrast.csv", "fig4_deconvolution.csv", "fig4_deconvolution_signal.csv",
194
+ "fig4_historical_5fold.csv")]
195
+ files += [ROOT / "reports/figures234_readiness.json", ROOT / "reports/figures234_readiness.md"]
196
+ return files
197
+
198
+
199
+ def final_documents(runtime: Runtime, figures: dict, rare: dict) -> None:
200
+ assert_publication_ready(figures, rare)
201
+ deck = ROOT / "tools/build_review_deck.py"
202
+ panel_outputs = [ROOT / "deck" / f"fig1_panel_{panel}.{ext}"
203
+ for panel in ("ab", "cd", "e") for ext in ("png", "svg")]
204
+ _run_preserving(runtime, "render-final-review-deck",
205
+ [PDF_PY, str(deck), "--require-complete"], memory_gib=4,
206
+ inputs=[deck, ROOT / "reports/figures234_readiness.json",
207
+ ROOT / "reports/rare_provenance.json", ROOT / "reports/rare_visual_provenance.json"],
208
+ outputs=[ROOT / "deck/paper_figures_final.pptx", ROOT / "deck/final_gate_sources.json",
209
+ ROOT / "deck/README.md", *panel_outputs])
210
+ manuscript = ROOT / "tools/assemble_manuscript.py"
211
+ stage = ROOT / "manuscript"
212
+ previous_sources = [*stage.glob("*.tex"), *stage.glob("sections/*.tex"),
213
+ stage / "main.pdf", stage / "supplementary.pdf", stage / "integration_manifest.json"]
214
+ # Assembly changes many staged TeX files; preserve the earlier review copy
215
+ # before replacing any of them, while Runtime protects its manifest output.
216
+ proof = preserve_preview_outputs(runtime, "assemble-verified-manuscript", previous_sources)
217
+ manifest = stage / "integration_manifest.json"
218
+ runtime.execute("assemble-verified-manuscript", [C.CPU_PY, str(manuscript), "--require-complete"],
219
+ memory_gib=4,
220
+ inputs=[manuscript, ROOT / "reports/figures234_readiness.json",
221
+ ROOT / "reports/rare_provenance.json",
222
+ ROOT / "source_data/fig4_cross_draw_donor_ci.csv"],
223
+ outputs=[manifest],
224
+ previous_outputs={str(manifest): proof[str(manifest)]} if str(manifest) in proof else {})
225
+ export = ROOT / "tools/finalize_outputs.py"
226
+ _run_preserving(runtime, "compile-final-manuscript-pdfs",
227
+ [PDF_PY, str(export), "--action", "manuscript-pdf", "--require-complete"],
228
+ memory_gib=8, inputs=[export, manifest, stage / "main.tex", stage / "supplementary.tex"],
229
+ outputs=[stage / "main.pdf", stage / "supplementary.pdf"])
230
+ _run_preserving(runtime, "convert-final-deck-pdf",
231
+ [PDF_PY, str(export), "--action", "deck-pdf", "--require-complete"],
232
+ memory_gib=8, inputs=[export, ROOT / "deck/paper_figures_final.pptx",
233
+ ROOT / "deck/final_gate_sources.json"],
234
+ outputs=[ROOT / "deck/paper_figures_final.pdf"])
235
+
236
+
237
+ def render(runtime: Runtime, units: list[Path]) -> None:
238
+ preserve_diagnostic()
239
+ cross_draw_statistics(runtime, units)
240
+ corrected_disease_signal(runtime, units)
241
+ visual = ROOT / "tools/export_healthy_visuals.py"
242
+ _run_preserving(runtime, "export-healthy-visuals", [C.CPU_PY, str(visual)], memory_gib=24,
243
+ inputs=[visual, *units], outputs=[ROOT / "source_data" / name for name in (
244
+ "fig3_visual_data.json", "fig3_visual_data.npz", "fig3_marker_codetection.csv",
245
+ "fig3_runtime_evidence.json", "fig3_runtime.csv", "fig3_runtime.json",
246
+ "fig3_celltype_fractions.csv", "fig3_umap_coordinates.csv")])
247
+ cache_root = ROOT / "work/rare_strict_caches"
248
+ analysis = ROOT / "tools/build_figure5.py"
249
+ _run_preserving(runtime, "analyze-strict-rare", [C.CPU_PY, str(analysis), "--manifest-dir", str(cache_root)],
250
+ memory_gib=12, inputs=[analysis, *sorted(cache_root.rglob("rare_manifest.json"))],
251
+ outputs=[ROOT / "source_data" / name for name in (
252
+ "rare_per_sample.csv", "rare_per_donor.csv", "rare_summary.csv",
253
+ "rare_ineligible_states.csv")])
254
+ export = ROOT / "tools/export_rare_visuals.py"
255
+ _run_preserving(runtime, "export-strict-rare-visuals",
256
+ [C.CPU_PY, str(export), "--manifest-dir", str(cache_root)],
257
+ memory_gib=16, inputs=[export, ROOT / "source_data/rare_summary.csv"],
258
+ outputs=[ROOT / "reports/rare_visual_provenance.json", ROOT / "reports/rare_provenance.json",
259
+ *[ROOT / "source_data" / n for n in ("rare_visual_cells.csv", "rare_visual_heatmap.csv",
260
+ "rare_visual_donor_draws.csv")],
261
+ *[ROOT / "figures" / f"fig5_rare_visuals_strict.{ext}" for ext in ("pdf", "svg", "png")]])
262
+ plot = ROOT / "tools/figure5_panels.py"
263
+ _run_preserving(runtime, "render-strict-rare", [C.CPU_PY, str(plot), "--require-complete"],
264
+ memory_gib=4, inputs=[plot, ROOT / "tools/figure5_details.py", ROOT / "reports/rare_provenance.json"],
265
+ outputs=[ROOT / "source_data" / name for name in ("rare_behcet_descriptive.csv",
266
+ "rare_behcet_per_sample.csv", "rare_all_states.csv", "rare_all_states_aggregate.csv")]
267
+ + [ROOT / "reports/rare_behcet_provenance.json"]
268
+ + [ROOT / "figures" / f"fig5_{stem}_strict.{ext}" for stem in
269
+ ("rare_states", "all_states", "behcet_rules") for ext in ("pdf", "svg", "png")])
270
+ plot = ROOT / "tools/build_results_figures.py"
271
+ _run_preserving(runtime, "render-strict-figures234", [C.CPU_PY, str(plot), "--require-complete"],
272
+ memory_gib=8, inputs=[plot, ROOT / "tools/figure2_panels.py", ROOT / "deconvolution/deconvolution_manifest.json",
273
+ ROOT / "source_data/fig4_cross_draw_donor_ci.json",
274
+ ROOT / "source_data/fig4_donor_aware_provenance.json"],
275
+ outputs=_figure234_outputs())
276
+ ready = json.loads((ROOT / "reports/figures234_readiness.json").read_text())
277
+ rare = json.loads((ROOT / "reports/rare_provenance.json").read_text())
278
+ strict = all(u.get("design") == "strict5pair" and u.get("evidence_tier") == "strict" for u in rare.get("units", []))
279
+ assert_publication_ready(ready, {"design": "strict5pair" if strict else "diagnostic", "units": len(rare.get("units", []))})
280
+ final_documents(runtime, ready, {"design": "strict5pair" if strict else "diagnostic",
281
+ "units": len(rare.get("units", []))})
282
+
283
+
284
+ def main() -> None:
285
+ p = argparse.ArgumentParser(description=__doc__)
286
+ p.add_argument("--stage", choices=("deconvolution", "rare", "render", "all"), default="all")
287
+ a = p.parse_args()
288
+ units = C.discover_units()
289
+ if len(units) != 40:
290
+ raise ValueError("all 40 strict support units are required before finalization")
291
+ runtime = Runtime(ROOT)
292
+ state = {"state": "running", "stage": a.stage, "at": stamp(), "figure6": "waiting_user_data"}
293
+ out = ROOT / "FINALIZATION_STATUS.json"
294
+ atomic_json(out, state)
295
+ try:
296
+ if a.stage in ("deconvolution", "all"):
297
+ deconvolution(runtime, units)
298
+ if a.stage in ("rare", "all"):
299
+ rare_caches(runtime, units)
300
+ if a.stage in ("render", "all"):
301
+ render(runtime, units)
302
+ if a.stage in ("render", "all"):
303
+ artifacts = [ROOT / "manuscript/main.pdf", ROOT / "manuscript/supplementary.pdf",
304
+ ROOT / "deck/paper_figures_final.pptx", ROOT / "deck/paper_figures_final.pdf",
305
+ ROOT / "source_data/fig4_cross_draw_donor_ci.csv",
306
+ ROOT / "source_data/fig4_donor_aware_signal.csv"]
307
+ if any(not p.is_file() or p.stat().st_size == 0 for p in artifacts):
308
+ raise ValueError("final PDF/deck or disease source artifact missing after render")
309
+ state.update(state="complete", artifacts={str(p): sha256(p) for p in artifacts},
310
+ canonical_integration="awaiting_review", archive_update="coordinator_task_end")
311
+ else:
312
+ state.update(state="selected_finalization_stage_complete")
313
+ state["finished_at"] = stamp()
314
+ except BaseException as exc:
315
+ state.update(state="stopped_needs_inspection", error=str(exc), stopped_at=stamp())
316
+ raise
317
+ finally:
318
+ atomic_json(out, state)
319
+
320
+
321
+ if __name__ == "__main__":
322
+ main()
paper-releases/pbisc-diffusion/updates/20261013T005008Z-reuse-audit-results-deck/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/PBISC-Diffusion_results_review_20261013.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3035f7e8a4194702a2a64e28b6cfc6080b649f4cf242a1734ca2064aef16c652
3
+ size 1734370
paper-releases/pbisc-diffusion/updates/20261013T005008Z-reuse-audit-results-deck/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/PBISC-Diffusion_results_review_20261013.pptx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84c6a9862df82288fd952da748f1eacf2ff1be29822799ec8119a57529d0d0c4
3
+ size 3730388
paper-releases/pbisc-diffusion/updates/20261013T005008Z-reuse-audit-results-deck/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/README.md ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PBISC-Diffusion results decks
2
+
3
+ **Current available-results review (2026-10-13):**
4
+ [PDF](PBISC-Diffusion_results_review_20261013.pdf) ·
5
+ [editable PPTX](PBISC-Diffusion_results_review_20261013.pptx).
6
+ This 34-slide review reuses completed evidence in the approved Figure 1–5
7
+ sequence. It keeps historical five-fold, exact-five healthy draws and
8
+ multi-visit five-donor disease designs explicit. Corrected rare-state tables
9
+ and saved healthy composition scores are redrawn on CPU; no new training or
10
+ generation is introduced. Figure 6 awaits the user-prepared dataset.
11
+
12
+ Sources and per-slide protocol labels:
13
+ `data/results_review_20261013_provenance.json` and
14
+ `data/results_review_20261013_slide_map.csv`.
15
+ Builder: `tools/build_results_review_20261013.py`.
16
+ The incomplete 8-page TODO layout and older strict-campaign review working
17
+ copies are superseded; their immutable archive records are preserved.
18
+
19
+ The original 76-slide deck below remains the prior source/reference deck.
20
+
21
+ ## Original 2026-09-30 r00 deck and historical change log
22
+
23
+ 76-slide English deck, ordered by the six main figures of the Nature-style manuscript plan (user request 2026-10-06,
24
+ following `paper-release-20260928/reference-papers/Nature Style Manuscript Writing.pdf`):
25
+ - Title and outline: 6 figures, Supplementary, Appendix, Discussion.
26
+ - "Manuscript plan: six main figures": a table of each figure's claim and how many panels are ready.
27
+ - For each figure:
28
+ - a divider;
29
+ - a plan slide, a table of panel / content / evidence slide / status (Ready, Adapt, Draft, Build, Run, Plan);
30
+ - the existing slides that serve its panels, each labelled "Fig. 2c" etc. in the top-right corner.
31
+ - Supplementary: a plan slide plus the from-scratch results. Appendix: the modified scSemiProfiler run. Discussion: the
32
+ other-tissues outlook.
33
+
34
+ User decisions of 2026-10-06:
35
+ - No PBISC-VAE: scSemiProfiler, a VAE-based method, is the comparison (Fig. 3).
36
+ - Fig. 2 shows LoRA first on the healthy cohort (ImMicro) with the realism metrics (precision, coverage, classifier
37
+ AUROC, MMD, E_N); the disease-cohort comparison comes later.
38
+ - CYBERSORTx and other bulk deconvolution methods go to the Supplementary only (PBISC generates single cells).
39
+ - Figs 4 and 6 stay unplanned. Their existing slides are kept in the section as "Fig. 4 candidate" / "Fig. 6 candidate".
40
+
41
+ Only order, section labels, the agenda and new plan or draft slides changed. The new slides are "Overview draft (Nature
42
+ style)", the manuscript's candidate Fig. 1, and "Pretraining corpus", the Fig. 1d strip. No new result figures were
43
+ made.
44
+ - The plan lives in `data/figure_plan.json`.
45
+ - `tools/figure_plan.py` draws the plan tables and the slide text, and checks that every slide is placed exactly once.
46
+ - `tools/restructure_figure_order_20261006.py` rebuilds the order from the plan. It is rerun after every plan change and
47
+ keeps all slide fields.
48
+ - The earlier section order (10 sections, 45 slides) is in `_archive/2026-10-06_before_figure_order/`.
49
+
50
+ Short keyword lines only; the figures carry the results. Every slide that uses a published method, metric or
51
+ baseline has a one-line "References:" footer; full citations are in the speaker notes.
52
+
53
+ - `PBISC-Diffusion_paper_summary_20260930.pptx`: the deck
54
+ - `PBISC-Diffusion_paper_summary_20260930.pdf`: LibreOffice PDF of the deck
55
+ - `data/slides_spec.json`: slide order, titles, keywords, footnotes, references, speaker-note text
56
+ - `generate_deck.py`: builds the pptx from `data/slides_spec.json` only (python-pptx)
57
+ - `figures/`: exactly the figures the slides show (PNG + PDF), made by `tools/sec*.py`. Intermediate panels go to a
58
+ temporary folder; superseded figures are deleted, not kept (2026-10-02, user request; every deleted file was
59
+ checked to be in the paper archive by sha256 first).
60
+ - `data/sec*.csv` and `data/*_slide_text.json`: every plotted or quoted number with its source path
61
+ - `render/`: PDF and 70-dpi slide JPGs for checking
62
+
63
+ ## Slide order
64
+
65
+ | section | slides |
66
+ |---|---|
67
+ | 1 Model overview | bulk in, cells out; denoiser |
68
+ | 2 Backbone | SDD → PBISC-Diffusion; bulk conditioning |
69
+ | 3 Architecture ablation | width & context (loss, benchmark); gene panel |
70
+ | 4 Metrics + SLE benchmark | **how we score generated cells** (metric table with references); SLE benchmark; per cell type; bulk broadcast baseline |
71
+ | 5 Real bulk vs pseudobulk | input shift; same shift in three cohorts; cells off-manifold; disease direction flips |
72
+ | 6 Paired fine-tuning | method; evaluation design |
73
+ | 7 LoRA ablations | full vs LoRA vs cond.-encoder-only; LoRA rank r = 4 / 16 / 64; K diversification |
74
+ | 8 Pairs needed | composition / coverage / steps (with scSemiProfiler at the same n); donor and disease signal; pairs from other cohorts; longer training on them (with training minutes) |
75
+ | 9 Paired validation | cohorts; 5 donors: cells, realism beyond P/C, P/C at k = 3 / 5 / 10, scSemiProfiler copies its representative, disease signal, CAT curves, time to apply; 5-fold CV (with scSemiProfiler on the same pairs); same training pairs: LoRA vs scSemiProfiler; 5-fold realism metrics |
76
+ | 10 Next steps | paired-subset cohorts (planned); other tissues from a few dozen pairs (Discussion framing of the from-scratch results) |
77
+ | Supplementary | no pretraining: same cohort, from scratch (pilot); no pretraining: other cohorts, from scratch (pilot); rare states: from scratch vs pretrained; deconvolution with the same pairs: composition; deconvolution with the same pairs: disease signal |
78
+ | Appendix | scSemiProfiler without its output threshold (sensitivity; modified read-out, not the official output) |
79
+
80
+ ## Rebuild
81
+
82
+ Everything is CPU only; no GPU or checkpoint is touched.
83
+
84
+ ```bash
85
+ # prerequisites (plan folder plans/paired_finetune_intradataset_20260927/, CPU):
86
+ # scsemi/tools/representative_dependence.py -> scsemi/analysis/representative_dependence_20261002/
87
+ # tools/contrast_extra.py (+ tools/contrast_extra_tables.py) -> scores_contrast/ (Spearman, ceiling, limma, CAT, RBO)
88
+ # tools/build_tpm_zeroshot.py + tools/score_tpm_zeroshot.sh -> scores/<ds>/zeroshot_tpm_20261002/pooled/
89
+ # (the length-corrected zero-shot arm needs one GPU sampling step: tools/sample_lockwait.sh, coordinator only)
90
+ cd /home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00
91
+ # shared helpers, not run directly: style.py, sec03_common.py, scsemi_results.py, fold_sizes.py
92
+ for f in sec01_overview sec02_backbone sec03_width_loss sec03_width_bench sec03_panel \
93
+ sec04_metrics_overview sec04_sle_benchmark sec05_condition_space sec05_cells_offmanifold \
94
+ sec05_behcet_direction sec05_shift_cohorts sec06_finetune_method sec07_ft_modes \
95
+ sec07_k_aug sec07_rank_sweep sec08_pairs_needed sec08_cross_cohort sec09_paired_validation sec09_extra_metrics \
96
+ sec09_time_to_apply sec09_scsemi_representative sec09_cat_curves sec10_paired_subset_cohorts \
97
+ secA_scsemi_readout sec07_no_pretraining sec08_cross_scratch sec09_same_pairs \
98
+ secS_scratch_rare_states secS_deconvolution fig3_time_days fig4_disease fig23_healthy fig5_rare_states sec10_other_tissues figure_plan; do # keep this order (sec10 reads secS; figure_plan last)
99
+ python3 "tools/$f.py" || break
100
+ done
101
+ python3 tools/restructure_figure_order_20261006.py # order the slides by data/figure_plan.json
102
+ python3 tools/sync_sec09_text.py # copy every generated slide text (sec09_index / text_source) into the spec
103
+ python3 generate_deck.py # -> PBISC-Diffusion_paper_summary_20260930.pptx
104
+ soffice --headless --convert-to pdf --outdir render PBISC-Diffusion_paper_summary_20260930.pptx
105
+ pdftoppm -jpeg -r 70 render/PBISC-Diffusion_paper_summary_20260930.pdf render/slide
106
+ cp render/PBISC-Diffusion_paper_summary_20260930.pdf .
107
+ ```
108
+
109
+ `generate_deck.py` stops with an error if a figure is missing, a title does not fit on one line, a footnote needs
110
+ more than 2 lines (1 line when the slide has references), the reference line needs more than 1 line, or any text
111
+ contains Korean or placeholder words. `tools/restructure_20261002.py` is the one-off script that produced the current
112
+ slide order and the references (it refuses to run twice).
113
+
114
+ ## Notes
115
+
116
+ - **No "all" label (2026-10-02).** The 5-fold arm trains each fold model on the other four folds minus 7–8
117
+ inner-validation donors; its test fold is never trained on (RUN.json `test_rows_never_loaded_for_training`). Figures
118
+ label it "5-fold CV (other 4 folds)" and learning-curve ticks show the training-pair count per fold (78–79 ImMicro,
119
+ 58–59 sepsis), read by `tools/fold_sizes.py`.
120
+ - **Learning curve x = 0 uses no pairs (2026-10-02).** It shows the zero-shot model fed the real bulk as measured
121
+ and after exon-length correction (counts / Ensembl union-exon kb, then the same fixed-depth arithmetic;
122
+ `plans/.../tools/build_tpm_zeroshot.py`, scored in `scores/<ds>/zeroshot_tpm_20261002/pooled`). The old x = 0
123
+ calibration point, whose alpha used every training pair of the fold, is gone; calibration appears only fitted on the
124
+ same n pairs as the LoRA point (squares; `cal_budget_20261001`).
125
+ - **Disease metrics (2026-10-02).** Next to Pearson logFC r and the Welch top-50 DEG overlap: Spearman r, the
126
+ split-half ceiling (observed vs observed, Spearman–Brown), limma-voom top-50 DEG, each arm's chance overlap, and
127
+ CAT curves with the k / 2G chance line (`plans/.../scores_contrast/`, tools/contrast_extra.py; every Pearson r and
128
+ Welch count reproduced exactly). Repeated samples of one patient (Imperial, Giroux, Ji) count as separate samples in
129
+ both DE tests, as in the scorer (footnote).
130
+ - Section 9 text is generated: `tools/sec09_paired_validation.py`, `sec09_extra_metrics.py`, `sec07_rank_sweep.py`,
131
+ `sec09_time_to_apply.py`, `sec09_scsemi_representative.py`, `sec09_cat_curves.py` write slide text JSON; sync copies
132
+ it. Hand-written: the keywords of the two "Pairs needed" slides (section 8) and of every slide in sections 1–7 and 10.
133
+ - Giroux's disease metrics exclude 196 sex-linked genes (severity is confounded with sex), from
134
+ `plans/.../scores_nosex/`. The calibration comparator is "Zero-shot + calibration" (user decision 2026-10-01).
135
+ - Story rule (user decision 2026-09-30): no PBISC-VAE and no reference calibration (refcal). The exon-length-corrected
136
+ input is used only as the no-pair x = 0 point of the learning curve (user decision 2026-10-02).
137
+ `tools/sec04_immicro.py` (refcal vs scSemiProfiler on ImMicro) is kept but is not part of the deck or the rebuild.
138
+ - scSemiProfiler 5-fold and equal-budget results are picked up automatically when they appear (`tools/scsemi_results.py`;
139
+ arm `scsemi__raw` in `scores/<cohort>/scsemi_cv_20261002/pooled*/`, `scsemi_n{5,10,20,40}__raw` in
140
+ `scores/<cohort>/scsemi_budget_20261002/pooled*/`; same donors and reference cells as the main pooled call only).
141
+ Then rerun sections 8 and 9, sync, recheck the section 8 keywords and rebuild.
142
+ - Earlier versions: `_archive/2026-09-30_before_no_vae_refcal/`, `_archive/2026-10-01_before_extra_metrics/`,
143
+ `_archive/2026-10-02_before_time_to_apply/`, `_archive/2026-10-02_before_restructure/` (pptx, PDF, spec; their
144
+ figures are in the paper archive). `DRAFT_1150_*`: the copy shown at the 2026-09-30 12:00 meeting.
145
+
146
+ - Added 2026-10-03 (user decision: the cross-cohort experiment is reported at K = 1000 only and is the figure that explains
147
+ why PBISC fits LoRA on a few pairs of each cohort): slides 25-26 in section 8, `tools/sec08_cross_cohort.py`.
148
+ - Slide 25 "Pairs from other cohorts do not transfer": per held-out cohort, composition L1 / coverage / disease logFC r of
149
+ zero-shot, calibration fitted on the other cohorts, LoRA r16 / r64 / full fine-tune trained on the other cohorts
150
+ (+ Liu 2021) at step saturation, and LoRA on the cohort's own pairs (5-fold pooled).
151
+ - Slide 26 "Longer training on other cohorts" (": gap stays" since 2026-10-06): the same metrics at every 20k-step
152
+ milestone.
153
+ - Source plan: `plans/paired_crosscohort_20261002/` (README; same-reference and same-sample checks in the script).
154
+ Agenda item 8 now reads "How many pairs, and do other cohorts' pairs transfer". The deck has 37 slides.
155
+ Pre-update copy: `_archive/2026-10-03_before_cross_cohort/`.
156
+
157
+ ## Sources
158
+
159
+ Final model: `runs/f01_6k_1x_seed20260627` (epoch 16, EMA). Scores and receipts come from
160
+ `plans/utility_studies_final6k_20260925/`, `plans/paired_finetune_intradataset_20260927/`,
161
+ `plans/immicro_scsemi_comparison_20260927/`, `plans/floor01_campaign_20260923/`,
162
+ `analysis/scsemi_benchmark_diffusion_20260913/` and the run folders named in each `data/sec*.csv`. Reference PDFs:
163
+ `/home/sj_server_1/PBISC/paper-release-20260928/reference-papers/` (INDEX.md). Manuscript:
164
+ `/home/sj_server_1/PBISC/paper-release-20260928/manuscript/`.
165
+ - 2026-10-04 appendix (user decision: supplementary, appendix only, because it changes scSemiProfiler's official
166
+ output). Slide 38 is the divider "Appendix" and slide 39 is "Appendix: scSemiProfiler without output threshold"
167
+ (`tools/secA_scsemi_readout.py`, `data/secA_scsemi_readout{.csv,_slide_text.json}`).
168
+ - Inputs: `plans/paired_finetune_intradataset_20260927/scsemi/analysis/output_variants_20261003/`. The script checks
169
+ that its LoRA-5 and official scSemiProfiler values equal the section 9 slide data draw by draw.
170
+ - Result: without upstream's output threshold, scSemiProfiler's coverage rises in 5/5 cohorts, and 23/23 LoRA-5
171
+ comparisons (coverage, precision, composition, logFC r, DEG) keep their winner.
172
+ - The outline keeps its 10 sections (the builder requires 10). The pre-change copy is in
173
+ `_archive/2026-10-04_before_appendix/`. The deck has 39 slides.
174
+ - 2026-10-05 update (user request: put the results so far into the deck). Pre-change copy: `_archive/2026-10-05_before_scratch_cv/`.
175
+ - New slide 23, "No pretraining: same cohort, from scratch" (`tools/sec07_no_pretraining.py`). Pilot on sepsis fold 0
176
+ (17 donors). Reads `fold0_scratch_20261005/` and the runs' RUN.json. The donor composition r is recomputed from
177
+ per_donor.csv and reproduces ablation_extra_donor.csv.
178
+ - New slide 28, "No pretraining: other cohorts, from scratch" (`tools/sec08_cross_scratch.py`). Held-out sepsis pilot.
179
+ Every arm is read from `paired_crosscohort_20261002/scores_masked/`: genes no training cohort measured are zeroed
180
+ in all arms, because the unmasked scratch arm puts 91–94 % of its UMI there (read from the generated_masked logs
181
+ since 2026-10-06).
182
+ - New slide 38, "Same training pairs: LoRA vs scSemiProfiler" (`tools/sec09_same_pairs.py`). scSemiProfiler 5-fold
183
+ CV with LoRA's own training pairs, plus GPU hours per fold from the receipts on either host. Cohorts that are still
184
+ running show "in progress"; rerun the script as they finish.
185
+ - These two slides now draw the scSemiProfiler CV / budget runs automatically:
186
+ - Slide 24, "Pairs needed" (diamonds; ImMicro so far): keyword 2 reworded, footnote extended.
187
+ - Slide 37, "5-fold CV" (yellow bar; ImMicro and Ji so far).
188
+ - `tools/sec09_paired_validation.py` reads the scSemiProfiler CV arm's Spearman / limma values from
189
+ `scores_contrast/<cohort>/scsemi_cv_20261002/pooled/` (contrast_extra.py --design scored). Pearson r and the Welch
190
+ DEG must match the scorer; the values stay blank until computed. Cohorts not yet run say "in progress".
191
+ - Agenda item 7 now reads "LoRA: compute, rank, K; training from scratch". The deck has 42 slides.
192
+ - New helper: `tools/grouped_bars.py`.
193
+ - 2026-10-06 update (user request: check that the cross-cohort LoRA / full FT, cross-cohort from-scratch and
194
+ same-cohort from-scratch (+ recipes) results, with benchmarks and training times, and the scratch-vs-pretrained rare
195
+ states are in the deck; user decision: the from-scratch results go to the paper's Supplementary and the Discussion
196
+ presents them as a route to other tissues). Pre-change copy: `_archive/2026-10-06_before_supplementary/`.
197
+ - **Supplementary block (new divider, slides 40-43).**
198
+ - "No pretraining: same cohort, from scratch" and "No pretraining: other cohorts, from scratch" moved here from
199
+ sections 7 and 8. Their content is unchanged; slide 42's notes now name the cross-cohort slides by title.
200
+ - New "Rare states: from scratch vs pretrained" (`tools/secS_scratch_rare_states.py`).
201
+ - It reads the rare-state screen (`plans/rare_states_screen_20261004/out/sepsis_fold0_*` and
202
+ `sepsis_loco_masked_*`).
203
+ - The cross-cohort arms use the masked scoring (46 never-measured genes zeroed in every arm).
204
+ - The donor bootstrap reproduces the verified analysis in `out/scratch_vs_lora_20261005/REPORT.md`.
205
+ - **Section 10 "Next steps".**
206
+ - New "Next: other tissues from a few dozen pairs" (`tools/sec10_other_tissues.py`): a comparison table, pretrained
207
+ + LoRA vs from scratch.
208
+ - Every value is read from the deck's own source tables. The say text is the user's Discussion framing.
209
+ - **Slide 26 "Longer training on other cohorts".** The first keyword is now training minutes to saturation (RUN.json
210
+ wall seconds), with per-cohort minutes and steps in the notes (`tools/sec08_cross_cohort.py`).
211
+ - **Slide 34 "5 donors: time to apply".**
212
+ - The pretraining hours are read from `data/sec06_ft_method.csv`, no longer hard-coded.
213
+ - The note names the 'Fine-tuning with paired bulk + sc' slide by title. Its old "slide 15" pointed at the wrong
214
+ slide.
215
+ - Agenda items 7 and 10 updated. Spec change: `tools/restructure_20261006.py` (refuses to run twice). The deck has 45
216
+ slides; no Korean text.
217
+ - **Review pass (same day).** An independent 5-agent review of the changed slides confirmed 39 issues; all are
218
+ fixed. Pre-review copies of the touched scripts and the spec: `_archive/2026-10-06_before_supplementary/*.pre_review`.
219
+ - Slide 39: pretraining now reads 33.1 M train cells (`train_split_cells`; the 41.4 M corpus includes val/test).
220
+ The rare-state row follows the bootstrap verdicts on both sides (closer on ISG-high T / on DN2 B; labels and
221
+ states both arms miss by > 4-fold are not counted). "No corpus" became "come close": the scratch runs still took
222
+ the panel, value scaler and z-score constants from the PBMC checkpoint (RUN.json `kept_from_checkpoint`, now in
223
+ the notes). The say text carries the one-fold pilot qualifier; the footnote names both pilots.
224
+ - Slide 43: "no significant difference on average" (not "no difference"). Keyword 2 is the cycling T/NK count
225
+ (8 of 8 comparisons). The notes add the ISG-high T split by panel, the scratch-closer states (DN2 B, MS1), the
226
+ 52-call tally, the fold-0 caveat (fold 0 is the own-pair LoRA's best fold for C1Q-high and cycling T/NK,
227
+ computed from `folds.csv`), label states unthinned, and "8 of 13 states shown".
228
+ - Slide 26: title "...: gap stays" and "drifts in Sepsis and Ji" are computed from the milestones (gap = no milestone
229
+ reaches the own-cohort coverage; drift = full fine-tune L1 up by >= 0.05). Minutes are in
230
+ `data/sec08_cross_cohort.csv` (wall_seconds, minutes, run_receipt) and in the numbers list.
231
+ - Slide 42: UMI share (94 %, 91–94 % across milestones), the observed share (0.014 %, from `cells_panel6k.npz`)
232
+ and both arms' stopping settings are read from the receipts; the "none" label sits inside the axes.
233
+ - Slide 34: keywords use the cohort means of the figure (17–59×, 57 min–4.1 h); the per-draw range 11–63× is in the
234
+ notes. The right panel shares the bars' rows and has a title.
235
+ - Talk text and pointers: slides 23, 25, 26, 45 (say), 22 (recipes description), 32 and 36 (slide pointers by
236
+ title), slide 1 subtitle "updated 2026-10-06".
237
+ - 2026-10-08 update (user request: put the BayesPrism, CIBERSORTx and scSemiProfiler 5-fold results into the deck).
238
+ Pre-change copy: `_archive/2026-10-08_before_deconvolution/`.
239
+ - **Two new Supplementary slides** (`tools/secS_deconvolution.py`, `data/secS_deconvolution{.csv,_slide_text.json}`):
240
+ "Deconvolution with the same pairs: composition" and "...: disease signal".
241
+ - Source: `plans/bayesprism_paired_20261006/` (README, `results/RESULTS_full.md`, `RESULTS_cibersortx.md`).
242
+ - BayesPrism (recommended genes) and official CIBERSORTx (Fractions S-mode + HiRes) use the same paired donors
243
+ as the reference and the test samples' real bulk as the mixture, with the benchmark's own truth and scorer.
244
+ - Keywords and notes are computed from the tables.
245
+ - **Supplementary plan.** The planned "Bulk deconvolution methods" row is replaced by the two Ready slides.
246
+ `tools/figure_plan.py` now takes an optional per-slide note (`supplementary.notes`) and drops "Planned:" when
247
+ nothing is planned.
248
+ - **New scSemiProfiler results picked up (server_1):**
249
+ - Sepsis and Giroux 5-fold CV. Giroux was finalized on server_1 from sha-checked copies of its fold NPZs, and
250
+ rescored without sex-linked genes in `scores_nosex/giroux2022/scsemi_cv_20261002/pooled`.
251
+ - Sepsis equal-budget n = 5/10/20/40.
252
+ - Imperial 5-fold: finished on server_2 at 13:45 and was finalized on server_1 from sha-checked fold copies.
253
+ scSemiProfiler 5-fold now covers all five cohorts.
254
+ - Spearman/limma extras for sepsis, Giroux and Imperial; realism extras for all five cohorts.
255
+ - **Text changes from the new results:**
256
+ - "Same training pairs": keywords are data-driven. LoRA leads on coverage and precision in 5/5 cohorts;
257
+ composition 4/5 and logFC r 3/4, where scSemiProfiler leads in Giroux. The GPU-time ratio is 19–62×.
258
+ - sec09_same_pairs.py now reads the sepsis fold-0 pilot queue tag (`sep_f0`). For Giroux it quotes DEG from
259
+ scores_nosex, and for older pooled LoRA calls from pooled_deg.
260
+ - "5-fold CV" keyword: logFC r 3/4.
261
+ - "Pairs needed" (hand-written): scSemiProfiler coverage 0.04 / 0.10. On sepsis disease logFC r,
262
+ scSemiProfiler at 5–40 pairs (0.52–0.58) is above LoRA (0.29–0.48), while its top-50 DEG stays at 2–6.
263
+ - 2026-10-08, new figure split (user decision; supersedes the 2026-10-06 split; pre-change copy
264
+ `_archive/2026-10-08_before_new_figure_plan/`).
265
+ - Fig. 2: LoRA fine-tuning with no disease metrics.
266
+ - Fig. 3: PBISC vs scSemiProfiler on healthy donors, with time as a main result.
267
+ - Fig. 4: disease benchmarks on the paired cohorts (PBISC versions, scSemiProfiler, and BayesPrism / CIBERSORTx
268
+ labelled as cell-type deconvolution; the deconvolution slides moved here from the Supplementary).
269
+ - Fig. 5: rare-cell fractions and detection.
270
+ - Fig. 6: new findings from the bulk-only sepsis and COVID samples (K = 1,000 and 4,000).
271
+ - The cross-cohort transfer slides moved to the Supplementary; their placement is open.
272
+ - New slide "Time: days for scSemiProfiler, minutes for LoRA" (`tools/fig3_time_days.py`, Fig. 3d).
273
+ - Inputs: GPU hours per 5-fold experiment from the receipts (`data/sec09_same_pairs.csv`, checked against
274
+ the scSemiProfiler event logs on both hosts), the 5-donor draws (`data/sec09_time_to_apply.csv`) and the
275
+ one-time pretraining (`data/sec06_ft_method.csv`).
276
+ - Results: ImMicro 24 h vs 1.2 h, sepsis 38 h vs 37 min. All runs: scSemiProfiler 184 h (7.7 days) vs PBISC
277
+ 22 h including pretraining.
278
+ - The equal-budget scSemiProfiler runs are excluded: they reuse the 5-fold run's representative models.
279
+ - Panel status: Build / Run marks new slides or analyses still to do; Adapt marks slides to re-scope (healthy-only
280
+ Fig. 2-3, disease columns into Fig. 4).
281
+ - 2026-10-08, comparison rules (user decision; memory feedback_paper_comparison_rules):
282
+ - **Time.** Only per-cohort GPU work counts: no PBISC pretraining, no GPU queue waits. The time slide now shows the
283
+ 5-donor draws (main) next to the 5-fold runs (separate). All runs: 7.7 GPU-days vs 5.7 h.
284
+ - **No bulk-broadcast baseline.** It is removed from the SLE benchmark, CAT, deconvolution and "Pairs needed"
285
+ figures.
286
+ - The "Bulk broadcast baseline" slide is gone. Its partial r panel is now on the SLE benchmark slide
287
+ (0.21 vs 0.17).
288
+ - Still to rebuild in their own phases: Fig. 2e (ImMicro only) and Fig. 6a.
289
+ - **Main comparison = 5 pairs** (LoRA-5 vs scSemiProfiler-5); 5-fold is reported separately. Partial r is
290
+ emphasised (bold panel titles).
291
+ - **New `tools/fig4_disease.py`**, which checks all 200 logFC r / DEG values against the section-9 tables:
292
+ - "Disease signal with 5 pairs: LoRA-5 vs others" (4b);
293
+ - "5-fold CV: disease signal" (4c);
294
+ - "Sepsis: fine-tuning variants" (details).
295
+ - The old "5 donors: LoRA vs scSemiProfiler — disease signal" slide is retired. `tools/sync_sec09_text.py` lists it
296
+ in RETIRED.
297
+ - The deconvolution slides are retitled "Cell-type deconvolution, same pairs: ...".
298
+ - 2026-10-08, healthy-only Figs 2-3 (`tools/fig23_healthy.py`).
299
+ - Eight ImMicro-only slides, re-plotted from the deck's own data tables; nothing is re-scored.
300
+ - Fig. 2 (no disease metrics):
301
+ - cells, realism, full / LoRA / condition encoder, pairs needed, rank and K;
302
+ - 5 donors (main) shown next to 5-fold (separate).
303
+ - Fig. 3 (vs scSemiProfiler):
304
+ - LoRA-5 vs scSemiProfiler-5 on 6 cell metrics: LoRA ahead on 6 of 6;
305
+ - the same pairs, 5 to all;
306
+ - scSemiProfiler copies its representative;
307
+ - time.
308
+ - The earlier all-cohort slides moved to the Supplementary (note "all five cohorts").
309
+ - "5-fold CV: train on the other 4 folds" is retired (it carried the broadcast; its content is now in Fig. 4c and
310
+ the healthy slides). It is listed in RETIRED of `tools/sync_sec09_text.py`.
311
+ - 2026-10-08, Fig. 5 rare cells (`tools/fig5_rare_states.py`).
312
+ - Source: new plan `plans/rare_states_paired_20261008` (README). It covers 4 paired disease cohorts, the 5-donor
313
+ draws and 5-fold, and the arms zero-shot, calibration, scSemiProfiler and LoRA. Each NPZ is sha-checked and the
314
+ benchmark's Poisson read-out and labels are reproduced cell by cell.
315
+ - Three slides:
316
+ - fraction (5a);
317
+ - donors and disease direction (5b);
318
+ - 5-fold, separate (5c).
319
+ - Results over 56 state × cohort pairs, 5 donors:
320
+ - LoRA-5 closer to the observed fraction than scSemiProfiler-5 in 51/56;
321
+ - within 2-fold: 19 vs 5;
322
+ - better donor ranking: 43/56;
323
+ - disease direction kept: 73% vs 61%.
324
+ - Fig. 6a no longer mentions the broadcast. No slide text mentions it now.
325
+ - 2026-10-10, last broadcast mention removed from a figure (found while rewriting the manuscript from this deck).
326
+ - Fig. 2d "How we score generated cells" (`tools/sec04_metrics_overview.py`) still listed "broadcast; split-half
327
+ ceiling" as the comparator of logFC r inside the table image. It now reads "zero-shot; partial r (vs bulk)".
328
+ - Old tool, CSV and figure: `_archive/2026-10-10_metrics_overview_broadcast/`. The deck was rebuilt (76 slides); a
329
+ text search of every slide, the notes and the PDF twin of every figure a slide uses finds no "broadcast". Three
330
+ figure files of retired slides still contain it and are not used: `sec04_sle_broadcast`, `sec09_fewpair_disease`,
331
+ `sec09_fivefold`.
332
+ - The manuscript was rewritten from this deck on 2026-10-10 (`paper-release-20260928/manuscript/`,
333
+ `editorial/rewrite_20261010.md`); its figures are copies of this folder's figure PDFs.
334
+ - 2026-10-10, LoRA rank figure key (`tools/sec07_rank_sweep.py`): "LoRA rank r = 16 (used in the deck)" now reads
335
+ "(used throughout)", because the same panel is Supplementary Fig. 12a of the manuscript. Old files:
336
+ `_archive/2026-10-10_rank_sweep_label/`. Deck rebuilt (76 slides).