Archive 4 checkpoints (1-4)
Browse files- paper-releases/pbisc-diffusion/updates/20261013T034842Z-expanded-131-slide-master/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/figures/expanded_master_20261013/palette/secS_scratch_rare_states.palette.json +88 -0
- paper-releases/pbisc-diffusion/updates/20261013T034842Z-expanded-131-slide-master/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/figures/expanded_master_20261013/palette/secS_scratch_rare_states.pdf +0 -0
- paper-releases/pbisc-diffusion/updates/20261013T034842Z-expanded-131-slide-master/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/figures/expanded_master_20261013/palette/secS_scratch_rare_states.png +3 -0
- paper-releases/pbisc-diffusion/updates/20261013T034842Z-expanded-131-slide-master/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/tools/build_expanded_master_20261013.py +270 -0
paper-releases/pbisc-diffusion/updates/20261013T034842Z-expanded-131-slide-master/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/figures/expanded_master_20261013/palette/secS_scratch_rare_states.palette.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema": "pbisc.vector-method-palette.v1",
|
| 3 |
+
"source": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/secS_scratch_rare_states.pdf",
|
| 4 |
+
"source_sha256": "69c1c1c9783bc1b1e7f3b874a2832e5a77ac67168bb8bc623271b305bd50bb4d",
|
| 5 |
+
"destination": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/expanded_master_20261013/palette/secS_scratch_rare_states.pdf",
|
| 6 |
+
"destination_sha256": "34f15bd49fac9d65fdda1454c5ffc6f5defb4d8e46918697358254b90cdcb9fc",
|
| 7 |
+
"mapping": {
|
| 8 |
+
"#D55E00": "#C5AA4B",
|
| 9 |
+
"#882255": "#806A25",
|
| 10 |
+
"#0072B2": "#B59A50",
|
| 11 |
+
"#44AA99": "#D4BE75",
|
| 12 |
+
"#332288": "#665522"
|
| 13 |
+
},
|
| 14 |
+
"rgb_absolute_tolerance": 1e-08,
|
| 15 |
+
"streams_inspected": 1,
|
| 16 |
+
"modified_streams": 1,
|
| 17 |
+
"stream_checks": [
|
| 18 |
+
{
|
| 19 |
+
"stream": "page0/Contents0",
|
| 20 |
+
"noncolor_operator_sha256_before": "ee9ed80e548368d0f09ec0046c3a352f337ee49c6b59ffaa33586bb0a6fd2f37",
|
| 21 |
+
"noncolor_operator_sha256_after": "ee9ed80e548368d0f09ec0046c3a352f337ee49c6b59ffaa33586bb0a6fd2f37",
|
| 22 |
+
"colour_operators_changed": 158
|
| 23 |
+
}
|
| 24 |
+
],
|
| 25 |
+
"colour_counts": [
|
| 26 |
+
{
|
| 27 |
+
"old": "#0072B2",
|
| 28 |
+
"new": "#B59A50",
|
| 29 |
+
"operator": "rg",
|
| 30 |
+
"count": 18
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"old": "#332288",
|
| 34 |
+
"new": "#665522",
|
| 35 |
+
"operator": "rg",
|
| 36 |
+
"count": 18
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"old": "#44AA99",
|
| 40 |
+
"new": "#D4BE75",
|
| 41 |
+
"operator": "rg",
|
| 42 |
+
"count": 18
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"old": "#882255",
|
| 46 |
+
"new": "#806A25",
|
| 47 |
+
"operator": "rg",
|
| 48 |
+
"count": 52
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"old": "#D55E00",
|
| 52 |
+
"new": "#C5AA4B",
|
| 53 |
+
"operator": "rg",
|
| 54 |
+
"count": 52
|
| 55 |
+
}
|
| 56 |
+
],
|
| 57 |
+
"image_payload_count": 0,
|
| 58 |
+
"image_payloads": [],
|
| 59 |
+
"rectangle_rules_matched": 0,
|
| 60 |
+
"rectangle_checks": [],
|
| 61 |
+
"scope_insertions": "Only balanced q/RGB/RGB/paint/Q wrappers; original non-colour operators preserved",
|
| 62 |
+
"preservation": {
|
| 63 |
+
"noncolor_operators": true,
|
| 64 |
+
"text_geometry": true,
|
| 65 |
+
"page_rectangles": true,
|
| 66 |
+
"image_payloads": true,
|
| 67 |
+
"source_unchanged": true
|
| 68 |
+
},
|
| 69 |
+
"preservation_pass": true,
|
| 70 |
+
"render": {
|
| 71 |
+
"pdf": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/expanded_master_20261013/palette/secS_scratch_rare_states.pdf",
|
| 72 |
+
"png": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/expanded_master_20261013/palette/secS_scratch_rare_states.png",
|
| 73 |
+
"dpi": 200,
|
| 74 |
+
"page_rect": [
|
| 75 |
+
0.0,
|
| 76 |
+
0.0,
|
| 77 |
+
801.5868530273438,
|
| 78 |
+
364.0645751953125
|
| 79 |
+
],
|
| 80 |
+
"width": 2227,
|
| 81 |
+
"height": 1012,
|
| 82 |
+
"png_sha256": "221eefd848c035982a9786596818086cc69ece55dd2cd8e54ac9a1f869d77904",
|
| 83 |
+
"rendering": "native PDF rendering; no raster recolouring"
|
| 84 |
+
},
|
| 85 |
+
"semantic_reason": "PBISC pretrained/scratch and cross-cohort adaptations use distinct gold shades; markers and acceptable-error grey band retained.",
|
| 86 |
+
"original_png": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/secS_scratch_rare_states.png",
|
| 87 |
+
"original_png_sha256": "af53b558820bb87fe64d7a5ebc96d7477479370efce817c08908cbb278bd5ad2"
|
| 88 |
+
}
|
paper-releases/pbisc-diffusion/updates/20261013T034842Z-expanded-131-slide-master/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/figures/expanded_master_20261013/palette/secS_scratch_rare_states.pdf
ADDED
|
Binary file (31.3 kB). View file
|
|
|
paper-releases/pbisc-diffusion/updates/20261013T034842Z-expanded-131-slide-master/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/figures/expanded_master_20261013/palette/secS_scratch_rare_states.png
ADDED
|
Git LFS Details
|
paper-releases/pbisc-diffusion/updates/20261013T034842Z-expanded-131-slide-master/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/tools/build_expanded_master_20261013.py
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Expand all 76 original PBISC slides with existing, source-bound evidence.
|
| 2 |
+
|
| 3 |
+
No experiment launches. Saved-table plotting runs on CPU. Original deck files
|
| 4 |
+
and original source figures are preserved; additions and colour variants have
|
| 5 |
+
separate destinations and a complete coverage map.
|
| 6 |
+
"""
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
from datetime import datetime, timezone, timedelta
|
| 9 |
+
import copy,csv,hashlib,json,os,sys,tempfile
|
| 10 |
+
if os.environ.get('CUDA_VISIBLE_DEVICES')!='':
|
| 11 |
+
raise SystemExit('Set CUDA_VISIBLE_DEVICES empty for CPU-only deck production')
|
| 12 |
+
D=Path(__file__).resolve().parents[1];A=D/'data/expanded_master_20261013'
|
| 13 |
+
sys.path.insert(0,str(D))
|
| 14 |
+
import generate_deck as G
|
| 15 |
+
from pptx import Presentation
|
| 16 |
+
from pptx.util import Inches
|
| 17 |
+
from review_palette_pdf import recolor_pdf,render_pdf_to_png
|
| 18 |
+
from expanded_legacy_rare import build as build_legacy_rare
|
| 19 |
+
|
| 20 |
+
OUT='PBISC-Diffusion_expanded_master_20261013'
|
| 21 |
+
SOURCES={};PALETTE_RECORDS=[];CACHE={}
|
| 22 |
+
|
| 23 |
+
def sha(path):
|
| 24 |
+
with Path(path).open('rb') as stream:return hashlib.file_digest(stream,'sha256').hexdigest()
|
| 25 |
+
|
| 26 |
+
def source(path,role):
|
| 27 |
+
p=Path(path).resolve()
|
| 28 |
+
if not p.is_file():raise FileNotFoundError(p)
|
| 29 |
+
SOURCES[str(p)]={'sha256':sha(p),'role':role}
|
| 30 |
+
return p
|
| 31 |
+
|
| 32 |
+
def rel(path):
|
| 33 |
+
p=Path(path).resolve()
|
| 34 |
+
try:return str(p.relative_to(D))
|
| 35 |
+
except ValueError:return str(p)
|
| 36 |
+
|
| 37 |
+
def reuse_or_build(name,builder):
|
| 38 |
+
"""Avoid replotting unchanged saved evidence during slide-layout fixes."""
|
| 39 |
+
cache=A/'build_cache';cache.mkdir(exist_ok=True)
|
| 40 |
+
file=cache/(name+'.json');module=Path(builder.__code__.co_filename).resolve()
|
| 41 |
+
if file.is_file():
|
| 42 |
+
saved=json.loads(file.read_text())
|
| 43 |
+
if saved.get('module_sha256')==sha(module) and all(Path(p).is_file() and sha(p)==h for p,h in saved.get('bindings',{}).items()):
|
| 44 |
+
print('reuse verified saved plots:',name)
|
| 45 |
+
return saved['result']
|
| 46 |
+
result=builder();bindings={}
|
| 47 |
+
for row in result.get('sources',[]):
|
| 48 |
+
p=Path(row['path'] if isinstance(row,dict) else row).resolve();h=sha(p)
|
| 49 |
+
if isinstance(row,dict) and row.get('sha256'):assert h==row['sha256'],p
|
| 50 |
+
bindings[str(p)]=h
|
| 51 |
+
for p in result.get('assets',[]):bindings[str(Path(p).resolve())]=sha(p)
|
| 52 |
+
file.write_text(json.dumps({'module_sha256':sha(module),'bindings':bindings,'result':result},indent=2)+'\n')
|
| 53 |
+
return result
|
| 54 |
+
|
| 55 |
+
def ledger(slide):
|
| 56 |
+
if 'original_slide' in slide:return 'original:'+str(slide['original_slide'])
|
| 57 |
+
return slide['addition_key']
|
| 58 |
+
|
| 59 |
+
def note(title,section,rows,after,key,foot):
|
| 60 |
+
return {'kind':'evidence_note','title':title,'section_label':section,'rows':rows,
|
| 61 |
+
'after_original':after,'addition_key':key,'footnote':foot,'footnote_full':foot}
|
| 62 |
+
|
| 63 |
+
def normalize_footnote(s):
|
| 64 |
+
# Retain complete sources/citations in speaker notes while keeping the slide readable.
|
| 65 |
+
if 'footnote' not in s:s['footnote']=s.get('footnote_short','')
|
| 66 |
+
if s.get('refs') and len(G.wrap(s['footnote'],G.FOOT_PT,G.FOOT_W))>1:s.pop('refs')
|
| 67 |
+
if len(G.wrap(s.get('footnote',''),G.FOOT_PT,G.FOOT_W))>2:
|
| 68 |
+
raise ValueError('Shorten slide footnote: '+s['title'])
|
| 69 |
+
|
| 70 |
+
def original_slide(number,item,review_by_old):
|
| 71 |
+
s=copy.deepcopy(item);s['original_slide']=number
|
| 72 |
+
s['original_title']=item['title'];s['original_footnote']=item.get('footnote','')
|
| 73 |
+
if s['kind']=='title':
|
| 74 |
+
s['title']='PBISC-Diffusion: expanded evidence deck'
|
| 75 |
+
s['subtitle']='Original 76-slide coverage + existing analyses · 13 October 2026'
|
| 76 |
+
elif s['kind']=='agenda':
|
| 77 |
+
s['title']='Full evidence map'
|
| 78 |
+
elif s['kind']=='content':
|
| 79 |
+
s['footnote_full']='Original slide '+str(number)+': '+item.get('footnote_full',item.get('footnote',''))
|
| 80 |
+
if number in review_by_old:
|
| 81 |
+
update=review_by_old[number]
|
| 82 |
+
s['footnote']=update.get('footnote',s.get('footnote',''))
|
| 83 |
+
s['footnote_full']='Current scope: '+s['footnote']+'\n\n'+s['footnote_full']
|
| 84 |
+
if number in [3,5,16,29,36,48,54,57]:
|
| 85 |
+
s['section_label']='Original roadmap'
|
| 86 |
+
s['footnote']='Original 8 October planning snapshot, retained for context. Current evidence and incomplete work are distinguished in this expanded deck.'
|
| 87 |
+
s['footnote_full']=s['footnote']+'\n\n'+s['footnote_full']
|
| 88 |
+
if number==31:
|
| 89 |
+
s['title']='Healthy paired-data learning curves'
|
| 90 |
+
s['footnote']='LoRA: n training + 7 validation. scSemi: n + 7 representatives, with CV-HVG reuse. Not the strict total-n protocol.'
|
| 91 |
+
if number==37:
|
| 92 |
+
s['keywords']=['403 paired samples, 275 donors','Identity screening where available; donor-level splits','Ji bulk: whole blood, not PBMC']
|
| 93 |
+
if number in (32,63):
|
| 94 |
+
s['title']='Representative-dependent composition' if number==32 else 'scSemiProfiler and the representative-copy baseline'
|
| 95 |
+
if number==46:
|
| 96 |
+
s['keywords']=['PBISC closer than BayesPrism in 22/25 draws, than CIBERSORTx in 24/25',
|
| 97 |
+
'Composition compared with held-out observed cells',
|
| 98 |
+
'Five-fold: PBISC lowest error in 4 of 5 cohorts']
|
| 99 |
+
if number==38:
|
| 100 |
+
s['title']='Disease signals with five training donors'
|
| 101 |
+
if number in [49,50,51]:
|
| 102 |
+
s['title']={49:'Rare-state fractions: original analysis',50:'Rare-state ranking: original analysis',51:'Rare states: original five-fold analysis'}[number]
|
| 103 |
+
s['section_label']='Historical scorer'
|
| 104 |
+
s['footnote']='Historical scoring: zero-draw and sample-unit limitations apply. Corrected five-donor analyses follow; five-fold correction is separate.'
|
| 105 |
+
s['keywords']=['Original output retained for traceability','Use the corrected donor-level analysis for updated conclusions']
|
| 106 |
+
s['footnote_full']=s['footnote']+'\n\n'+s['footnote_full']
|
| 107 |
+
if number==52:
|
| 108 |
+
s['footnote']='Historical Behcet diagnostic; reference is unmatched and includes training donors. This is not independent patient-level subtype validation.'
|
| 109 |
+
if number==55:
|
| 110 |
+
s['title']='Bulk-only cohort plan: original snapshot'
|
| 111 |
+
s['section_label']='Historical plan'
|
| 112 |
+
s['keywords']=['Original cohort/sample inventory','Later exploratory outputs follow','New-data reproduction is a separate step']
|
| 113 |
+
s['footnote']='Historical cohort counts. Existing exploratory outputs are reviewed separately; reproduction with the user-prepared new dataset remains pending.'
|
| 114 |
+
s['say']='Historical planned cohort map. Later exploratory outputs exist; this slide does not claim new-data reproduction is complete.'
|
| 115 |
+
normalize_footnote(s)
|
| 116 |
+
return s
|
| 117 |
+
|
| 118 |
+
def method_palette(s,policy):
|
| 119 |
+
old=list(s.get('figures',[]))
|
| 120 |
+
if not old:return
|
| 121 |
+
s['figures_before_palette']=old
|
| 122 |
+
out=[]
|
| 123 |
+
for item in old:
|
| 124 |
+
p=source(D/item,'original or added figure image')
|
| 125 |
+
stem=p.stem
|
| 126 |
+
if stem not in policy['rules']:
|
| 127 |
+
mode=s.get('palette','')
|
| 128 |
+
if isinstance(mode,dict):mode=mode.get('mode','')
|
| 129 |
+
mode={'native-gold-blue':'native','biological/preserved':'biological'}.get(mode,mode)
|
| 130 |
+
if mode not in ('native','preserved','biological'):
|
| 131 |
+
raise ValueError('Missing semantic palette for '+str(p)+' in '+s['title'])
|
| 132 |
+
out.append(rel(p));PALETTE_RECORDS.append({'slide_key':ledger(s),'asset':str(p),'action':mode,'reason':s.get('palette_reason','New native plot or non-method colour encoding.')})
|
| 133 |
+
continue
|
| 134 |
+
rule=policy['rules'][stem]
|
| 135 |
+
original_p=p
|
| 136 |
+
if rule.get('precolored_source_png'):
|
| 137 |
+
p=source(rule['precolored_source_png'],'mixed-cohort/method figure rendered from unchanged saved values')
|
| 138 |
+
if rule.get('precolored_proof'):source(rule['precolored_proof'],'legacy rare-state numerical identity proof')
|
| 139 |
+
mapping=rule.get('mapping',{})
|
| 140 |
+
if not mapping and not rule.get('rectangle_rules'):
|
| 141 |
+
out.append(rel(p));PALETTE_RECORDS.append({'slide_key':ledger(s),'asset':str(original_p),'output':str(p),'action':'preserved' if p==original_p else 'precolored','reason':rule['reason']})
|
| 142 |
+
continue
|
| 143 |
+
cachekey=(str(p),stem)
|
| 144 |
+
if cachekey not in CACHE:
|
| 145 |
+
inp=source(rule.get('source_pdf',p.with_suffix('.pdf')),'vector source for method palette')
|
| 146 |
+
target=D/'figures/expanded_master_20261013/palette';target.mkdir(parents=True,exist_ok=True)
|
| 147 |
+
final_pdf=target/(stem+'.pdf');final_png=target/(stem+'.png')
|
| 148 |
+
with tempfile.TemporaryDirectory(prefix='.build-',dir=target) as temp:
|
| 149 |
+
pdf=Path(temp)/(stem+'.pdf');png=Path(temp)/(stem+'.png')
|
| 150 |
+
proof=recolor_pdf(inp,pdf,mapping,rectangle_rules=rule.get('rectangle_rules'),rgb_tolerance=rule.get('rgb_tolerance',5.1e-7 if stem=='fig1b_overview_nature' else 1e-8))
|
| 151 |
+
render=render_pdf_to_png(pdf,png,dpi=300 if stem=='fig1b_overview_nature' else 200)
|
| 152 |
+
pdf.replace(final_pdf);png.replace(final_png)
|
| 153 |
+
proof['destination']=str(final_pdf);render['pdf']=str(final_pdf);render['png']=str(final_png)
|
| 154 |
+
proof.update({'render':render,'semantic_reason':rule['reason'],'original_png':str(original_p),'original_png_sha256':sha(original_p)})
|
| 155 |
+
receipt=target/(stem+'.palette.json');receipt.write_text(json.dumps(proof,indent=2)+'\n')
|
| 156 |
+
for f in (final_pdf,final_png,receipt):source(f,'expanded-master colour variant or preservation proof')
|
| 157 |
+
CACHE[cachekey]=(final_png,receipt)
|
| 158 |
+
png,receipt=CACHE[cachekey]
|
| 159 |
+
out.append(rel(png));PALETTE_RECORDS.append({'slide_key':ledger(s),'asset':str(original_p),'output':str(png),'proof':str(receipt),'action':'recolored','preservation_pass':True})
|
| 160 |
+
s['figures']=out
|
| 161 |
+
|
| 162 |
+
def draw_note(prs,s,number):
|
| 163 |
+
slide=prs.slides.add_slide(prs.slide_layouts[6]);G.white_bg(slide);G.add_title(slide,s['title'],s.get('section_label'))
|
| 164 |
+
rows=s['rows'];step=4.95/max(len(rows),1)
|
| 165 |
+
for i,(head,body) in enumerate(rows):
|
| 166 |
+
y=1.2+i*step
|
| 167 |
+
G.add_text(slide,G.X0,y,11.8,.38,[head],18,bold=True)
|
| 168 |
+
lines=G.wrap(body,15,11.8)
|
| 169 |
+
assert len(lines)<=3,(s['title'],head)
|
| 170 |
+
G.add_text(slide,G.X0,y+.43,11.8,min(step-.48,.9),[body],15,color=G.GREY)
|
| 171 |
+
G.add_footer(slide,s.get('footnote'),number);G.add_notes(slide,s)
|
| 172 |
+
|
| 173 |
+
def main():
|
| 174 |
+
from expanded_healthy_materials import build as build_healthy
|
| 175 |
+
from expanded_disease_materials import build as build_disease
|
| 176 |
+
A.mkdir(exist_ok=True)
|
| 177 |
+
master_path=source(D/'data/slides_spec.json','original 76-slide structure and provenance')
|
| 178 |
+
original=json.loads(master_path.read_text())['slides'];assert len(original)==76
|
| 179 |
+
review=json.loads(source(D/'data/results_review_20261013_spec.json','audited subset for six additional views and protocol corrections').read_text())['slides']
|
| 180 |
+
review_by_old={x['original_slide']:x for x in review if x.get('original_slide')}
|
| 181 |
+
policy=json.loads(source(A/'palette.json','semantic gold/blue policy for complete original deck').read_text())
|
| 182 |
+
legacy=build_legacy_rare()
|
| 183 |
+
for row in legacy.get('inputs',[]):
|
| 184 |
+
if isinstance(row,dict):source(row['path'],row.get('role','legacy rare source'))
|
| 185 |
+
else:source(row,'legacy rare source')
|
| 186 |
+
if legacy.get('proof'):source(legacy['proof'],'legacy rare numeric preservation proof')
|
| 187 |
+
additions=[];modules=[]
|
| 188 |
+
for name,builder in [('healthy',build_healthy),('disease',build_disease)]:
|
| 189 |
+
result=reuse_or_build(name,builder);modules.append({'name':name,'result':result})
|
| 190 |
+
for row in result.get('sources',[]):
|
| 191 |
+
p=row['path'] if isinstance(row,dict) else row
|
| 192 |
+
source(p,row.get('role','additional evidence source') if isinstance(row,dict) else 'additional evidence source')
|
| 193 |
+
if isinstance(row,dict) and row.get('sha256'):assert SOURCES[str(Path(p).resolve())]['sha256']==row['sha256'],p
|
| 194 |
+
for p in result.get('assets',[]):source(p,'new source-bound analysis figure or table')
|
| 195 |
+
for j,item in enumerate(result['slides']):
|
| 196 |
+
s=copy.deepcopy(item);s['addition_key']=s.get('addition_key',s.get('key',name+':'+str(j+1)))
|
| 197 |
+
s.setdefault('kind','content');s.setdefault('keywords',[])
|
| 198 |
+
s.setdefault('section_label','Additional evidence');s.setdefault('after_original',76)
|
| 199 |
+
s.setdefault('footnote_full',s.get('footnote',''))
|
| 200 |
+
s['footnote_full']+='\nEvidence source: '+str(s.get('sources',''))
|
| 201 |
+
normalize_footnote(s);additions.append(s)
|
| 202 |
+
for i,after in [(6,12),(8,27),(13,30),(22,49),(23,50),(24,52)]:
|
| 203 |
+
s=copy.deepcopy(review[i-1]);s.pop('original_slide',None)
|
| 204 |
+
s['figures']=s.get('figures_before_palette',s.get('figures',[]))
|
| 205 |
+
s.pop('figures_before_palette',None)
|
| 206 |
+
s['addition_key']='review:'+str(i);s['after_original']=after
|
| 207 |
+
s['footnote_full']='Additional view from the audited results review. '+s.get('footnote_full',s.get('footnote',''))
|
| 208 |
+
normalize_footnote(s);additions.append(s)
|
| 209 |
+
additions += [
|
| 210 |
+
note('How to read this expanded evidence deck','Evidence scope',[
|
| 211 |
+
('Complete original coverage','All 76 original slides are retained in order, with protocol labels corrected where needed.'),
|
| 212 |
+
('Additional existing evidence','New views use completed figures, stored coordinates or saved score tables; no new training or cell generation.'),
|
| 213 |
+
('Scope stays visible','Historical diagnostics, completed strict subsets, exploratory bulk-only analyses and pending reproduction are labelled separately.')],2,'guide:scope','Original figures retain their data and evidence lineage; sources and limitations are in the speaker notes.'),
|
| 214 |
+
note('Availability is not the same as a new experiment','Evidence map',[
|
| 215 |
+
('Available now','Pretraining/architecture, LoRA and rank controls, paired benchmarks, external diagnostics and rare-state analyses.'),
|
| 216 |
+
('Protocol update','Only receipt-verified scored strict units enter the added result panels; generated-only outputs are not scored evidence.'),
|
| 217 |
+
('Figure 6 boundary','Historical bulk-only explorations are included as exploratory evidence. The user-prepared independent reproduction dataset is still pending.')],3,'guide:availability','Planning cards from the original deck are retained as dated snapshots, not a fresh list of experiments to rerun.'),
|
| 218 |
+
note('Why the historical and strict protocols differ','Protocol boundary',[
|
| 219 |
+
('Historical healthy learning curves','LoRA used n training plus 7 validation pairs. Historical scSemi budget curves also reused CV-derived highly variable genes.'),
|
| 220 |
+
('Five donors versus five samples','Sepsis support is five samples; multi-visit Imperial, Giroux and Ji support can include more than five samples.'),
|
| 221 |
+
('New strict evaluation','Fixed-step, exact-sample support is a distinct protocol. Its partial results are labelled by completed cohort and draw.')],21,'guide:protocol','Support draws overlap in donors. Displayed draw variation is not independent population replication.'),
|
| 222 |
+
note('What remains to establish Figure 6','Figure 6',[
|
| 223 |
+
('Existing exploratory outputs','Historical bulk-only generation and candidate audits are available and shown with their validation outcomes.'),
|
| 224 |
+
('Independent reproduction','The new user-prepared cohort is a separate evaluation; no completed finding is claimed here.'),
|
| 225 |
+
('Evidence required','Prespecified endpoint, exact sample/visit linkage, population definition and confirmation beyond the input-bulk signal.')],55,'guide:figure6','Historical candidate analyses do not substitute for independent reproduction in the new cohort.')
|
| 226 |
+
]
|
| 227 |
+
keys=[x['addition_key'] for x in additions];assert len(keys)==len(set(keys)),keys
|
| 228 |
+
by_after={n:[] for n in range(77)}
|
| 229 |
+
for item in additions:
|
| 230 |
+
assert 0<=int(item['after_original'])<=76
|
| 231 |
+
by_after[int(item['after_original'])].append(item)
|
| 232 |
+
slides=list(by_after[0])
|
| 233 |
+
for number,item in enumerate(original,1):
|
| 234 |
+
slides.append(original_slide(number,item,review_by_old));slides.extend(by_after[number])
|
| 235 |
+
for s in slides:method_palette(s,policy)
|
| 236 |
+
prs=Presentation();prs.slide_width=Inches(G.SLIDE_W);prs.slide_height=Inches(G.SLIDE_H)
|
| 237 |
+
for i,s in enumerate(slides,1):
|
| 238 |
+
kind=s['kind']
|
| 239 |
+
if kind=='title':G.build_title(prs,s)
|
| 240 |
+
elif kind=='agenda':G.build_agenda(prs,s,i)
|
| 241 |
+
elif kind=='divider':G.build_divider(prs,s,i)
|
| 242 |
+
elif kind=='content':G.build_content(prs,s,i)
|
| 243 |
+
elif kind=='evidence_note':draw_note(prs,s,i)
|
| 244 |
+
else:raise ValueError(kind)
|
| 245 |
+
for f in s.get('figures',[]):
|
| 246 |
+
source(D/f,'embedded figure')
|
| 247 |
+
vector=(D/f).with_suffix('.pdf')
|
| 248 |
+
if vector.is_file():source(vector,'figure vector companion')
|
| 249 |
+
prs.save(D/(OUT+'.pptx'))
|
| 250 |
+
for p in [Path(__file__),D/'generate_deck.py',D/'tools/style.py',D/'tools/review_palette_pdf.py',D/'tools/expanded_legacy_rare.py',D/'tools/expanded_healthy_materials.py',D/'tools/expanded_disease_materials.py']:
|
| 251 |
+
source(p,'expanded deck builder or plotting source')
|
| 252 |
+
coverage=[{'original_slide':s['original_slide'],'expanded_slide':i,'original_title':s['original_title'],'current_title':s['title']} for i,s in enumerate(slides,1) if 'original_slide' in s]
|
| 253 |
+
assert [r['original_slide'] for r in coverage]==list(range(1,77))
|
| 254 |
+
spec={'deck':{'output_pptx':OUT+'.pptx','output_pdf':OUT+'.pdf'},'slides':slides}
|
| 255 |
+
(A/'spec.json').write_text(json.dumps(spec,indent=2)+'\n')
|
| 256 |
+
with (A/'original_76_coverage.csv').open('w') as f:
|
| 257 |
+
w=csv.DictWriter(f,fieldnames=list(coverage[0]));w.writeheader();w.writerows(coverage)
|
| 258 |
+
with (A/'slide_map.csv').open('w') as f:
|
| 259 |
+
w=csv.DictWriter(f,fieldnames=['slide','original_slide','addition_key','title','section','footnote']);w.writeheader()
|
| 260 |
+
for i,s in enumerate(slides,1):w.writerow({'slide':i,'original_slide':s.get('original_slide',''),'addition_key':s.get('addition_key',''),'title':s['title'],'section':s.get('section_label',''),'footnote':s.get('footnote','')})
|
| 261 |
+
manifest={'schema':'pbisc.expanded-master.v1','as_of_kst':datetime.now(timezone(timedelta(hours=9))).isoformat(),
|
| 262 |
+
'slides':slides,'sources':SOURCES,'original_slides':76,'added_slides':len(additions),'total_slides':len(slides),
|
| 263 |
+
'coverage':coverage,'palette_records':PALETTE_RECORDS,'modules':modules,
|
| 264 |
+
'output':{'pptx':{'path':str(D/(OUT+'.pptx')),'sha256':sha(D/(OUT+'.pptx'))},'pdf':'pending export'},
|
| 265 |
+
'new_training':False,'new_generation':False,'new_scoring':False,
|
| 266 |
+
'cpu_work':'existing figure reuse; saved-table and stored-coordinate plotting only'}
|
| 267 |
+
(A/'manifest.json').write_text(json.dumps(manifest,indent=2)+'\n')
|
| 268 |
+
print(json.dumps({'original':76,'added':len(additions),'total':len(slides),'sources':len(SOURCES),'pptx':str(D/(OUT+'.pptx'))}))
|
| 269 |
+
|
| 270 |
+
if __name__=='__main__':main()
|