junidude14 commited on
Commit
ac3539d
·
verified ·
1 Parent(s): 1523375

Archive 4 checkpoints (1-4)

Browse files
.gitattributes CHANGED
@@ -237,3 +237,5 @@ paper-releases/pbisc-diffusion/updates/20261013T012029Z-restore-original-deck-st
237
  paper-releases/pbisc-diffusion/updates/20261013T012029Z-restore-original-deck-style/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
238
  paper-releases/pbisc-diffusion/updates/20261013T015549Z-composition-error-comparison/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
239
  paper-releases/pbisc-diffusion/updates/20261013T015549Z-composition-error-comparison/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
 
 
 
237
  paper-releases/pbisc-diffusion/updates/20261013T012029Z-restore-original-deck-style/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
238
  paper-releases/pbisc-diffusion/updates/20261013T015549Z-composition-error-comparison/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
239
  paper-releases/pbisc-diffusion/updates/20261013T015549Z-composition-error-comparison/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
240
+ paper-releases/pbisc-diffusion/updates/20261013T022035Z-pbisc-red-scsemi-blue/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
241
+ paper-releases/pbisc-diffusion/updates/20261013T022035Z-pbisc-red-scsemi-blue/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/20261013T022035Z-pbisc-red-scsemi-blue/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:5e2bcfc2e16f419f2cac37ec55688f55171233cbe8f9faa817a431f4ffbdde00
3
+ size 4684450
paper-releases/pbisc-diffusion/updates/20261013T022035Z-pbisc-red-scsemi-blue/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:3cd501c1dea00c52e745df1c9d09131a5912a3746b3a8e557de1d453a0754443
3
+ size 4741208
paper-releases/pbisc-diffusion/updates/20261013T022035Z-pbisc-red-scsemi-blue/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/README.md ADDED
@@ -0,0 +1,342 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ Current method palette: **PBISC red #B2182B; scSemiProfiler blue #2166AC**. PBISC adaptations use red/rose shades; scSemi stage/readout variants use blue shades. Cell-type/cohort encodings and observed references retain their own colors. All selected figures pass through the explicit per-asset policy in `data/method_palette_20261013/palette.json` when the review is built.
20
+
21
+ - [Current composition comparison](figures/method_palette_20261013/review_style_20261013_healthy_composition.png): separate error bars and donor wins, all six types; [metric record](data/composition_error_20261013/REPORT.md).
22
+ - [Palette verification](data/method_palette_20261013/VERIFICATION.json) · [style verification](data/style_review_20261013/VERIFICATION.json).
23
+ - Current export command: `CUDA_VISIBLE_DEVICES= python data/style_review_20261013/render.py` (CPU, run under the host's bounded-memory policy).
24
+
25
+ The original 76-slide deck below remains the prior source/reference deck.
26
+
27
+ ## Original 2026-09-30 r00 deck and historical change log
28
+
29
+ 76-slide English deck, ordered by the six main figures of the Nature-style manuscript plan (user request 2026-10-06,
30
+ following `paper-release-20260928/reference-papers/Nature Style Manuscript Writing.pdf`):
31
+ - Title and outline: 6 figures, Supplementary, Appendix, Discussion.
32
+ - "Manuscript plan: six main figures": a table of each figure's claim and how many panels are ready.
33
+ - For each figure:
34
+ - a divider;
35
+ - a plan slide, a table of panel / content / evidence slide / status (Ready, Adapt, Draft, Build, Run, Plan);
36
+ - the existing slides that serve its panels, each labelled "Fig. 2c" etc. in the top-right corner.
37
+ - Supplementary: a plan slide plus the from-scratch results. Appendix: the modified scSemiProfiler run. Discussion: the
38
+ other-tissues outlook.
39
+
40
+ User decisions of 2026-10-06:
41
+ - No PBISC-VAE: scSemiProfiler, a VAE-based method, is the comparison (Fig. 3).
42
+ - Fig. 2 shows LoRA first on the healthy cohort (ImMicro) with the realism metrics (precision, coverage, classifier
43
+ AUROC, MMD, E_N); the disease-cohort comparison comes later.
44
+ - CYBERSORTx and other bulk deconvolution methods go to the Supplementary only (PBISC generates single cells).
45
+ - Figs 4 and 6 stay unplanned. Their existing slides are kept in the section as "Fig. 4 candidate" / "Fig. 6 candidate".
46
+
47
+ Only order, section labels, the agenda and new plan or draft slides changed. The new slides are "Overview draft (Nature
48
+ style)", the manuscript's candidate Fig. 1, and "Pretraining corpus", the Fig. 1d strip. No new result figures were
49
+ made.
50
+ - The plan lives in `data/figure_plan.json`.
51
+ - `tools/figure_plan.py` draws the plan tables and the slide text, and checks that every slide is placed exactly once.
52
+ - `tools/restructure_figure_order_20261006.py` rebuilds the order from the plan. It is rerun after every plan change and
53
+ keeps all slide fields.
54
+ - The earlier section order (10 sections, 45 slides) is in `_archive/2026-10-06_before_figure_order/`.
55
+
56
+ Short keyword lines only; the figures carry the results. Every slide that uses a published method, metric or
57
+ baseline has a one-line "References:" footer; full citations are in the speaker notes.
58
+
59
+ - `PBISC-Diffusion_paper_summary_20260930.pptx`: the deck
60
+ - `PBISC-Diffusion_paper_summary_20260930.pdf`: LibreOffice PDF of the deck
61
+ - `data/slides_spec.json`: slide order, titles, keywords, footnotes, references, speaker-note text
62
+ - `generate_deck.py`: builds the pptx from `data/slides_spec.json` only (python-pptx)
63
+ - `figures/`: exactly the figures the slides show (PNG + PDF), made by `tools/sec*.py`. Intermediate panels go to a
64
+ temporary folder; superseded figures are deleted, not kept (2026-10-02, user request; every deleted file was
65
+ checked to be in the paper archive by sha256 first).
66
+ - `data/sec*.csv` and `data/*_slide_text.json`: every plotted or quoted number with its source path
67
+ - `render/`: PDF and 70-dpi slide JPGs for checking
68
+
69
+ ## Slide order
70
+
71
+ | section | slides |
72
+ |---|---|
73
+ | 1 Model overview | bulk in, cells out; denoiser |
74
+ | 2 Backbone | SDD → PBISC-Diffusion; bulk conditioning |
75
+ | 3 Architecture ablation | width & context (loss, benchmark); gene panel |
76
+ | 4 Metrics + SLE benchmark | **how we score generated cells** (metric table with references); SLE benchmark; per cell type; bulk broadcast baseline |
77
+ | 5 Real bulk vs pseudobulk | input shift; same shift in three cohorts; cells off-manifold; disease direction flips |
78
+ | 6 Paired fine-tuning | method; evaluation design |
79
+ | 7 LoRA ablations | full vs LoRA vs cond.-encoder-only; LoRA rank r = 4 / 16 / 64; K diversification |
80
+ | 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) |
81
+ | 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 |
82
+ | 10 Next steps | paired-subset cohorts (planned); other tissues from a few dozen pairs (Discussion framing of the from-scratch results) |
83
+ | 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 |
84
+ | Appendix | scSemiProfiler without its output threshold (sensitivity; modified read-out, not the official output) |
85
+
86
+ ## Rebuild
87
+
88
+ Everything is CPU only; no GPU or checkpoint is touched.
89
+
90
+ ```bash
91
+ # prerequisites (plan folder plans/paired_finetune_intradataset_20260927/, CPU):
92
+ # scsemi/tools/representative_dependence.py -> scsemi/analysis/representative_dependence_20261002/
93
+ # tools/contrast_extra.py (+ tools/contrast_extra_tables.py) -> scores_contrast/ (Spearman, ceiling, limma, CAT, RBO)
94
+ # tools/build_tpm_zeroshot.py + tools/score_tpm_zeroshot.sh -> scores/<ds>/zeroshot_tpm_20261002/pooled/
95
+ # (the length-corrected zero-shot arm needs one GPU sampling step: tools/sample_lockwait.sh, coordinator only)
96
+ cd /home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00
97
+ # shared helpers, not run directly: style.py, sec03_common.py, scsemi_results.py, fold_sizes.py
98
+ for f in sec01_overview sec02_backbone sec03_width_loss sec03_width_bench sec03_panel \
99
+ sec04_metrics_overview sec04_sle_benchmark sec05_condition_space sec05_cells_offmanifold \
100
+ sec05_behcet_direction sec05_shift_cohorts sec06_finetune_method sec07_ft_modes \
101
+ sec07_k_aug sec07_rank_sweep sec08_pairs_needed sec08_cross_cohort sec09_paired_validation sec09_extra_metrics \
102
+ sec09_time_to_apply sec09_scsemi_representative sec09_cat_curves sec10_paired_subset_cohorts \
103
+ secA_scsemi_readout sec07_no_pretraining sec08_cross_scratch sec09_same_pairs \
104
+ 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)
105
+ python3 "tools/$f.py" || break
106
+ done
107
+ python3 tools/restructure_figure_order_20261006.py # order the slides by data/figure_plan.json
108
+ python3 tools/sync_sec09_text.py # copy every generated slide text (sec09_index / text_source) into the spec
109
+ python3 generate_deck.py # -> PBISC-Diffusion_paper_summary_20260930.pptx
110
+ soffice --headless --convert-to pdf --outdir render PBISC-Diffusion_paper_summary_20260930.pptx
111
+ pdftoppm -jpeg -r 70 render/PBISC-Diffusion_paper_summary_20260930.pdf render/slide
112
+ cp render/PBISC-Diffusion_paper_summary_20260930.pdf .
113
+ ```
114
+
115
+ `generate_deck.py` stops with an error if a figure is missing, a title does not fit on one line, a footnote needs
116
+ more than 2 lines (1 line when the slide has references), the reference line needs more than 1 line, or any text
117
+ contains Korean or placeholder words. `tools/restructure_20261002.py` is the one-off script that produced the current
118
+ slide order and the references (it refuses to run twice).
119
+
120
+ ## Notes
121
+
122
+ - **No "all" label (2026-10-02).** The 5-fold arm trains each fold model on the other four folds minus 7–8
123
+ inner-validation donors; its test fold is never trained on (RUN.json `test_rows_never_loaded_for_training`). Figures
124
+ label it "5-fold CV (other 4 folds)" and learning-curve ticks show the training-pair count per fold (78–79 ImMicro,
125
+ 58–59 sepsis), read by `tools/fold_sizes.py`.
126
+ - **Learning curve x = 0 uses no pairs (2026-10-02).** It shows the zero-shot model fed the real bulk as measured
127
+ and after exon-length correction (counts / Ensembl union-exon kb, then the same fixed-depth arithmetic;
128
+ `plans/.../tools/build_tpm_zeroshot.py`, scored in `scores/<ds>/zeroshot_tpm_20261002/pooled`). The old x = 0
129
+ calibration point, whose alpha used every training pair of the fold, is gone; calibration appears only fitted on the
130
+ same n pairs as the LoRA point (squares; `cal_budget_20261001`).
131
+ - **Disease metrics (2026-10-02).** Next to Pearson logFC r and the Welch top-50 DEG overlap: Spearman r, the
132
+ split-half ceiling (observed vs observed, Spearman–Brown), limma-voom top-50 DEG, each arm's chance overlap, and
133
+ CAT curves with the k / 2G chance line (`plans/.../scores_contrast/`, tools/contrast_extra.py; every Pearson r and
134
+ Welch count reproduced exactly). Repeated samples of one patient (Imperial, Giroux, Ji) count as separate samples in
135
+ both DE tests, as in the scorer (footnote).
136
+ - Section 9 text is generated: `tools/sec09_paired_validation.py`, `sec09_extra_metrics.py`, `sec07_rank_sweep.py`,
137
+ `sec09_time_to_apply.py`, `sec09_scsemi_representative.py`, `sec09_cat_curves.py` write slide text JSON; sync copies
138
+ it. Hand-written: the keywords of the two "Pairs needed" slides (section 8) and of every slide in sections 1–7 and 10.
139
+ - Giroux's disease metrics exclude 196 sex-linked genes (severity is confounded with sex), from
140
+ `plans/.../scores_nosex/`. The calibration comparator is "Zero-shot + calibration" (user decision 2026-10-01).
141
+ - Story rule (user decision 2026-09-30): no PBISC-VAE and no reference calibration (refcal). The exon-length-corrected
142
+ input is used only as the no-pair x = 0 point of the learning curve (user decision 2026-10-02).
143
+ `tools/sec04_immicro.py` (refcal vs scSemiProfiler on ImMicro) is kept but is not part of the deck or the rebuild.
144
+ - scSemiProfiler 5-fold and equal-budget results are picked up automatically when they appear (`tools/scsemi_results.py`;
145
+ arm `scsemi__raw` in `scores/<cohort>/scsemi_cv_20261002/pooled*/`, `scsemi_n{5,10,20,40}__raw` in
146
+ `scores/<cohort>/scsemi_budget_20261002/pooled*/`; same donors and reference cells as the main pooled call only).
147
+ Then rerun sections 8 and 9, sync, recheck the section 8 keywords and rebuild.
148
+ - Earlier versions: `_archive/2026-09-30_before_no_vae_refcal/`, `_archive/2026-10-01_before_extra_metrics/`,
149
+ `_archive/2026-10-02_before_time_to_apply/`, `_archive/2026-10-02_before_restructure/` (pptx, PDF, spec; their
150
+ figures are in the paper archive). `DRAFT_1150_*`: the copy shown at the 2026-09-30 12:00 meeting.
151
+
152
+ - Added 2026-10-03 (user decision: the cross-cohort experiment is reported at K = 1000 only and is the figure that explains
153
+ why PBISC fits LoRA on a few pairs of each cohort): slides 25-26 in section 8, `tools/sec08_cross_cohort.py`.
154
+ - Slide 25 "Pairs from other cohorts do not transfer": per held-out cohort, composition L1 / coverage / disease logFC r of
155
+ zero-shot, calibration fitted on the other cohorts, LoRA r16 / r64 / full fine-tune trained on the other cohorts
156
+ (+ Liu 2021) at step saturation, and LoRA on the cohort's own pairs (5-fold pooled).
157
+ - Slide 26 "Longer training on other cohorts" (": gap stays" since 2026-10-06): the same metrics at every 20k-step
158
+ milestone.
159
+ - Source plan: `plans/paired_crosscohort_20261002/` (README; same-reference and same-sample checks in the script).
160
+ Agenda item 8 now reads "How many pairs, and do other cohorts' pairs transfer". The deck has 37 slides.
161
+ Pre-update copy: `_archive/2026-10-03_before_cross_cohort/`.
162
+
163
+ ## Sources
164
+
165
+ Final model: `runs/f01_6k_1x_seed20260627` (epoch 16, EMA). Scores and receipts come from
166
+ `plans/utility_studies_final6k_20260925/`, `plans/paired_finetune_intradataset_20260927/`,
167
+ `plans/immicro_scsemi_comparison_20260927/`, `plans/floor01_campaign_20260923/`,
168
+ `analysis/scsemi_benchmark_diffusion_20260913/` and the run folders named in each `data/sec*.csv`. Reference PDFs:
169
+ `/home/sj_server_1/PBISC/paper-release-20260928/reference-papers/` (INDEX.md). Manuscript:
170
+ `/home/sj_server_1/PBISC/paper-release-20260928/manuscript/`.
171
+ - 2026-10-04 appendix (user decision: supplementary, appendix only, because it changes scSemiProfiler's official
172
+ output). Slide 38 is the divider "Appendix" and slide 39 is "Appendix: scSemiProfiler without output threshold"
173
+ (`tools/secA_scsemi_readout.py`, `data/secA_scsemi_readout{.csv,_slide_text.json}`).
174
+ - Inputs: `plans/paired_finetune_intradataset_20260927/scsemi/analysis/output_variants_20261003/`. The script checks
175
+ that its LoRA-5 and official scSemiProfiler values equal the section 9 slide data draw by draw.
176
+ - Result: without upstream's output threshold, scSemiProfiler's coverage rises in 5/5 cohorts, and 23/23 LoRA-5
177
+ comparisons (coverage, precision, composition, logFC r, DEG) keep their winner.
178
+ - The outline keeps its 10 sections (the builder requires 10). The pre-change copy is in
179
+ `_archive/2026-10-04_before_appendix/`. The deck has 39 slides.
180
+ - 2026-10-05 update (user request: put the results so far into the deck). Pre-change copy: `_archive/2026-10-05_before_scratch_cv/`.
181
+ - New slide 23, "No pretraining: same cohort, from scratch" (`tools/sec07_no_pretraining.py`). Pilot on sepsis fold 0
182
+ (17 donors). Reads `fold0_scratch_20261005/` and the runs' RUN.json. The donor composition r is recomputed from
183
+ per_donor.csv and reproduces ablation_extra_donor.csv.
184
+ - New slide 28, "No pretraining: other cohorts, from scratch" (`tools/sec08_cross_scratch.py`). Held-out sepsis pilot.
185
+ Every arm is read from `paired_crosscohort_20261002/scores_masked/`: genes no training cohort measured are zeroed
186
+ in all arms, because the unmasked scratch arm puts 91–94 % of its UMI there (read from the generated_masked logs
187
+ since 2026-10-06).
188
+ - New slide 38, "Same training pairs: LoRA vs scSemiProfiler" (`tools/sec09_same_pairs.py`). scSemiProfiler 5-fold
189
+ CV with LoRA's own training pairs, plus GPU hours per fold from the receipts on either host. Cohorts that are still
190
+ running show "in progress"; rerun the script as they finish.
191
+ - These two slides now draw the scSemiProfiler CV / budget runs automatically:
192
+ - Slide 24, "Pairs needed" (diamonds; ImMicro so far): keyword 2 reworded, footnote extended.
193
+ - Slide 37, "5-fold CV" (yellow bar; ImMicro and Ji so far).
194
+ - `tools/sec09_paired_validation.py` reads the scSemiProfiler CV arm's Spearman / limma values from
195
+ `scores_contrast/<cohort>/scsemi_cv_20261002/pooled/` (contrast_extra.py --design scored). Pearson r and the Welch
196
+ DEG must match the scorer; the values stay blank until computed. Cohorts not yet run say "in progress".
197
+ - Agenda item 7 now reads "LoRA: compute, rank, K; training from scratch". The deck has 42 slides.
198
+ - New helper: `tools/grouped_bars.py`.
199
+ - 2026-10-06 update (user request: check that the cross-cohort LoRA / full FT, cross-cohort from-scratch and
200
+ same-cohort from-scratch (+ recipes) results, with benchmarks and training times, and the scratch-vs-pretrained rare
201
+ states are in the deck; user decision: the from-scratch results go to the paper's Supplementary and the Discussion
202
+ presents them as a route to other tissues). Pre-change copy: `_archive/2026-10-06_before_supplementary/`.
203
+ - **Supplementary block (new divider, slides 40-43).**
204
+ - "No pretraining: same cohort, from scratch" and "No pretraining: other cohorts, from scratch" moved here from
205
+ sections 7 and 8. Their content is unchanged; slide 42's notes now name the cross-cohort slides by title.
206
+ - New "Rare states: from scratch vs pretrained" (`tools/secS_scratch_rare_states.py`).
207
+ - It reads the rare-state screen (`plans/rare_states_screen_20261004/out/sepsis_fold0_*` and
208
+ `sepsis_loco_masked_*`).
209
+ - The cross-cohort arms use the masked scoring (46 never-measured genes zeroed in every arm).
210
+ - The donor bootstrap reproduces the verified analysis in `out/scratch_vs_lora_20261005/REPORT.md`.
211
+ - **Section 10 "Next steps".**
212
+ - New "Next: other tissues from a few dozen pairs" (`tools/sec10_other_tissues.py`): a comparison table, pretrained
213
+ + LoRA vs from scratch.
214
+ - Every value is read from the deck's own source tables. The say text is the user's Discussion framing.
215
+ - **Slide 26 "Longer training on other cohorts".** The first keyword is now training minutes to saturation (RUN.json
216
+ wall seconds), with per-cohort minutes and steps in the notes (`tools/sec08_cross_cohort.py`).
217
+ - **Slide 34 "5 donors: time to apply".**
218
+ - The pretraining hours are read from `data/sec06_ft_method.csv`, no longer hard-coded.
219
+ - The note names the 'Fine-tuning with paired bulk + sc' slide by title. Its old "slide 15" pointed at the wrong
220
+ slide.
221
+ - Agenda items 7 and 10 updated. Spec change: `tools/restructure_20261006.py` (refuses to run twice). The deck has 45
222
+ slides; no Korean text.
223
+ - **Review pass (same day).** An independent 5-agent review of the changed slides confirmed 39 issues; all are
224
+ fixed. Pre-review copies of the touched scripts and the spec: `_archive/2026-10-06_before_supplementary/*.pre_review`.
225
+ - Slide 39: pretraining now reads 33.1 M train cells (`train_split_cells`; the 41.4 M corpus includes val/test).
226
+ The rare-state row follows the bootstrap verdicts on both sides (closer on ISG-high T / on DN2 B; labels and
227
+ states both arms miss by > 4-fold are not counted). "No corpus" became "come close": the scratch runs still took
228
+ the panel, value scaler and z-score constants from the PBMC checkpoint (RUN.json `kept_from_checkpoint`, now in
229
+ the notes). The say text carries the one-fold pilot qualifier; the footnote names both pilots.
230
+ - Slide 43: "no significant difference on average" (not "no difference"). Keyword 2 is the cycling T/NK count
231
+ (8 of 8 comparisons). The notes add the ISG-high T split by panel, the scratch-closer states (DN2 B, MS1), the
232
+ 52-call tally, the fold-0 caveat (fold 0 is the own-pair LoRA's best fold for C1Q-high and cycling T/NK,
233
+ computed from `folds.csv`), label states unthinned, and "8 of 13 states shown".
234
+ - Slide 26: title "...: gap stays" and "drifts in Sepsis and Ji" are computed from the milestones (gap = no milestone
235
+ reaches the own-cohort coverage; drift = full fine-tune L1 up by >= 0.05). Minutes are in
236
+ `data/sec08_cross_cohort.csv` (wall_seconds, minutes, run_receipt) and in the numbers list.
237
+ - Slide 42: UMI share (94 %, 91–94 % across milestones), the observed share (0.014 %, from `cells_panel6k.npz`)
238
+ and both arms' stopping settings are read from the receipts; the "none" label sits inside the axes.
239
+ - 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
240
+ notes. The right panel shares the bars' rows and has a title.
241
+ - Talk text and pointers: slides 23, 25, 26, 45 (say), 22 (recipes description), 32 and 36 (slide pointers by
242
+ title), slide 1 subtitle "updated 2026-10-06".
243
+ - 2026-10-08 update (user request: put the BayesPrism, CIBERSORTx and scSemiProfiler 5-fold results into the deck).
244
+ Pre-change copy: `_archive/2026-10-08_before_deconvolution/`.
245
+ - **Two new Supplementary slides** (`tools/secS_deconvolution.py`, `data/secS_deconvolution{.csv,_slide_text.json}`):
246
+ "Deconvolution with the same pairs: composition" and "...: disease signal".
247
+ - Source: `plans/bayesprism_paired_20261006/` (README, `results/RESULTS_full.md`, `RESULTS_cibersortx.md`).
248
+ - BayesPrism (recommended genes) and official CIBERSORTx (Fractions S-mode + HiRes) use the same paired donors
249
+ as the reference and the test samples' real bulk as the mixture, with the benchmark's own truth and scorer.
250
+ - Keywords and notes are computed from the tables.
251
+ - **Supplementary plan.** The planned "Bulk deconvolution methods" row is replaced by the two Ready slides.
252
+ `tools/figure_plan.py` now takes an optional per-slide note (`supplementary.notes`) and drops "Planned:" when
253
+ nothing is planned.
254
+ - **New scSemiProfiler results picked up (server_1):**
255
+ - Sepsis and Giroux 5-fold CV. Giroux was finalized on server_1 from sha-checked copies of its fold NPZs, and
256
+ rescored without sex-linked genes in `scores_nosex/giroux2022/scsemi_cv_20261002/pooled`.
257
+ - Sepsis equal-budget n = 5/10/20/40.
258
+ - Imperial 5-fold: finished on server_2 at 13:45 and was finalized on server_1 from sha-checked fold copies.
259
+ scSemiProfiler 5-fold now covers all five cohorts.
260
+ - Spearman/limma extras for sepsis, Giroux and Imperial; realism extras for all five cohorts.
261
+ - **Text changes from the new results:**
262
+ - "Same training pairs": keywords are data-driven. LoRA leads on coverage and precision in 5/5 cohorts;
263
+ composition 4/5 and logFC r 3/4, where scSemiProfiler leads in Giroux. The GPU-time ratio is 19–62×.
264
+ - sec09_same_pairs.py now reads the sepsis fold-0 pilot queue tag (`sep_f0`). For Giroux it quotes DEG from
265
+ scores_nosex, and for older pooled LoRA calls from pooled_deg.
266
+ - "5-fold CV" keyword: logFC r 3/4.
267
+ - "Pairs needed" (hand-written): scSemiProfiler coverage 0.04 / 0.10. On sepsis disease logFC r,
268
+ 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.
269
+ - 2026-10-08, new figure split (user decision; supersedes the 2026-10-06 split; pre-change copy
270
+ `_archive/2026-10-08_before_new_figure_plan/`).
271
+ - Fig. 2: LoRA fine-tuning with no disease metrics.
272
+ - Fig. 3: PBISC vs scSemiProfiler on healthy donors, with time as a main result.
273
+ - Fig. 4: disease benchmarks on the paired cohorts (PBISC versions, scSemiProfiler, and BayesPrism / CIBERSORTx
274
+ labelled as cell-type deconvolution; the deconvolution slides moved here from the Supplementary).
275
+ - Fig. 5: rare-cell fractions and detection.
276
+ - Fig. 6: new findings from the bulk-only sepsis and COVID samples (K = 1,000 and 4,000).
277
+ - The cross-cohort transfer slides moved to the Supplementary; their placement is open.
278
+ - New slide "Time: days for scSemiProfiler, minutes for LoRA" (`tools/fig3_time_days.py`, Fig. 3d).
279
+ - Inputs: GPU hours per 5-fold experiment from the receipts (`data/sec09_same_pairs.csv`, checked against
280
+ the scSemiProfiler event logs on both hosts), the 5-donor draws (`data/sec09_time_to_apply.csv`) and the
281
+ one-time pretraining (`data/sec06_ft_method.csv`).
282
+ - Results: ImMicro 24 h vs 1.2 h, sepsis 38 h vs 37 min. All runs: scSemiProfiler 184 h (7.7 days) vs PBISC
283
+ 22 h including pretraining.
284
+ - The equal-budget scSemiProfiler runs are excluded: they reuse the 5-fold run's representative models.
285
+ - Panel status: Build / Run marks new slides or analyses still to do; Adapt marks slides to re-scope (healthy-only
286
+ Fig. 2-3, disease columns into Fig. 4).
287
+ - 2026-10-08, comparison rules (user decision; memory feedback_paper_comparison_rules):
288
+ - **Time.** Only per-cohort GPU work counts: no PBISC pretraining, no GPU queue waits. The time slide now shows the
289
+ 5-donor draws (main) next to the 5-fold runs (separate). All runs: 7.7 GPU-days vs 5.7 h.
290
+ - **No bulk-broadcast baseline.** It is removed from the SLE benchmark, CAT, deconvolution and "Pairs needed"
291
+ figures.
292
+ - The "Bulk broadcast baseline" slide is gone. Its partial r panel is now on the SLE benchmark slide
293
+ (0.21 vs 0.17).
294
+ - Still to rebuild in their own phases: Fig. 2e (ImMicro only) and Fig. 6a.
295
+ - **Main comparison = 5 pairs** (LoRA-5 vs scSemiProfiler-5); 5-fold is reported separately. Partial r is
296
+ emphasised (bold panel titles).
297
+ - **New `tools/fig4_disease.py`**, which checks all 200 logFC r / DEG values against the section-9 tables:
298
+ - "Disease signal with 5 pairs: LoRA-5 vs others" (4b);
299
+ - "5-fold CV: disease signal" (4c);
300
+ - "Sepsis: fine-tuning variants" (details).
301
+ - The old "5 donors: LoRA vs scSemiProfiler — disease signal" slide is retired. `tools/sync_sec09_text.py` lists it
302
+ in RETIRED.
303
+ - The deconvolution slides are retitled "Cell-type deconvolution, same pairs: ...".
304
+ - 2026-10-08, healthy-only Figs 2-3 (`tools/fig23_healthy.py`).
305
+ - Eight ImMicro-only slides, re-plotted from the deck's own data tables; nothing is re-scored.
306
+ - Fig. 2 (no disease metrics):
307
+ - cells, realism, full / LoRA / condition encoder, pairs needed, rank and K;
308
+ - 5 donors (main) shown next to 5-fold (separate).
309
+ - Fig. 3 (vs scSemiProfiler):
310
+ - LoRA-5 vs scSemiProfiler-5 on 6 cell metrics: LoRA ahead on 6 of 6;
311
+ - the same pairs, 5 to all;
312
+ - scSemiProfiler copies its representative;
313
+ - time.
314
+ - The earlier all-cohort slides moved to the Supplementary (note "all five cohorts").
315
+ - "5-fold CV: train on the other 4 folds" is retired (it carried the broadcast; its content is now in Fig. 4c and
316
+ the healthy slides). It is listed in RETIRED of `tools/sync_sec09_text.py`.
317
+ - 2026-10-08, Fig. 5 rare cells (`tools/fig5_rare_states.py`).
318
+ - Source: new plan `plans/rare_states_paired_20261008` (README). It covers 4 paired disease cohorts, the 5-donor
319
+ draws and 5-fold, and the arms zero-shot, calibration, scSemiProfiler and LoRA. Each NPZ is sha-checked and the
320
+ benchmark's Poisson read-out and labels are reproduced cell by cell.
321
+ - Three slides:
322
+ - fraction (5a);
323
+ - donors and disease direction (5b);
324
+ - 5-fold, separate (5c).
325
+ - Results over 56 state × cohort pairs, 5 donors:
326
+ - LoRA-5 closer to the observed fraction than scSemiProfiler-5 in 51/56;
327
+ - within 2-fold: 19 vs 5;
328
+ - better donor ranking: 43/56;
329
+ - disease direction kept: 73% vs 61%.
330
+ - Fig. 6a no longer mentions the broadcast. No slide text mentions it now.
331
+ - 2026-10-10, last broadcast mention removed from a figure (found while rewriting the manuscript from this deck).
332
+ - Fig. 2d "How we score generated cells" (`tools/sec04_metrics_overview.py`) still listed "broadcast; split-half
333
+ ceiling" as the comparator of logFC r inside the table image. It now reads "zero-shot; partial r (vs bulk)".
334
+ - Old tool, CSV and figure: `_archive/2026-10-10_metrics_overview_broadcast/`. The deck was rebuilt (76 slides); a
335
+ text search of every slide, the notes and the PDF twin of every figure a slide uses finds no "broadcast". Three
336
+ figure files of retired slides still contain it and are not used: `sec04_sle_broadcast`, `sec09_fewpair_disease`,
337
+ `sec09_fivefold`.
338
+ - The manuscript was rewritten from this deck on 2026-10-10 (`paper-release-20260928/manuscript/`,
339
+ `editorial/rewrite_20261010.md`); its figures are copies of this folder's figure PDFs.
340
+ - 2026-10-10, LoRA rank figure key (`tools/sec07_rank_sweep.py`): "LoRA rank r = 16 (used in the deck)" now reads
341
+ "(used throughout)", because the same panel is Supplementary Fig. 12a of the manuscript. Old files:
342
+ `_archive/2026-10-10_rank_sweep_label/`. Deck rebuilt (76 slides).
paper-releases/pbisc-diffusion/updates/20261013T022035Z-pbisc-red-scsemi-blue/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/tools/build_results_review_20261013.py ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Build the reviewed 34-slide deck with the original 76-slide renderer/style.
2
+
3
+ CPU only. Existing figures are reused intact; new plots read small saved CSVs.
4
+ The original deck and its specification are never rewritten.
5
+ """
6
+ from pathlib import Path
7
+ from datetime import datetime, timezone, timedelta
8
+ import copy
9
+ import csv
10
+ import hashlib
11
+ import json
12
+ import os
13
+ import sys
14
+ import tempfile
15
+
16
+ if os.environ.get('CUDA_VISIBLE_DEVICES') != '':
17
+ raise SystemExit('Set CUDA_VISIBLE_DEVICES empty for this CPU-only builder')
18
+ D = Path(__file__).resolve().parents[1]
19
+ sys.path.insert(0, str(D))
20
+ import generate_deck as original
21
+ from pptx import Presentation
22
+ from pptx.util import Inches
23
+ from results_review_style_plots import build as build_plots
24
+ from results_review_style_panels import build as build_panels
25
+ from review_palette_pdf import recolor_pdf, render_pdf_to_png
26
+
27
+ DATA = D/'data'
28
+ ORIGINAL = json.loads((DATA/'slides_spec.json').read_text())['slides']
29
+ PREVIOUS = json.loads((DATA/'style_review_20261013/before_results_review_20261013_provenance.json').read_text())
30
+ STEM = D/'PBISC-Diffusion_results_review_20261013'
31
+ SOURCES = {}
32
+
33
+
34
+ def apply_method_palette(slides):
35
+ """Use figure-specific method roles; preserve biology and numerical geometry."""
36
+ policy_path=source(DATA/'method_palette_20261013/palette.json','user-approved method colour policy')
37
+ policy=json.loads(policy_path.read_text())
38
+ target=D/'figures/method_palette_20261013'
39
+ target.mkdir(exist_ok=True)
40
+ records=[]
41
+ converted={}
42
+ for slide_spec in slides:
43
+ originals=list(slide_spec.get('figures',[]))
44
+ if originals: slide_spec['figures_before_palette']=originals
45
+ replacements=[]
46
+ for original_asset in originals:
47
+ asset_path=D/original_asset
48
+ stem=asset_path.stem
49
+ rule=policy['rules'][stem] # unknown assets require an explicit semantic policy
50
+ if not rule['mapping'] and not rule.get('rectangle_rules'):
51
+ replacements.append(original_asset)
52
+ records.append({'asset':original_asset,'action':'preserved','reason':rule['reason']})
53
+ continue
54
+ if stem not in converted:
55
+ input_pdf=source(rule.get('source_pdf',asset_path.with_suffix('.pdf')),'original vector figure for method recolouring')
56
+ input_png=source(asset_path,'original figure image')
57
+ output_pdf=target/(stem+'.pdf'); output_png=target/(stem+'.png')
58
+ with tempfile.TemporaryDirectory(prefix='.build-',dir=target) as tmp:
59
+ candidate_pdf=Path(tmp)/(stem+'.pdf');candidate_png=Path(tmp)/(stem+'.png')
60
+ proof=recolor_pdf(input_pdf,candidate_pdf,rule['mapping'],
61
+ rectangle_rules=rule.get('rectangle_rules'),
62
+ rgb_tolerance=5.1e-7 if stem=='fig1b_overview_nature' else 1e-8)
63
+ render=render_pdf_to_png(candidate_pdf,candidate_png,dpi=300 if stem=='fig1b_overview_nature' else 200)
64
+ candidate_pdf.replace(output_pdf);candidate_png.replace(output_png)
65
+ proof['destination']=str(output_pdf)
66
+ render['pdf']=str(output_pdf);render['png']=str(output_png)
67
+ proof.update({'render':render,'original_png':str(input_png),'original_png_sha256':sha(input_png),
68
+ 'semantic_reason':rule['reason'],'policy_sha256':sha(policy_path)})
69
+ proof_path=target/(stem+'.palette.json')
70
+ proof_path.write_text(json.dumps(proof,indent=2)+'\n')
71
+ for path in (output_pdf,output_png,proof_path):source(path,'method palette variant or preservation proof')
72
+ converted[stem]=relative(output_png)
73
+ records.append({'asset':original_asset,'action':'recolored','output':relative(output_png),
74
+ 'proof':relative(proof_path),'reason':rule['reason'],
75
+ 'preservation_pass':proof['preservation_pass']})
76
+ replacements.append(converted[stem])
77
+ if originals:slide_spec['figures']=replacements
78
+ catalog={'schema':'pbisc.deck-method-palette.v1','primary':policy['primary'],
79
+ 'recolored_figures':len(converted),'records':records}
80
+ catalog_path=DATA/'method_palette_20261013/ASSET_MAP.json'
81
+ catalog_path.write_text(json.dumps(catalog,indent=2)+'\n')
82
+ source(catalog_path,'method palette coverage and per-figure proof locations')
83
+ return catalog
84
+
85
+
86
+ def sha(path):
87
+ with Path(path).open('rb') as f:
88
+ return hashlib.file_digest(f,'sha256').hexdigest()
89
+
90
+
91
+ def source(path, role):
92
+ path=Path(path).resolve()
93
+ if not path.is_file():
94
+ raise FileNotFoundError(path)
95
+ SOURCES[str(path)]={'sha256':sha(path),'role':role}
96
+ return path
97
+
98
+
99
+ def relative(path):
100
+ return str(Path(path).resolve().relative_to(D))
101
+
102
+
103
+ def from_original(number, title, section, protocol, keywords=None):
104
+ item=copy.deepcopy(ORIGINAL[number-1])
105
+ assert item['kind']=='content'
106
+ item.update(title=title,section_label=section,footnote=protocol,original_slide=number)
107
+ item['footnote_full']=protocol+'\nOriginal context: '+item.get('footnote_full',item.get('footnote',''))
108
+ if keywords is not None:
109
+ item['keywords']=keywords
110
+ # The original reference line remains visible when it fits. Full citations
111
+ # always stay in notes, unchanged from the original source specification.
112
+ if item.get('refs') and len(original.wrap(protocol,original.FOOT_PT,original.FOOT_W))>1:
113
+ item.pop('refs')
114
+ return item
115
+
116
+
117
+ def fresh(title,section,protocol,asset,keywords=()):
118
+ return {'kind':'content','title':title,'section_label':section,'layout':'full',
119
+ 'figures':[relative(Path(asset).with_suffix('.png'))],
120
+ 'keywords':list(keywords),'footnote':protocol,'footnote_full':protocol,
121
+ 'sources':str(asset)}
122
+
123
+
124
+ def main():
125
+ plots=build_plots()
126
+ panels=build_panels()
127
+ for row in plots['inputs']:
128
+ source(row['path'],row.get('role','saved plot data'))
129
+ for path in plots['assets']:
130
+ source(path,'restyled saved-table plot')
131
+ for value in panels.values():
132
+ for key in ('png','pdf','svg','provenance'):
133
+ if value.get(key):
134
+ source(value[key],'restyled panel '+key)
135
+ proof=json.loads(Path(value['provenance']).read_text())
136
+ # Preserve the complete panel-specific evidence even if its schema differs.
137
+ for field in ('inputs','sources'):
138
+ rows=proof.get(field,[])
139
+ if isinstance(rows,dict): rows=[{'path':p} for p in rows]
140
+ for row in rows:
141
+ p=row.get('path',row.get('source')) if isinstance(row,dict) else row
142
+ if p: source(p,'saved panel data')
143
+ comp,rareobs,rarecompare=plots['figures']
144
+ slides=[
145
+ {'kind':'title','title':'PBISC-Diffusion','subtitle':'Results review · existing evidence and protocol updates · 13 October 2026'},
146
+ {'kind':'agenda','title':'Six figures: evidence available now','items':[
147
+ 'Fig. 1 Pretraining, diffusion and bulk conditioning',
148
+ 'Fig. 2 Model design and paired-data requirements',
149
+ 'Fig. 3 Healthy reconstruction: quality, composition and time',
150
+ 'Fig. 4 Disease signals and deconvolution benchmarks',
151
+ 'Fig. 5 Rare cell states: corrected analysis of existing outputs',
152
+ 'Fig. 6 Bulk-only reproduction: awaiting the new dataset']},
153
+ ]
154
+ slides += [
155
+ from_original(7,'PBISC-Diffusion: pretraining to generated cells','Fig. 1a',
156
+ 'Schematic. Conditioning recipe size and the number of generated cells are distinct; no cell-type quotas.',
157
+ []),
158
+ from_original(8,'Bulk conditioning','Fig. 1b',
159
+ 'Final 6k model. Recipe size K conditions the bulk; the number of generated cells is chosen separately.',
160
+ ['One shared bulk condition; independent cell draws', 'Expression, depth and measured-gene masks', 'No cell-type or disease labels as model input']),
161
+ from_original(9,'Pretraining corpus','Fig. 1c',
162
+ 'Corpus labels describe the data; they are not model inputs. Dataset composition is not sampler exposure.'),
163
+ fresh('Native-pseudobulk model comparisons','Fig. 2a',
164
+ 'Completed held-out rescoring. Architecture: 1% detection floor; gene-panel comparison: 0.1% floor.',panels['ablation']['pdf']),
165
+ from_original(12,'Gene panels: performance and coverage','Fig. 2b',
166
+ 'Existing panel benchmark. 6k: five sampling seeds; other panels: one seed. Different axis from the architecture sweep.'),
167
+ fresh('Healthy bulk: full fine-tuning and LoRA rank','Fig. 2c',
168
+ 'Original donor-level five-fold comparison. LoRA rank 16 is a quality/parameter compromise.',panels['rank']['pdf']),
169
+ ]
170
+ # Preserve the audited scope of every retained result. Figure assets and
171
+ # takeaways are reused from the original 76-slide deck, without cropping.
172
+ mapping=[
173
+ (31,'Historical paired-data learning curve','Fig. 2d'),
174
+ (26,'Additional pairs improve donor-level information','Fig. 2e'),
175
+ (17,'Measured bulk differs from pseudobulk','Fig. 3a'),
176
+ (30,'Healthy donors: exactly five paired samples','Fig. 3b'),
177
+ ]
178
+ for position,(old,title,label) in enumerate(mapping,start=8):
179
+ assert PREVIOUS['slides'][position]['old_deck_slide']==old
180
+ p=PREVIOUS['slides'][position]['protocol']
181
+ if old==31:
182
+ p='LoRA: n training + 7 validation. scSemi: n + 7 representatives, with CV-HVG reuse. Not the strict total-n protocol.'
183
+ slides.append(from_original(old,title,label,p))
184
+ slides.append(fresh('Composition: error and donor-level wins','Fig. 3c',
185
+ 'Exactly five pairs per draw. Absolute errors averaged within each held-out donor; 107 donors, equal weight. Descriptive.',comp))
186
+ mapping=[
187
+ (32,'Representative-dependent composition','Fig. 3d'),
188
+ (34,'Adaptation and generation time','Fig. 3e'),
189
+ (37,'Paired cohorts and evaluation units','Fig. 4a'),
190
+ (38,'Disease signals: five-donor draws','Fig. 4b'),
191
+ (39,'Disease signals: five-fold validation','Fig. 4c'),
192
+ (40,'Disease-gene agreement across list lengths','Fig. 4d'),
193
+ (41,'Cell-type expression: deconvolution comparison','Fig. 4e'),
194
+ (46,'Composition: deconvolution comparison','Fig. 4f'),
195
+ ]
196
+ for position,(old,title,label) in enumerate(mapping,start=13):
197
+ assert PREVIOUS['slides'][position]['old_deck_slide']==old
198
+ p=PREVIOUS['slides'][position]['protocol']
199
+ kws=None
200
+ if old==32:
201
+ kws=['Composition varies with the selected representative',
202
+ 'Compare generated fractions with held-out observed fractions']
203
+ elif old==37:
204
+ kws=['403 paired samples, 275 donors',
205
+ 'Identity screening where available; donor-level splits',
206
+ 'Ji bulk: whole blood, not PBMC']
207
+ elif old==46:
208
+ kws=['PBISC closer than BayesPrism in 22/25 draws, than CIBERSORTx in 24/25',
209
+ 'Composition compared with held-out observed cells',
210
+ 'Five-fold: PBISC lowest error in 4 of 5 cohorts']
211
+ slides.append(from_original(old,title,label,p,kws))
212
+ slides += [
213
+ fresh('Rare-state frequencies in observed cells','Fig. 5a',
214
+ 'Original five-donor outputs. Median across draws; state share within its parent population. Controls included.',rareobs),
215
+ fresh('Rare-state fidelity: zero-aware reanalysis','Fig. 5b',
216
+ 'Original five-donor outputs; zero draws retained and actual donor IDs. 59 state/cohort combinations, including controls.',rarecompare),
217
+ fresh('Behcet: one-gene and multi-gene C1Q rules','Fig. 5c',
218
+ 'Descriptive: unmatched reference includes training donors. Same three pairs; two identity-pass and one uncertain.',panels['behcet']['pdf']),
219
+ {'kind':'status','title':'Remaining work','section_label':'Figure status',
220
+ 'rows':[
221
+ ['Protocol updates','Total n = 5/10/20/40 without extra validation; exact-five samples in multi-visit cohorts.'],
222
+ ['Analysis of existing outputs','Patient-aware contrasts, rare-state scoring and healthy cell visualizations.'],
223
+ ['Figure 6: new data','Reproduce a published finding in the user-prepared bulk-only cohort.']],
224
+ 'footnote':'Existing results remain visible. Protocol updates and missing-data work are identified separately.'},
225
+ ]
226
+ mapping=[
227
+ (19,'Control-cell embedding diagnostic'),
228
+ (58,'Generated-cell quality across cohorts'),
229
+ (60,'Precision and coverage across neighbourhood sizes'),
230
+ (62,'Same training pairs: five-fold comparison'),
231
+ (68,'Cross-cohort pairs do not replace local pairs'),
232
+ (69,'Longer cross-cohort training leaves a gap'),
233
+ (70,'From-scratch control: evidence and limits'),
234
+ (74,'scSemiProfiler readout sensitivity'),
235
+ (42,'SLE pseudobulk development benchmark'),
236
+ ]
237
+ for position,(old,title) in enumerate(mapping,start=25):
238
+ assert PREVIOUS['slides'][position]['old_deck_slide']==old
239
+ p=PREVIOUS['slides'][position]['protocol']
240
+ slides.append(from_original(old,title,'Supporting',p))
241
+ assert len(slides)==34
242
+ palette=apply_method_palette(slides)
243
+ prs=Presentation();prs.slide_width=Inches(original.SLIDE_W);prs.slide_height=Inches(original.SLIDE_H)
244
+ for i,s in enumerate(slides,start=1):
245
+ kind=s['kind']
246
+ if kind=='title': original.build_title(prs,s)
247
+ elif kind=='agenda': original.build_agenda(prs,s,i)
248
+ elif kind=='status':
249
+ slide=prs.slides.add_slide(prs.slide_layouts[6]);original.white_bg(slide)
250
+ original.add_title(slide,s['title'],s['section_label'])
251
+ for row,(title,body) in enumerate(s['rows']):
252
+ y=1.35+row*1.55
253
+ original.add_text(slide,original.X0,y,11.6,.4,[title],20,bold=True)
254
+ original.add_text(slide,original.X0,y+.5,11.6,.8,[body],16,color=original.GREY)
255
+ original.add_footer(slide,s['footnote'],i)
256
+ else:
257
+ original.build_content(prs,s,i)
258
+ for f in s.get('figures',[]):
259
+ source(D/f,'figure reused intact' if s.get('original_slide') else 'restyled figure')
260
+ vector=(D/f).with_suffix('.pdf')
261
+ if vector.is_file(): source(vector,'figure vector companion')
262
+ for sh in prs.slides[-1].shapes:
263
+ assert sh.left>=0 and sh.top>=0 and sh.left+sh.width<=prs.slide_width+2 and sh.top+sh.height<=prs.slide_height+2,(i,sh.name)
264
+ prs.save(STEM.with_suffix('.pptx'))
265
+ for p in [D/'generate_deck.py',D/'tools/style.py',DATA/'slides_spec.json',
266
+ Path(__file__),D/'tools/results_review_style_plots.py',D/'tools/results_review_style_panels.py',
267
+ DATA/'style_review_20261013/before_results_review_20261013_provenance.json',
268
+ D/'tools/review_palette_pdf.py']:
269
+ source(p,'renderer, style or audited content source')
270
+ spec={'deck':{'output_pptx':STEM.name+'.pptx','style_source':'generate_deck.py + tools/style.py'},'slides':slides}
271
+ (DATA/'results_review_20261013_spec.json').write_text(json.dumps(spec,indent=2)+'\n')
272
+ manifest={'schema':'pbisc.results-review.reuse.v2','style_revision':4,
273
+ 'as_of_kst':datetime.now(timezone(timedelta(hours=9))).isoformat(),
274
+ 'slides':slides,'sources':SOURCES,'new_training':False,'new_generation':False,
275
+ 'cpu_work':'Saved CSV plots; healthy composition now compares paired absolute errors and donor wins. No new model outputs.',
276
+ 'plot_calculations':plots.get('calculations'), 'panel_outputs':panels,
277
+ 'method_palette':palette,
278
+ 'pptx_sha256':sha(STEM.with_suffix('.pptx')),'pdf_status':'awaiting PPTX export and visual verification'}
279
+ (DATA/'results_review_20261013_provenance.json').write_text(json.dumps(manifest,indent=2)+'\n')
280
+ with (DATA/'results_review_20261013_slide_map.csv').open('w') as f:
281
+ w=csv.DictWriter(f,fieldnames=['slide','section','title','protocol','old_deck_slide']);w.writeheader()
282
+ for i,s in enumerate(slides,1):w.writerow({'slide':i,'section':s.get('section_label',''),
283
+ 'title':s['title'],'protocol':s.get('footnote',''),'old_deck_slide':s.get('original_slide','')})
284
+ print(json.dumps({'slides':len(slides),'sources':len(SOURCES),'pptx':str(STEM.with_suffix('.pptx'))}))
285
+
286
+
287
+ if __name__=='__main__':main()