junidude14 commited on
Commit
ab95dc3
·
verified ·
1 Parent(s): 4ffb18b

Archive 4 checkpoints (1-4)

Browse files
paper-releases/pbisc-diffusion/updates/20261012T130738Z-strictpairs-implementation/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/archive/20261012T130738Z-strictpairs-implementation/snapshot/backups/preflight_rejected_v1/protocol/splits/ye2026_sepsis/disease/draw4/support.json ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "pbisc.paper.strict-support.v1",
3
+ "cohort": "ye2026_sepsis",
4
+ "design": "disease_existing_draw",
5
+ "unit": "draw4_n5",
6
+ "n_pairs": 5,
7
+ "train_sample_ids": [
8
+ "IC23",
9
+ "Skin-S142",
10
+ "Res-PS22",
11
+ "Abd-S102",
12
+ "Skin-S46"
13
+ ],
14
+ "train_donor_ids": [
15
+ "IC23",
16
+ "Skin-S142",
17
+ "Res-PS22",
18
+ "Abd-S102",
19
+ "Skin-S46"
20
+ ],
21
+ "test_sample_ids": [
22
+ "Abd-PS04",
23
+ "Abd-PS05",
24
+ "Abd-PS07",
25
+ "Abd-PS19",
26
+ "Abd-PS20",
27
+ "Abd-PS23",
28
+ "Abd-PS27",
29
+ "Abd-S103",
30
+ "Abd-S120",
31
+ "Abd-S123",
32
+ "Abd-S156",
33
+ "Abd-S39",
34
+ "Abd-S42",
35
+ "Abd-S47",
36
+ "Abd-S51",
37
+ "Abd-S54",
38
+ "Abd-S57",
39
+ "Abd-S66",
40
+ "Abd-S79",
41
+ "Abd-S83",
42
+ "Abd-S98",
43
+ "HC01",
44
+ "HC05",
45
+ "HC07",
46
+ "HC09",
47
+ "HC12",
48
+ "HC13",
49
+ "HC16",
50
+ "IC10",
51
+ "IC15",
52
+ "IC16",
53
+ "IC19",
54
+ "IC22",
55
+ "PHC01",
56
+ "PHC02",
57
+ "PHC03",
58
+ "PHC05",
59
+ "PIC01",
60
+ "PIC02",
61
+ "PIC04",
62
+ "PIC05",
63
+ "Res-PS02",
64
+ "Res-PS03",
65
+ "Res-PS12",
66
+ "Res-PS16",
67
+ "Res-PS21",
68
+ "Res-PS25",
69
+ "Res-PS26",
70
+ "Res-S10",
71
+ "Res-S125",
72
+ "Res-S127",
73
+ "Res-S136",
74
+ "Res-S139",
75
+ "Res-S146",
76
+ "Res-S149",
77
+ "Res-S150",
78
+ "Res-S164",
79
+ "Res-S166",
80
+ "Res-S174",
81
+ "Res-S177",
82
+ "Res-S184",
83
+ "Res-S19",
84
+ "Res-S26",
85
+ "Res-S40",
86
+ "Res-S77",
87
+ "Res-S87",
88
+ "Skin-S140",
89
+ "Skin-S152",
90
+ "Skin-S38",
91
+ "Skin-S43",
92
+ "Skin-S52",
93
+ "Skin-S74",
94
+ "Uri-S134",
95
+ "Uri-S147",
96
+ "Uri-S157",
97
+ "Uri-S20",
98
+ "Uri-S93"
99
+ ],
100
+ "test_donor_ids": [
101
+ "Abd-PS04",
102
+ "Abd-PS05",
103
+ "Abd-PS07",
104
+ "Abd-PS19",
105
+ "Abd-PS20",
106
+ "Abd-PS23",
107
+ "Abd-PS27",
108
+ "Abd-S103",
109
+ "Abd-S120",
110
+ "Abd-S123",
111
+ "Abd-S156",
112
+ "Abd-S39",
113
+ "Abd-S42",
114
+ "Abd-S47",
115
+ "Abd-S51",
116
+ "Abd-S54",
117
+ "Abd-S57",
118
+ "Abd-S66",
119
+ "Abd-S79",
120
+ "Abd-S83",
121
+ "Abd-S98",
122
+ "HC01",
123
+ "HC05",
124
+ "HC07",
125
+ "HC09",
126
+ "HC12",
127
+ "HC13",
128
+ "HC16",
129
+ "IC10",
130
+ "IC15",
131
+ "IC16",
132
+ "IC19",
133
+ "IC22",
134
+ "PHC01",
135
+ "PHC02",
136
+ "PHC03",
137
+ "PHC05",
138
+ "PIC01",
139
+ "PIC02",
140
+ "PIC04",
141
+ "PIC05",
142
+ "Res-PS02",
143
+ "Res-PS03",
144
+ "Res-PS12",
145
+ "Res-PS16",
146
+ "Res-PS21",
147
+ "Res-PS25",
148
+ "Res-PS26",
149
+ "Res-S10",
150
+ "Res-S125",
151
+ "Res-S127",
152
+ "Res-S136",
153
+ "Res-S139",
154
+ "Res-S146",
155
+ "Res-S149",
156
+ "Res-S150",
157
+ "Res-S164",
158
+ "Res-S166",
159
+ "Res-S174",
160
+ "Res-S177",
161
+ "Res-S184",
162
+ "Res-S19",
163
+ "Res-S26",
164
+ "Res-S40",
165
+ "Res-S77",
166
+ "Res-S87",
167
+ "Skin-S140",
168
+ "Skin-S152",
169
+ "Skin-S38",
170
+ "Skin-S43",
171
+ "Skin-S52",
172
+ "Skin-S74",
173
+ "Uri-S134",
174
+ "Uri-S147",
175
+ "Uri-S157",
176
+ "Uri-S20",
177
+ "Uri-S93"
178
+ ],
179
+ "excluded_sample_ids": [],
180
+ "seed": null,
181
+ "selection_audit": [
182
+ {
183
+ "donor_id": "IC23",
184
+ "assigned_stratum": false,
185
+ "selected_sample_id": "IC23",
186
+ "candidates": [
187
+ {
188
+ "sample_id": "IC23",
189
+ "time_value": 0.0,
190
+ "time_raw": "none (single sample per donor)",
191
+ "time_field": "timepoint",
192
+ "group": "adult_ICU_ctrl"
193
+ }
194
+ ]
195
+ },
196
+ {
197
+ "donor_id": "Skin-S142",
198
+ "assigned_stratum": true,
199
+ "selected_sample_id": "Skin-S142",
200
+ "candidates": [
201
+ {
202
+ "sample_id": "Skin-S142",
203
+ "time_value": 0.0,
204
+ "time_raw": "none (single sample per donor)",
205
+ "time_field": "timepoint",
206
+ "group": "adult_sepsis"
207
+ }
208
+ ]
209
+ },
210
+ {
211
+ "donor_id": "Res-PS22",
212
+ "assigned_stratum": true,
213
+ "selected_sample_id": "Res-PS22",
214
+ "candidates": [
215
+ {
216
+ "sample_id": "Res-PS22",
217
+ "time_value": 0.0,
218
+ "time_raw": "none (single sample per donor)",
219
+ "time_field": "timepoint",
220
+ "group": "ped_sepsis"
221
+ }
222
+ ]
223
+ },
224
+ {
225
+ "donor_id": "Abd-S102",
226
+ "assigned_stratum": true,
227
+ "selected_sample_id": "Abd-S102",
228
+ "candidates": [
229
+ {
230
+ "sample_id": "Abd-S102",
231
+ "time_value": 0.0,
232
+ "time_raw": "none (single sample per donor)",
233
+ "time_field": "timepoint",
234
+ "group": "adult_sepsis"
235
+ }
236
+ ]
237
+ },
238
+ {
239
+ "donor_id": "Skin-S46",
240
+ "assigned_stratum": true,
241
+ "selected_sample_id": "Skin-S46",
242
+ "candidates": [
243
+ {
244
+ "sample_id": "Skin-S46",
245
+ "time_value": 0.0,
246
+ "time_raw": "none (single sample per donor)",
247
+ "time_field": "timepoint",
248
+ "group": "adult_sepsis"
249
+ }
250
+ ]
251
+ }
252
+ ],
253
+ "sha256": "e72d06f5f4f5c10cf7fff8edaee1493e18c67dc4bbf65793eae6c984120cc4d2"
254
+ }
paper-releases/pbisc-diffusion/updates/20261012T130738Z-strictpairs-implementation/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/archive/20261012T130738Z-strictpairs-implementation/snapshot/backups/score_strict_before_legacy_adoption.py ADDED
@@ -0,0 +1,714 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Strict-support CPU scorer; imports legacy metric mains with isolated output roots.
3
+
4
+ Example: python tools/score_strict.py --support-manifest protocol/splits/.../support.json
5
+ --out scores/COHORT/UNIT --arm lora=generated.npz --action all
6
+ """
7
+ from __future__ import annotations
8
+
9
+ import argparse
10
+ import hashlib
11
+ import importlib.util
12
+ import json
13
+ import os
14
+ import re
15
+ import sys
16
+ from pathlib import Path
17
+
18
+ for _key in ("OMP_NUM_THREADS", "OPENBLAS_NUM_THREADS", "MKL_NUM_THREADS", "NUMBA_NUM_THREADS"):
19
+ os.environ.setdefault(_key, "4")
20
+ os.environ["CUDA_VISIBLE_DEVICES"] = ""
21
+
22
+ import pandas as pd # noqa: E402
23
+ import numpy as np # noqa: E402
24
+
25
+ PLAN = Path(__file__).resolve().parents[1]
26
+ LEGACY = PLAN.parent / "paired_finetune_intradataset_20260927"
27
+ TOOLS = LEGACY / "tools"
28
+ sys.path.insert(0, str(TOOLS))
29
+ sys.path.insert(0, str(PLAN / "tools"))
30
+ from campaign import BASE, BASE_SHA # noqa: E402 canonical pretraining checkpoint pinned by campaign
31
+
32
+
33
+ def manifest_digest(data: dict) -> str:
34
+ body = {k: v for k, v in data.items() if k != "sha256"}
35
+ return hashlib.sha256(json.dumps(body, sort_keys=True, separators=(",", ":"), allow_nan=False).encode()).hexdigest()
36
+
37
+
38
+ def read_support(path: Path) -> dict:
39
+ data = json.loads(Path(path).read_text())
40
+ if data.get("schema") != "pbisc.paper.strict-support.v1" or data.get("sha256") != manifest_digest(data):
41
+ raise ValueError("strict support schema or hash mismatch")
42
+ train, test = data.get("train_sample_ids", []), data.get("test_sample_ids", [])
43
+ td, vd = data.get("train_donor_ids", []), data.get("test_donor_ids", [])
44
+ if not test or not train or len(train) != len(td) or len(test) != len(vd):
45
+ raise ValueError("support requires aligned train/test identities")
46
+ if data.get("n_pairs") != len(train):
47
+ raise ValueError("support n_pairs differs from exact training rows")
48
+ if len(set(train)) != len(train) or len(set(td)) != len(td) or len(set(test)) != len(test):
49
+ raise ValueError("duplicate support identity")
50
+ if set(td) & set(vd):
51
+ raise ValueError("train/test donor overlap")
52
+ if set(train) & set(test + data.get("excluded_sample_ids", [])):
53
+ raise ValueError("support sample overlap")
54
+ return data
55
+
56
+
57
+ def patient_mapping(support: dict) -> pd.DataFrame:
58
+ return pd.DataFrame({"sample_id": support["test_sample_ids"], "donor_id": support["test_donor_ids"]})
59
+
60
+
61
+ def validate_lora_run(run: dict, support: dict) -> None:
62
+ """Reject an old larger-support run even if its held-out IDs coincide."""
63
+ expected = support["train_sample_ids"]
64
+ actual = run.get("train_rows", [])
65
+ if len(actual) != len(expected) or set(actual) != set(expected):
66
+ raise ValueError("LoRA train_rows differ from exact strict support")
67
+ if len(expected) != support["n_pairs"] or len(set(support["train_donor_ids"])) != len(expected):
68
+ raise ValueError("strict support pair count differs from unique donors")
69
+ checks = {
70
+ "support_sha256": support["sha256"], "train_donor_ids": support["train_donor_ids"],
71
+ "test_rows_never_loaded_for_training": support["test_sample_ids"],
72
+ "excluded_selected_donor_visits": support.get("excluded_sample_ids", []),
73
+ "inner_val_rows": [], "fixed_steps": 3000, "steps_run": 3000,
74
+ "selected_step": 3000, "mode": "lora", "source_checkpoint_sha256": BASE_SHA,
75
+ }
76
+ for field, want in checks.items():
77
+ got = run.get(field)
78
+ if field in {"test_rows_never_loaded_for_training", "excluded_selected_donor_visits"}:
79
+ if not isinstance(got, list) or len(got) != len(want) or set(got) != set(want):
80
+ raise ValueError(f"LoRA {field} differs from strict support")
81
+ elif got != want:
82
+ raise ValueError(f"LoRA {field} differs from strict support")
83
+ if run.get("trainable", {}).get("lora_rank") != 16:
84
+ raise ValueError("LoRA rank differs from strict protocol")
85
+ if not re.fullmatch(r"[0-9a-f]{64}", str(run.get("checkpoint_sha256", ""))):
86
+ raise ValueError("LoRA checkpoint hash absent or invalid")
87
+
88
+
89
+ def _sha(path: Path) -> str:
90
+ h = hashlib.sha256()
91
+ with Path(path).open("rb") as f:
92
+ for block in iter(lambda: f.read(8 * 1024 * 1024), b""):
93
+ h.update(block)
94
+ return h.hexdigest()
95
+
96
+
97
+ def _unit_relative(support: dict) -> Path:
98
+ unit = support["unit"]
99
+ cohort = support["cohort"]
100
+ if support.get("design") == "healthy_outerfold":
101
+ match = re.fullmatch(r"fold(\d+)_n(\d+)", unit)
102
+ if match and int(match[2]) == support["n_pairs"]:
103
+ return Path(cohort) / "healthy" / f"fold{match[1]}" / f"n{match[2]}"
104
+ elif support.get("design") == "disease_existing_draw":
105
+ match = re.fullmatch(r"draw(\d+)_n(\d+)", unit)
106
+ if match and int(match[2]) == support["n_pairs"]:
107
+ return Path(cohort) / "disease" / f"draw{match[1]}"
108
+ raise ValueError("support unit/design is not a canonical strict campaign unit")
109
+
110
+
111
+ def _strict_conditions(support: dict, rel: Path) -> dict:
112
+ folder = PLAN / "data" / rel
113
+ path = folder / "CONDITIONS.json"
114
+ support_path = PLAN / "protocol/splits" / rel / "support.json"
115
+ if not path.is_file() or not support_path.is_file():
116
+ raise ValueError("strict condition or support receipt missing")
117
+ if read_support(support_path)["sha256"] != support["sha256"]:
118
+ raise ValueError("canonical support hash differs")
119
+ rec = json.loads(path.read_text())
120
+ if (rec.get("support_sha256") != support["sha256"] or
121
+ rec.get("support_path") != str(support_path) or
122
+ rec.get("fit_sample_ids") != support["train_sample_ids"]):
123
+ raise ValueError("strict condition fit/support binding differs")
124
+ for name in ("test_raw.npz", "test_cal.npz"):
125
+ file = folder / name
126
+ if not file.is_file() or rec.get("files_sha256", {}).get(name) != _sha(file):
127
+ raise ValueError(f"strict condition file missing or hash differs: {name}")
128
+ with np.load(file, allow_pickle=False) as z:
129
+ if set(z["sample_ids"].astype(str)) != set(support["test_sample_ids"]):
130
+ raise ValueError(f"strict condition sample IDs differ: {name}")
131
+ return rec
132
+
133
+
134
+ def validate_global_build_inputs(build: dict) -> None:
135
+ inputs = build.get("input_hashes", {})
136
+ if not inputs:
137
+ raise ValueError("global BUILD input hashes missing")
138
+ for raw, expected in inputs.items():
139
+ source = Path(raw)
140
+ if not source.is_file() or _sha(source) != expected:
141
+ raise ValueError(f"global BUILD input changed or missing: {source}")
142
+
143
+
144
+ def validate_generation_arm(name: str, path: Path, support: dict) -> dict:
145
+ """Bind an NPZ to its actual strict training/calibration/export sources."""
146
+ rel = _unit_relative(support)
147
+ canonical_support = PLAN / "protocol/splits" / rel / "support.json"
148
+ if not canonical_support.is_file() or read_support(canonical_support)["sha256"] != support["sha256"]:
149
+ raise ValueError("arm support hash differs from canonical strict campaign support")
150
+ if name not in ("lora", "pairedcal", "scsemi", "raw", "refcal"):
151
+ raise ValueError(f"unsupported campaign arm {name}")
152
+ expected = (PLAN / "generated/global" / support["cohort"] / f"{name}.npz" if name in ("raw", "refcal")
153
+ else PLAN / "generated" / rel / f"{name}.npz")
154
+ path = Path(path).resolve()
155
+ if path != expected.resolve():
156
+ raise ValueError(f"canonical strict arm path required: {expected}")
157
+ if not path.is_file() or not path.with_suffix(".log").is_file():
158
+ raise ValueError(f"generation NPZ or receipt missing: {path}")
159
+ receipt = json.loads(path.with_suffix(".log").read_text())
160
+ npz_sha = _sha(path)
161
+ if receipt.get("output") != str(path) or receipt.get("output_sha256") != npz_sha:
162
+ raise ValueError("generation output path/hash differs from receipt")
163
+ with np.load(path, allow_pickle=False) as z:
164
+ samples = z["sample_ids"].astype(str).tolist()
165
+ meta = json.loads(str(z["metadata_json"]))
166
+ if len(samples) != len(set(samples)) or not set(support["test_sample_ids"]) <= set(samples):
167
+ raise ValueError("generation sample IDs omit strict held-out samples")
168
+ if name not in ("raw", "refcal") and set(samples) != set(support["test_sample_ids"]):
169
+ raise ValueError("unit generation includes samples beyond strict test support")
170
+ if name in ("raw", "refcal"):
171
+ build_path = PLAN / "data/external_refcal" / support["cohort"] / "BUILD.json"
172
+ if not build_path.is_file():
173
+ raise ValueError("global external reference BUILD.json missing")
174
+ build = json.loads(build_path.read_text())
175
+ validate_global_build_inputs(build)
176
+ cond = PLAN / "data/external_refcal" / support["cohort"] / f"conditions_{name}.npz"
177
+ cond_sha = _sha(cond) if cond.is_file() else None
178
+ if (build.get("schema") != "pbisc.strict.external-reference.v1" or
179
+ build.get("cohort") != support["cohort"] or
180
+ build.get("target_sc_expression_accessed") is not False or
181
+ build.get("paired_target_samples_used") != 0 or
182
+ build.get("outputs", {}).get(str(cond)) != cond_sha or
183
+ not set(support["test_sample_ids"]) <= set(build.get("target_bulk_anchor_sample_ids", []))):
184
+ raise ValueError("global BUILD/condition metadata differs from external-reference protocol")
185
+ checkpoint_sha, checkpoint = BASE_SHA, BASE
186
+ source = str(build_path)
187
+ else:
188
+ conditions = _strict_conditions(support, rel)
189
+ cond_name = "test_cal.npz" if name == "pairedcal" else "test_raw.npz"
190
+ cond = PLAN / "data" / rel / cond_name
191
+ cond_sha = conditions["files_sha256"][cond_name]
192
+ checkpoint_sha, checkpoint = BASE_SHA, BASE
193
+ source = str(PLAN / "data" / rel / "CONDITIONS.json")
194
+ if name == "lora":
195
+ run_path = PLAN / "runs" / rel / "lora/RUN.json"
196
+ if not run_path.is_file():
197
+ raise ValueError("strict LoRA RUN.json missing")
198
+ run = json.loads(run_path.read_text())
199
+ validate_lora_run(run, support)
200
+ checkpoint = PLAN / "runs" / rel / "lora/checkpoint_ft.pt"
201
+ checkpoint_sha = run["checkpoint_sha256"]
202
+ if not checkpoint.is_file() or _sha(checkpoint) != checkpoint_sha:
203
+ raise ValueError("strict LoRA checkpoint differs from RUN.json")
204
+ source = str(run_path)
205
+ elif name == "scsemi":
206
+ work = PLAN / "scsemi" / rel
207
+ inputs_path = work / "inputs/inputs_manifest.json"
208
+ validation_path = path.with_suffix(".validation.json")
209
+ if not inputs_path.is_file() or not validation_path.is_file():
210
+ raise ValueError("strict scSemi inputs or export validation missing")
211
+ inputs, validation = json.loads(inputs_path.read_text()), json.loads(validation_path.read_text())
212
+ reps = [x["sample_id"] for x in inputs.get("representatives", [])]
213
+ if (inputs.get("mode") != "strict" or inputs.get("smoke") or
214
+ inputs.get("support_sha256") != support["sha256"] or
215
+ reps != support["train_sample_ids"] or
216
+ inputs.get("targets") != support["test_sample_ids"] or
217
+ inputs.get("train_donors") != support["train_donor_ids"] or
218
+ inputs.get("n_representatives") != support["n_pairs"] or
219
+ inputs.get("sources", {}).get("support.json") != _sha(PLAN / "protocol/splits" / rel / "support.json") or
220
+ inputs.get("condition_sha256") != cond_sha or
221
+ validation.get("passed") is not True or validation.get("npz_sha256") != npz_sha or
222
+ receipt.get("run_signature") != meta.get("run_signature") or
223
+ meta.get("work") != str(work)):
224
+ raise ValueError("scSemi export/work inputs differ from strict support")
225
+ source = str(inputs_path)
226
+ checkpoint_sha, checkpoint = None, None
227
+ if (receipt.get("condition_npz") != str(cond) or receipt.get("condition_sha256") != cond_sha or
228
+ meta.get("input_condition_path") != str(cond) or meta.get("input_condition_sha256") != cond_sha):
229
+ raise ValueError("generation condition differs from strict source")
230
+ if name != "scsemi" and (receipt.get("checkpoint") != str(checkpoint) or
231
+ receipt.get("checkpoint_sha256") != checkpoint_sha or
232
+ meta.get("checkpoint") != str(checkpoint) or
233
+ meta.get("checkpoint_sha256") != checkpoint_sha):
234
+ raise ValueError("generation checkpoint differs from strict source")
235
+ if name == "scsemi" and (meta.get("representatives") != support["train_sample_ids"] or
236
+ meta.get("train_donors") != support["train_donor_ids"] or meta.get("smoke")):
237
+ raise ValueError("scSemi metadata differs from strict representatives")
238
+ return {"arm": name, "npz": str(path), "npz_sha256": npz_sha,
239
+ "receipt": str(path.with_suffix(".log")), "receipt_sha256": _sha(path.with_suffix(".log")),
240
+ "source_binding": source, "source_binding_sha256": _sha(Path(source)),
241
+ "condition_npz": str(cond), "condition_sha256": cond_sha,
242
+ "checkpoint_sha256": checkpoint_sha, "support_sha256": support["sha256"]}
243
+
244
+
245
+ def safe_out(path: Path) -> Path:
246
+ out = Path(path).resolve()
247
+ if not out.is_relative_to(PLAN.resolve()):
248
+ raise ValueError("--out must be within the strict-pairs plan directory")
249
+ protected = ("protocol", "tools", "tests", "data", "figures", "manuscript", "deck", "backups", "source_data")
250
+ if out == PLAN.resolve() or any(out.is_relative_to((PLAN / part).resolve()) for part in protected):
251
+ raise ValueError("--out must be a dedicated result directory within the strict-pairs plan")
252
+ return out
253
+
254
+
255
+ def extra_root(out: Path) -> Path:
256
+ return Path(out) / "extras"
257
+
258
+
259
+ def contrast_root(out: Path) -> Path:
260
+ return Path(out) / "contrast"
261
+
262
+
263
+ def _legacy_module(name: str):
264
+ if name in sys.modules:
265
+ return sys.modules[name]
266
+ spec = importlib.util.spec_from_file_location(name, TOOLS / f"{name}.py")
267
+ module = importlib.util.module_from_spec(spec)
268
+ sys.modules[name] = module
269
+ spec.loader.exec_module(module)
270
+ return module
271
+
272
+
273
+ def _arms(values: list[str]) -> list[str]:
274
+ names = set()
275
+ out = []
276
+ for value in values:
277
+ name, sep, raw = value.partition("=")
278
+ if name == "observed":
279
+ raise ValueError("arm name 'observed' is reserved for the real reference")
280
+ if sep != "=" or not name or not raw or not name.replace("_", "").replace("-", "").isalnum() or name in names:
281
+ raise ValueError(f"bad or duplicate --arm {value!r}")
282
+ names.add(name)
283
+ out.append(f"{name}={Path(raw).resolve()}")
284
+ return out
285
+
286
+
287
+ def _existing_score(score: Path, support: dict, names: list[str]) -> dict:
288
+ binding = score.parent / "scoring_support.json"
289
+ rec = json.loads(binding.read_text()) if binding.is_file() else {}
290
+ if rec.get("support_sha256") != support["sha256"]:
291
+ raise ValueError("score support hash absent or different")
292
+ p = score / "summary.json"
293
+ if not p.is_file():
294
+ raise ValueError(f"score output missing: {p}; run --action score first")
295
+ summary = json.loads(p.read_text())
296
+ if summary.get("dataset") != support["cohort"] or set(summary.get("donors", [])) != set(support["test_sample_ids"]):
297
+ raise ValueError("score summary does not match strict support test samples")
298
+ if names and set(summary.get("arms", [])) != set(names):
299
+ raise ValueError("score summary arm names differ from requested arms")
300
+ bindings = rec.get("arm_bindings", {})
301
+ if set(bindings) != set(summary.get("arms", [])):
302
+ raise ValueError("score generation binding missing or has different arms")
303
+ for name in summary["arms"]:
304
+ scored = summary.get("per_arm", {}).get(name, {})
305
+ source = bindings[name]
306
+ if scored.get("npz_sha256") != source.get("npz_sha256") or scored.get("npz") != source.get("npz"):
307
+ raise ValueError(f"score generation binding differs for {name}")
308
+ return summary
309
+
310
+
311
+ def _call_score(support: dict, out: Path, arms: list[str], a: argparse.Namespace) -> None:
312
+ if not arms:
313
+ raise ValueError("--action score requires --arm NAME=NPZ")
314
+ arm_bindings = {name: validate_generation_arm(name, Path(path), support)
315
+ for name, path in (arm.split("=", 1) for arm in arms)}
316
+ score = out / "score"
317
+ score.mkdir(parents=True, exist_ok=True)
318
+ binding = out / "scoring_support.json"
319
+ if binding.is_file() and json.loads(binding.read_text()).get("support_sha256") != support["sha256"]:
320
+ raise ValueError("existing output belongs to a different support hash")
321
+ if (score / "summary.json").is_file():
322
+ existing = json.loads((score / "summary.json").read_text())
323
+ if (existing.get("dataset") != support["cohort"] or
324
+ set(existing.get("donors", [])) != set(support["test_sample_ids"]) or
325
+ set(existing.get("arms", [])) != set(arm_bindings)):
326
+ raise ValueError("existing score differs from requested strict support or arms")
327
+ for name, source in arm_bindings.items():
328
+ scored = existing.get("per_arm", {}).get(name, {})
329
+ if scored.get("npz_sha256") != source["npz_sha256"] or scored.get("npz") != source["npz"]:
330
+ raise ValueError(f"existing score differs from validated generation for {name}")
331
+ binding.write_text(json.dumps({"schema": "pbisc.paper.strict-score-binding.v1",
332
+ "support_sha256": support["sha256"],
333
+ "cohort": support["cohort"], "unit": support["unit"],
334
+ "test_sample_ids": support["test_sample_ids"],
335
+ "test_donor_ids": support["test_donor_ids"],
336
+ "arm_bindings": arm_bindings}, indent=2) + "\n")
337
+ if (score / "summary.json").is_file():
338
+ _existing_score(score, support, list(arm_bindings))
339
+ return
340
+ mapping = patient_mapping(support)
341
+ mapping.to_csv(out / "patient_mapping.csv", index=False)
342
+ donor_file = out / "test_sample_ids.txt"
343
+ donor_file.write_text("\n".join(support["test_sample_ids"]) + "\n")
344
+ argv = ["--dataset", support["cohort"], "--out", str(score), "--donors", str(donor_file),
345
+ "--threads", str(a.threads)]
346
+ for arm in arms:
347
+ argv += ["--arm", arm]
348
+ if a.reference:
349
+ argv += ["--reference", str(a.reference)]
350
+ if a.annot:
351
+ argv += ["--annot", str(a.annot)]
352
+ for condition in a.condition:
353
+ argv += ["--condition", condition]
354
+ if a.allow_no_receipt:
355
+ argv.append("--allow-no-receipt")
356
+ if support["cohort"] == "giroux2022":
357
+ exclude = LEGACY / "data/sex_linked_genes/sex_linked_genes_exclude.csv"
358
+ if not exclude.is_file():
359
+ raise ValueError(f"required Giroux sex-gene exclusion missing: {exclude}")
360
+ argv += ["--exclude-genes", str(exclude)]
361
+ groups = {
362
+ "ye2026_sepsis": ("adult_sepsis,ped_sepsis", "adult_HC,adult_ICU_ctrl,ped_HC,ped_ICU_ctrl"),
363
+ "ji2025_chili": ("TOL,FU1", "BC,AC"),
364
+ "imperial_eskd": ("covid_positive", "covid_negative"),
365
+ "giroux2022": ("severe", "mild"),
366
+ }
367
+ if support["cohort"] in groups:
368
+ case, ctrl = groups[support["cohort"]]
369
+ argv += ["--case-groups", case, "--control-groups", ctrl]
370
+ else:
371
+ argv += ["--no-contrast", "--no-deg"]
372
+ if a.reuse_labels:
373
+ argv += ["--reuse-labels", str(a.reuse_labels)]
374
+ previous_argv = sys.argv
375
+ try:
376
+ sys.argv = [str(TOOLS / "score_ft.py"), *argv]
377
+ _legacy_module("score_ft").main(argv)
378
+ finally:
379
+ sys.argv = previous_argv
380
+ _existing_score(score, support, [x.split("=", 1)[0] for x in arms])
381
+
382
+
383
+ def _call_extra(kind: str, support: dict, out: Path, arms: list[str], threads: int) -> None:
384
+ score = out / "score"
385
+ names = [x.split("=", 1)[0] for x in arms]
386
+ summary = _existing_score(score, support, names)
387
+ names = summary["arms"]
388
+ mod = _legacy_module("extra_metrics" if kind == "extras" else "contrast_extra")
389
+ root = extra_root(out) if kind == "extras" else contrast_root(out)
390
+ mod.OUT_ROOT = root
391
+ mod.SCORED.clear()
392
+ # Scored-mode paths are all rooted at OUT_ROOT; no legacy output tree is touched.
393
+ argv = ["--design", "scored", "--dataset", support["cohort"], "--score-dir", str(score),
394
+ "--arms", ",".join(names), "--unit", "strict", "--threads", str(threads),
395
+ "--fetch-dir", str(root / "_fetch_tmp")]
396
+ mod.main(argv)
397
+
398
+
399
+ def _automatic_deg(support: dict, out: Path, summary: dict, threads: int) -> dict:
400
+ """Rebuild scored per-sample×type counts from the same legacy sources/readout.
401
+
402
+ This is bounded one arm and one cell type at a time. The legacy scorer's
403
+ DEG outputs remain available for comparison; these fits are independent
404
+ corrected outputs and use the explicit support patient map.
405
+ """
406
+ import donor_statistics as DS
407
+
408
+ F = _legacy_module("ft_common")
409
+ S = _legacy_module("score_ft")
410
+ cache = Path(summary["reference"]["cache"])
411
+ ref, man = F.load_reference(cache)
412
+ if man["reference_sha256"] != summary["reference"]["reference_sha256"]:
413
+ raise ValueError("reference cache differs from scored reference")
414
+ deg = F.load_deg_reference(cache, man, ref)
415
+ sample_ids = np.asarray(summary["donors"], dtype=str)
416
+ pos = {x: i for i, x in enumerate(ref["donors"].astype(str))}
417
+ if any(x not in pos for x in sample_ids):
418
+ raise ValueError("scored sample absent from DEG reference")
419
+ sel_ref = np.asarray([pos[x] for x in sample_ids], dtype=int)
420
+ patient_of = dict(zip(support["test_sample_ids"], support["test_donor_ids"]))
421
+ donors = np.asarray([patient_of[x] for x in sample_ids], dtype=str)
422
+ conditions = np.asarray(summary["contrast_definition"]["groups"], dtype=str)
423
+ if conditions.shape != sample_ids.shape:
424
+ raise ValueError("contrast groups do not align with scored samples")
425
+ gene_ids = ref["score_ids"].astype(str)
426
+ keep = np.ones(len(gene_ids), bool)
427
+ exclusion = summary.get("gene_exclusion")
428
+ if support["cohort"] == "giroux2022" and not exclusion:
429
+ raise ValueError("Giroux DEG requires the recorded sex-gene exclusion")
430
+ if exclusion:
431
+ path = Path(exclusion["file"])
432
+ if not path.is_file() or F.sha(path) != exclusion["sha256"]:
433
+ raise ValueError("recorded gene exclusion file changed")
434
+ keep, _ = S.gene_exclusion(path, gene_ids.tolist())
435
+ genes = gene_ids[keep]
436
+ dest = out / "statistics" / "donor_deg"
437
+ dest.mkdir(parents=True, exist_ok=True)
438
+ pd.DataFrame({"gene_id": genes}).to_csv(dest / "genes_kept.csv", index=False)
439
+ all_rows = []
440
+ for arm_name in summary["arms"]:
441
+ pa = summary["per_arm"][arm_name]
442
+ path = Path(pa["npz"])
443
+ if not path.is_file():
444
+ all_rows.append({"arm": arm_name, "status": "pending", "reason": f"generated NPZ missing: {path}"})
445
+ continue
446
+ arm = S.open_arm(arm_name, path, ref["panel_ids"].astype(str), allow_no_receipt=True)
447
+ if arm["sha256"] != pa["npz_sha256"]:
448
+ arm["d"].close()
449
+ raise ValueError(f"{arm_name}: generated NPZ differs from scored input")
450
+ try:
451
+ npos = {x: i for i, x in enumerate(arm["sample_ids"])}
452
+ if any(x not in npos for x in sample_ids):
453
+ raise ValueError(f"{arm_name}: scored sample absent from generated NPZ")
454
+ row_lists = [np.flatnonzero(arm["bulk_index"] == npos[x]) for x in sample_ids]
455
+ selected = np.concatenate(row_lists)
456
+ gen_d = np.repeat(np.arange(len(sample_ids)), [len(x) for x in row_lists])
457
+ cells = pd.read_parquet(out / "score" / "arms" / arm_name / "generated_cells.parquet",
458
+ columns=["npz_row", "donor", "label"])
459
+ if not np.array_equal(cells.npz_row.to_numpy(), selected) or not np.array_equal(
460
+ cells.donor.astype(str).to_numpy(), sample_ids[gen_d]):
461
+ raise ValueError(f"{arm_name}: generated cell labels do not match scored NPZ rows")
462
+ # Exact legacy rule: integerise the whole NPZ first, then select
463
+ # scored rows. The seed and chunk size are inherited, not retyped.
464
+ rates = np.ascontiguousarray(arm["d"]["generated_counts"], dtype=np.float32)
465
+ full = F.PR.poisson_integerise(rates, seed=F.POISSON_SEED, chunk_rows=4096)
466
+ del rates
467
+ Xg = full[selected][:, ref["score_idx"]].tocsr()[:, keep].tocsr()
468
+ del full
469
+ ag = F.type_aggregates(Xg, gen_d, cells.label.astype(str).to_numpy(), len(sample_ids),
470
+ types=tuple(deg["types"]))
471
+ del Xg
472
+ arm_dir = dest / arm_name
473
+ arm_dir.mkdir(parents=True, exist_ok=True)
474
+ for ti, celltype in enumerate(deg["types"]):
475
+ slug = re.sub(r"[^a-z0-9]+", "_", str(celltype).lower()).strip("_")
476
+ type_dir = arm_dir / slug
477
+ obs = DS.pseudobulk_rows_from_arrays(
478
+ sample_ids=sample_ids, donors=donors, conditions=conditions, gene_ids=genes,
479
+ celltype=str(celltype), side="observed", n_cells=deg["n"][sel_ref, ti],
480
+ sums=deg["sum"][sel_ref, ti][:, keep])
481
+ generated = DS.pseudobulk_rows_from_arrays(
482
+ sample_ids=sample_ids, donors=donors, conditions=conditions, gene_ids=genes,
483
+ celltype=str(celltype), side=arm_name, n_cells=ag["n"][:, ti],
484
+ sums=ag["sum"][:, ti])
485
+ table = DS.donor_condition_pseudobulk(pd.concat([obs, generated], ignore_index=True))
486
+ result = DS.run_donor_limma(table, type_dir,
487
+ case=",".join(summary["contrast_definition"]["case_groups"]),
488
+ control=",".join(summary["contrast_definition"]["control_groups"]),
489
+ threads=threads)
490
+ jobs = {j["side"]: j for j in result.get("jobs", [])}
491
+ o, g = jobs.get("observed", {}), jobs.get(arm_name, {})
492
+ okay = o.get("status") == "ok" and g.get("status") == "ok"
493
+ missing_population = obs.empty or generated.empty
494
+ if result.get("status") in ("pending", "partial_or_pending"):
495
+ type_status = "pending"
496
+ elif okay:
497
+ type_status = "ok"
498
+ elif missing_population or all(x.get("status", "not_estimable") in ("ok", "not_estimable")
499
+ for x in (o, g)):
500
+ type_status = "not_estimable"
501
+ else:
502
+ type_status = "pending"
503
+ row = {"arm": arm_name, "celltype": celltype,
504
+ "status": type_status,
505
+ "observed_status": o.get("status", "no_population" if obs.empty else "missing"),
506
+ "generated_status": g.get("status", "no_population" if generated.empty else "missing"),
507
+ "n_case_donors_observed": o.get("n_case_donors"),
508
+ "n_control_donors_observed": o.get("n_control_donors"),
509
+ "n_case_donors_generated": g.get("n_case_donors"),
510
+ "n_control_donors_generated": g.get("n_control_donors"),
511
+ "method_observed": o.get("method"), "method_generated": g.get("method"),
512
+ "reason_observed": o.get("reason"), "reason_generated": g.get("reason"),
513
+ "reason_fit": result.get("reason"),
514
+ "reason_population": ("observed cell type absent" if obs.empty else
515
+ "generated cell type absent" if generated.empty else None)}
516
+ if okay:
517
+ top_o, top_g = set(o.get("top50_gene_ids", [])), set(g.get("top50_gene_ids", []))
518
+ row.update(top50_overlap_count=len(top_o & top_g),
519
+ observed_top50_size=len(top_o), generated_top50_size=len(top_g))
520
+ all_rows.append(row)
521
+ finally:
522
+ arm["d"].close()
523
+ pd.DataFrame(all_rows).to_csv(dest / "donor_deg_summary.csv", index=False)
524
+ n_pending = sum(x["status"] == "pending" for x in all_rows)
525
+ n_not_estimable = sum(x["status"] == "not_estimable" for x in all_rows)
526
+ overall = ("partial_or_pending" if n_pending or not all_rows else
527
+ "complete_with_not_estimable" if n_not_estimable else "ok")
528
+ return {"status": overall,
529
+ "method": "donor_condition_pseudobulk_limma_duplicateCorrelation_if_repeated_condition",
530
+ "n_genes_kept": int(len(genes)), "rows": len(all_rows),
531
+ "n_pending": n_pending, "n_not_estimable": n_not_estimable,
532
+ "summary_csv": str(dest / "donor_deg_summary.csv")}
533
+
534
+
535
+ def require_corrected_deg(result: dict) -> None:
536
+ if result.get("status") not in ("ok", "complete_with_not_estimable", "not_applicable"):
537
+ raise ValueError("donor-aware DEG pending; inspect statistics/status.json and donor_deg summary")
538
+
539
+
540
+ def validate_draw_long(path: Path, current_support: dict, expected_arms: list[str] | tuple[str, ...]) -> pd.DataFrame:
541
+ """Read one other disease draw only after its support, score and generation binding agree."""
542
+ if (current_support.get("design") != "disease_existing_draw" or current_support.get("n_pairs") != 5 or
543
+ not re.fullmatch(r"draw\d+_n5", current_support.get("unit", ""))):
544
+ raise ValueError("--draw-long requires a current strict disease n=5 draw")
545
+ path = Path(path).resolve()
546
+ try:
547
+ parts = path.relative_to((PLAN / "scores").resolve()).parts
548
+ except ValueError as exc:
549
+ raise ValueError("--draw-long must be a canonical score statistics path") from exc
550
+ if len(parts) != 5 or parts[1] != "disease" or parts[3:] != ("statistics", "per_donor_long.csv") or not re.fullmatch(r"draw\d+", parts[2]):
551
+ raise ValueError("--draw-long must be a canonical disease score statistics path")
552
+ cohort, draw = parts[0], parts[2]
553
+ if cohort != current_support["cohort"]:
554
+ raise ValueError("--draw-long cohort differs from current cohort")
555
+ unit = f"{draw}_n5"
556
+ if unit == current_support["unit"]:
557
+ raise ValueError("--draw-long must be a distinct draw")
558
+ support_path = PLAN / "protocol/splits" / cohort / "disease" / draw / "support.json"
559
+ if not support_path.is_file():
560
+ raise ValueError("--draw-long canonical support missing")
561
+ other = read_support(support_path)
562
+ if (other.get("cohort") != cohort or other.get("design") != "disease_existing_draw" or
563
+ other.get("unit") != unit or other.get("n_pairs") != 5):
564
+ raise ValueError("--draw-long strict support cohort/unit/n=5 mismatch")
565
+ base = path.parents[1]
566
+ binding_path = base / "scoring_support.json"
567
+ if not binding_path.is_file():
568
+ raise ValueError("--draw-long generation binding missing")
569
+ binding = json.loads(binding_path.read_text())
570
+ if (binding.get("schema") != "pbisc.paper.strict-score-binding.v1" or
571
+ binding.get("support_sha256") != other["sha256"] or
572
+ binding.get("cohort") != cohort or binding.get("unit") != unit or
573
+ binding.get("test_sample_ids") != other["test_sample_ids"] or
574
+ binding.get("test_donor_ids") != other["test_donor_ids"]):
575
+ raise ValueError("--draw-long generation binding differs from support")
576
+ names = set(expected_arms)
577
+ if not names or set(binding.get("arm_bindings", {})) != names:
578
+ raise ValueError("--draw-long arms differ from current score")
579
+ score = _existing_score(base / "score", other, list(names))
580
+ if set(score["arms"]) != names:
581
+ raise ValueError("--draw-long arms differ from current score")
582
+ for name, source in binding["arm_bindings"].items():
583
+ if validate_generation_arm(name, Path(source["npz"]), other) != source:
584
+ raise ValueError(f"--draw-long generation provenance differs for {name}")
585
+ rows = pd.read_csv(path, dtype={"draw": str, "sample_id": str, "donor_id": str, "arm": str, "metric": str})
586
+ required = {"draw", "sample_id", "donor_id", "arm", "metric", "value"}
587
+ if not required <= set(rows):
588
+ raise ValueError(f"--draw-long missing {sorted(required - set(rows))}")
589
+ if (rows.empty or set(rows.draw) != {unit} or set(rows.arm) != names or
590
+ set(rows.sample_id) != set(other["test_sample_ids"]) or
591
+ rows.duplicated(["draw", "sample_id", "donor_id", "arm", "metric"]).any()):
592
+ raise ValueError("--draw-long rows differ from strict draw/sample/arm contract")
593
+ if any(set(group.sample_id) != set(other["test_sample_ids"]) for _, group in rows.groupby("arm")):
594
+ raise ValueError("--draw-long arm lacks strict test samples")
595
+ patient_of = dict(zip(other["test_sample_ids"], other["test_donor_ids"]))
596
+ if (rows.donor_id != rows.sample_id.map(patient_of)).any():
597
+ raise ValueError("--draw-long patient mapping differs from strict support")
598
+ import donor_statistics as DS
599
+ expected = DS.score_table_with_patients(pd.read_csv(base / "score/per_donor.csv"), patient_mapping(other), draw=unit)
600
+ keys = ["draw", "sample_id", "donor_id", "arm", "metric"]
601
+ got = rows.sort_values(keys).reset_index(drop=True)
602
+ want = expected.sort_values(keys).reset_index(drop=True)
603
+ if (len(got) != len(want) or not got[keys].equals(want[keys]) or
604
+ not np.isclose(pd.to_numeric(got.value, errors="coerce"),
605
+ pd.to_numeric(want.value, errors="coerce"), rtol=1e-12, atol=0,
606
+ equal_nan=True).all()):
607
+ raise ValueError("--draw-long differs from scored metrics")
608
+ rows.attrs["support_sha256"] = other["sha256"]
609
+ rows.attrs["unit"] = unit
610
+ return rows
611
+
612
+
613
+ def validate_draw_longs(paths: list[Path], current_support: dict,
614
+ expected_arms: list[str] | tuple[str, ...]) -> list[pd.DataFrame]:
615
+ seen = {current_support["unit"]}
616
+ tables = []
617
+ for path in paths:
618
+ rows = validate_draw_long(path, current_support, expected_arms)
619
+ unit = rows.attrs["unit"]
620
+ if unit in seen:
621
+ raise ValueError(f"duplicate draw in --draw-long: {unit}")
622
+ seen.add(unit)
623
+ tables.append(rows)
624
+ return tables
625
+
626
+
627
+ def _call_stats(support: dict, out: Path, arms: list[str], a: argparse.Namespace) -> None:
628
+ import donor_statistics as DS
629
+ score = out / "score"
630
+ summary = _existing_score(score, support, [x.split("=", 1)[0] for x in arms])
631
+ dest = out / "statistics"
632
+ dest.mkdir(parents=True, exist_ok=True)
633
+ mapping = patient_mapping(support)
634
+ mapping.to_csv(dest / "patient_mapping.csv", index=False)
635
+ rows = DS.score_table_with_patients(pd.read_csv(score / "per_donor.csv"), mapping, draw=support["unit"])
636
+ rows.to_csv(dest / "per_donor_long.csv", index=False)
637
+ combined = [rows]
638
+ for other in validate_draw_longs(a.draw_long, support, summary["arms"]):
639
+ combined.append(other)
640
+ all_rows = pd.concat(combined, ignore_index=True)
641
+ if all_rows.duplicated(["draw", "sample_id", "donor_id", "arm", "metric"]).any():
642
+ raise ValueError("duplicate draw/sample/arm/metric across --draw-long inputs")
643
+ all_rows.to_csv(dest / "per_donor_long_all.csv", index=False)
644
+ baseline = a.baseline or summary["arms"][0]
645
+ if baseline not in summary["arms"]:
646
+ raise ValueError(f"baseline {baseline} absent from score arms")
647
+ corrected = DS.summarize_metrics(all_rows, baseline=baseline)
648
+ corrected.to_csv(dest / "donor_bootstrap_2000.csv", index=False)
649
+ status = {"schema": "pbisc.paper.strict-statistics.v1", "support_sha256": support["sha256"],
650
+ "bootstrap_unit": "unique_donor_all_visits_and_draws", "bootstrap_replicates": 2000,
651
+ "draws": sorted(all_rows.draw.astype(str).unique().tolist()),
652
+ "disease_deg": {"status": "pending", "reason": "no donor x cell-type per-sample count table supplied"}}
653
+ if a.pseudobulk_table:
654
+ raw = pd.read_csv(a.pseudobulk_table)
655
+ if not set(raw.sample_id.astype(str)) <= set(support["test_sample_ids"]):
656
+ raise ValueError("pseudobulk table contains samples outside strict test support")
657
+ raw = raw.merge(mapping, on="sample_id", how="left", suffixes=("", "_support"), validate="many_to_one")
658
+ if "donor_id_support" in raw:
659
+ if (raw.donor_id.astype(str) != raw.donor_id_support.astype(str)).any():
660
+ raise ValueError("pseudobulk donor mapping differs from support")
661
+ raw = raw.drop(columns="donor_id_support")
662
+ raw["donor_id"] = raw["donor_id"].astype(str)
663
+ agg = DS.donor_condition_pseudobulk(raw)
664
+ cd = summary["contrast_definition"]
665
+ if cd.get("enabled"):
666
+ status["disease_deg"] = DS.run_donor_limma(agg, dest / "donor_deg",
667
+ case=",".join(cd["case_groups"]),
668
+ control=",".join(cd["control_groups"]),
669
+ threads=a.threads)
670
+ else:
671
+ status["disease_deg"] = {"status": "not_applicable", "reason": "no case/control contrast"}
672
+ elif summary["contrast_definition"].get("enabled"):
673
+ status["disease_deg"] = _automatic_deg(support, out, summary, a.threads)
674
+ else:
675
+ status["disease_deg"] = {"status": "not_applicable", "reason": "no case/control contrast"}
676
+ (dest / "status.json").write_text(json.dumps(status, indent=2) + "\n")
677
+ require_corrected_deg(status["disease_deg"])
678
+
679
+
680
+ def main(argv: list[str] | None = None) -> int:
681
+ p = argparse.ArgumentParser(description=__doc__)
682
+ p.add_argument("--support-manifest", type=Path, required=True)
683
+ p.add_argument("--out", type=Path, required=True)
684
+ p.add_argument("--arm", action="append", default=[])
685
+ p.add_argument("--action", choices=("score", "extras", "contrast", "stats", "all"), required=True)
686
+ p.add_argument("--reference", type=Path)
687
+ p.add_argument("--annot", type=Path)
688
+ p.add_argument("--condition", action="append", default=[])
689
+ p.add_argument("--reuse-labels", type=Path)
690
+ p.add_argument("--pseudobulk-table", type=Path)
691
+ p.add_argument("--draw-long", type=Path, action="append", default=[],
692
+ help="other strict draw statistics/per_donor_long.csv files to cluster jointly")
693
+ p.add_argument("--baseline")
694
+ p.add_argument("--allow-no-receipt", action="store_true")
695
+ p.add_argument("--threads", type=int, default=4)
696
+ a = p.parse_args(argv)
697
+ if not 1 <= a.threads <= 8:
698
+ p.error("--threads must be 1..8")
699
+ support = read_support(a.support_manifest)
700
+ out = safe_out(a.out)
701
+ arms = _arms(a.arm)
702
+ out.mkdir(parents=True, exist_ok=True)
703
+ for action in (("score", "extras", "contrast", "stats") if a.action == "all" else (a.action,)):
704
+ if action == "score":
705
+ _call_score(support, out, arms, a)
706
+ elif action in ("extras", "contrast"):
707
+ _call_extra(action, support, out, arms, a.threads)
708
+ else:
709
+ _call_stats(support, out, arms, a)
710
+ return 0
711
+
712
+
713
+ if __name__ == "__main__":
714
+ raise SystemExit(main())
paper-releases/pbisc-diffusion/updates/20261012T130738Z-strictpairs-implementation/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/archive/20261012T130738Z-strictpairs-implementation/snapshot/backups/ye2026_sepsis_initial_support_20261012/disease/draw0/support.json ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "pbisc.paper.strict-support.v1",
3
+ "cohort": "ye2026_sepsis",
4
+ "design": "disease_existing_draw",
5
+ "unit": "draw0_n5",
6
+ "n_pairs": 5,
7
+ "train_sample_ids": [
8
+ "HC07",
9
+ "Abd-S66",
10
+ "Res-S150",
11
+ "Skin-S74",
12
+ "Res-S77"
13
+ ],
14
+ "train_donor_ids": [
15
+ "HC07",
16
+ "Abd-S66",
17
+ "Res-S150",
18
+ "Skin-S74",
19
+ "Res-S77"
20
+ ],
21
+ "test_sample_ids": [
22
+ "Abd-PS04",
23
+ "Abd-PS05",
24
+ "Abd-PS07",
25
+ "Abd-PS19",
26
+ "Abd-PS20",
27
+ "Abd-PS23",
28
+ "Abd-PS27",
29
+ "Abd-S102",
30
+ "Abd-S103",
31
+ "Abd-S120",
32
+ "Abd-S123",
33
+ "Abd-S156",
34
+ "Abd-S39",
35
+ "Abd-S42",
36
+ "Abd-S47",
37
+ "Abd-S51",
38
+ "Abd-S54",
39
+ "Abd-S57",
40
+ "Abd-S79",
41
+ "Abd-S83",
42
+ "Abd-S98",
43
+ "HC01",
44
+ "HC05",
45
+ "HC09",
46
+ "HC12",
47
+ "HC13",
48
+ "HC16",
49
+ "IC10",
50
+ "IC15",
51
+ "IC16",
52
+ "IC19",
53
+ "IC22",
54
+ "IC23",
55
+ "PHC01",
56
+ "PHC02",
57
+ "PHC03",
58
+ "PHC05",
59
+ "PIC01",
60
+ "PIC02",
61
+ "PIC04",
62
+ "PIC05",
63
+ "Res-PS02",
64
+ "Res-PS03",
65
+ "Res-PS12",
66
+ "Res-PS16",
67
+ "Res-PS21",
68
+ "Res-PS22",
69
+ "Res-PS25",
70
+ "Res-PS26",
71
+ "Res-S10",
72
+ "Res-S125",
73
+ "Res-S127",
74
+ "Res-S136",
75
+ "Res-S139",
76
+ "Res-S146",
77
+ "Res-S149",
78
+ "Res-S164",
79
+ "Res-S166",
80
+ "Res-S174",
81
+ "Res-S177",
82
+ "Res-S184",
83
+ "Res-S19",
84
+ "Res-S26",
85
+ "Res-S40",
86
+ "Res-S87",
87
+ "Skin-S140",
88
+ "Skin-S142",
89
+ "Skin-S152",
90
+ "Skin-S38",
91
+ "Skin-S43",
92
+ "Skin-S46",
93
+ "Skin-S52",
94
+ "Uri-S134",
95
+ "Uri-S147",
96
+ "Uri-S157",
97
+ "Uri-S20",
98
+ "Uri-S93"
99
+ ],
100
+ "test_donor_ids": [
101
+ "Abd-PS04",
102
+ "Abd-PS05",
103
+ "Abd-PS07",
104
+ "Abd-PS19",
105
+ "Abd-PS20",
106
+ "Abd-PS23",
107
+ "Abd-PS27",
108
+ "Abd-S102",
109
+ "Abd-S103",
110
+ "Abd-S120",
111
+ "Abd-S123",
112
+ "Abd-S156",
113
+ "Abd-S39",
114
+ "Abd-S42",
115
+ "Abd-S47",
116
+ "Abd-S51",
117
+ "Abd-S54",
118
+ "Abd-S57",
119
+ "Abd-S79",
120
+ "Abd-S83",
121
+ "Abd-S98",
122
+ "HC01",
123
+ "HC05",
124
+ "HC09",
125
+ "HC12",
126
+ "HC13",
127
+ "HC16",
128
+ "IC10",
129
+ "IC15",
130
+ "IC16",
131
+ "IC19",
132
+ "IC22",
133
+ "IC23",
134
+ "PHC01",
135
+ "PHC02",
136
+ "PHC03",
137
+ "PHC05",
138
+ "PIC01",
139
+ "PIC02",
140
+ "PIC04",
141
+ "PIC05",
142
+ "Res-PS02",
143
+ "Res-PS03",
144
+ "Res-PS12",
145
+ "Res-PS16",
146
+ "Res-PS21",
147
+ "Res-PS22",
148
+ "Res-PS25",
149
+ "Res-PS26",
150
+ "Res-S10",
151
+ "Res-S125",
152
+ "Res-S127",
153
+ "Res-S136",
154
+ "Res-S139",
155
+ "Res-S146",
156
+ "Res-S149",
157
+ "Res-S164",
158
+ "Res-S166",
159
+ "Res-S174",
160
+ "Res-S177",
161
+ "Res-S184",
162
+ "Res-S19",
163
+ "Res-S26",
164
+ "Res-S40",
165
+ "Res-S87",
166
+ "Skin-S140",
167
+ "Skin-S142",
168
+ "Skin-S152",
169
+ "Skin-S38",
170
+ "Skin-S43",
171
+ "Skin-S46",
172
+ "Skin-S52",
173
+ "Uri-S134",
174
+ "Uri-S147",
175
+ "Uri-S157",
176
+ "Uri-S20",
177
+ "Uri-S93"
178
+ ],
179
+ "excluded_sample_ids": [],
180
+ "seed": null,
181
+ "selection_audit": [
182
+ {
183
+ "donor_id": "HC07",
184
+ "assigned_stratum": false,
185
+ "selected_sample_id": "HC07",
186
+ "candidates": [
187
+ {
188
+ "sample_id": "HC07",
189
+ "time_value": 0.0,
190
+ "time_raw": "none (single sample per donor)",
191
+ "group": "adult_HC"
192
+ }
193
+ ]
194
+ },
195
+ {
196
+ "donor_id": "Abd-S66",
197
+ "assigned_stratum": true,
198
+ "selected_sample_id": "Abd-S66",
199
+ "candidates": [
200
+ {
201
+ "sample_id": "Abd-S66",
202
+ "time_value": 0.0,
203
+ "time_raw": "none (single sample per donor)",
204
+ "group": "adult_sepsis"
205
+ }
206
+ ]
207
+ },
208
+ {
209
+ "donor_id": "Res-S150",
210
+ "assigned_stratum": true,
211
+ "selected_sample_id": "Res-S150",
212
+ "candidates": [
213
+ {
214
+ "sample_id": "Res-S150",
215
+ "time_value": 0.0,
216
+ "time_raw": "none (single sample per donor)",
217
+ "group": "adult_sepsis"
218
+ }
219
+ ]
220
+ },
221
+ {
222
+ "donor_id": "Skin-S74",
223
+ "assigned_stratum": true,
224
+ "selected_sample_id": "Skin-S74",
225
+ "candidates": [
226
+ {
227
+ "sample_id": "Skin-S74",
228
+ "time_value": 0.0,
229
+ "time_raw": "none (single sample per donor)",
230
+ "group": "adult_sepsis"
231
+ }
232
+ ]
233
+ },
234
+ {
235
+ "donor_id": "Res-S77",
236
+ "assigned_stratum": true,
237
+ "selected_sample_id": "Res-S77",
238
+ "candidates": [
239
+ {
240
+ "sample_id": "Res-S77",
241
+ "time_value": 0.0,
242
+ "time_raw": "none (single sample per donor)",
243
+ "group": "adult_sepsis"
244
+ }
245
+ ]
246
+ }
247
+ ],
248
+ "sha256": "50001727b112845775b888f60d16814332810fdf4b70f2a099ff3846b479089e"
249
+ }
paper-releases/pbisc-diffusion/updates/20261012T130738Z-strictpairs-implementation/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/archive/20261012T130738Z-strictpairs-implementation/snapshot/backups/ye2026_sepsis_initial_support_20261012/disease/draw1/support.json ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "pbisc.paper.strict-support.v1",
3
+ "cohort": "ye2026_sepsis",
4
+ "design": "disease_existing_draw",
5
+ "unit": "draw1_n5",
6
+ "n_pairs": 5,
7
+ "train_sample_ids": [
8
+ "HC12",
9
+ "Uri-S134",
10
+ "Uri-S147",
11
+ "Res-S164",
12
+ "Res-S166"
13
+ ],
14
+ "train_donor_ids": [
15
+ "HC12",
16
+ "Uri-S134",
17
+ "Uri-S147",
18
+ "Res-S164",
19
+ "Res-S166"
20
+ ],
21
+ "test_sample_ids": [
22
+ "Abd-PS04",
23
+ "Abd-PS05",
24
+ "Abd-PS07",
25
+ "Abd-PS19",
26
+ "Abd-PS20",
27
+ "Abd-PS23",
28
+ "Abd-PS27",
29
+ "Abd-S102",
30
+ "Abd-S103",
31
+ "Abd-S120",
32
+ "Abd-S123",
33
+ "Abd-S156",
34
+ "Abd-S39",
35
+ "Abd-S42",
36
+ "Abd-S47",
37
+ "Abd-S51",
38
+ "Abd-S54",
39
+ "Abd-S57",
40
+ "Abd-S66",
41
+ "Abd-S79",
42
+ "Abd-S83",
43
+ "Abd-S98",
44
+ "HC01",
45
+ "HC05",
46
+ "HC07",
47
+ "HC09",
48
+ "HC13",
49
+ "HC16",
50
+ "IC10",
51
+ "IC15",
52
+ "IC16",
53
+ "IC19",
54
+ "IC22",
55
+ "IC23",
56
+ "PHC01",
57
+ "PHC02",
58
+ "PHC03",
59
+ "PHC05",
60
+ "PIC01",
61
+ "PIC02",
62
+ "PIC04",
63
+ "PIC05",
64
+ "Res-PS02",
65
+ "Res-PS03",
66
+ "Res-PS12",
67
+ "Res-PS16",
68
+ "Res-PS21",
69
+ "Res-PS22",
70
+ "Res-PS25",
71
+ "Res-PS26",
72
+ "Res-S10",
73
+ "Res-S125",
74
+ "Res-S127",
75
+ "Res-S136",
76
+ "Res-S139",
77
+ "Res-S146",
78
+ "Res-S149",
79
+ "Res-S150",
80
+ "Res-S174",
81
+ "Res-S177",
82
+ "Res-S184",
83
+ "Res-S19",
84
+ "Res-S26",
85
+ "Res-S40",
86
+ "Res-S77",
87
+ "Res-S87",
88
+ "Skin-S140",
89
+ "Skin-S142",
90
+ "Skin-S152",
91
+ "Skin-S38",
92
+ "Skin-S43",
93
+ "Skin-S46",
94
+ "Skin-S52",
95
+ "Skin-S74",
96
+ "Uri-S157",
97
+ "Uri-S20",
98
+ "Uri-S93"
99
+ ],
100
+ "test_donor_ids": [
101
+ "Abd-PS04",
102
+ "Abd-PS05",
103
+ "Abd-PS07",
104
+ "Abd-PS19",
105
+ "Abd-PS20",
106
+ "Abd-PS23",
107
+ "Abd-PS27",
108
+ "Abd-S102",
109
+ "Abd-S103",
110
+ "Abd-S120",
111
+ "Abd-S123",
112
+ "Abd-S156",
113
+ "Abd-S39",
114
+ "Abd-S42",
115
+ "Abd-S47",
116
+ "Abd-S51",
117
+ "Abd-S54",
118
+ "Abd-S57",
119
+ "Abd-S66",
120
+ "Abd-S79",
121
+ "Abd-S83",
122
+ "Abd-S98",
123
+ "HC01",
124
+ "HC05",
125
+ "HC07",
126
+ "HC09",
127
+ "HC13",
128
+ "HC16",
129
+ "IC10",
130
+ "IC15",
131
+ "IC16",
132
+ "IC19",
133
+ "IC22",
134
+ "IC23",
135
+ "PHC01",
136
+ "PHC02",
137
+ "PHC03",
138
+ "PHC05",
139
+ "PIC01",
140
+ "PIC02",
141
+ "PIC04",
142
+ "PIC05",
143
+ "Res-PS02",
144
+ "Res-PS03",
145
+ "Res-PS12",
146
+ "Res-PS16",
147
+ "Res-PS21",
148
+ "Res-PS22",
149
+ "Res-PS25",
150
+ "Res-PS26",
151
+ "Res-S10",
152
+ "Res-S125",
153
+ "Res-S127",
154
+ "Res-S136",
155
+ "Res-S139",
156
+ "Res-S146",
157
+ "Res-S149",
158
+ "Res-S150",
159
+ "Res-S174",
160
+ "Res-S177",
161
+ "Res-S184",
162
+ "Res-S19",
163
+ "Res-S26",
164
+ "Res-S40",
165
+ "Res-S77",
166
+ "Res-S87",
167
+ "Skin-S140",
168
+ "Skin-S142",
169
+ "Skin-S152",
170
+ "Skin-S38",
171
+ "Skin-S43",
172
+ "Skin-S46",
173
+ "Skin-S52",
174
+ "Skin-S74",
175
+ "Uri-S157",
176
+ "Uri-S20",
177
+ "Uri-S93"
178
+ ],
179
+ "excluded_sample_ids": [],
180
+ "seed": null,
181
+ "selection_audit": [
182
+ {
183
+ "donor_id": "HC12",
184
+ "assigned_stratum": false,
185
+ "selected_sample_id": "HC12",
186
+ "candidates": [
187
+ {
188
+ "sample_id": "HC12",
189
+ "time_value": 0.0,
190
+ "time_raw": "none (single sample per donor)",
191
+ "group": "adult_HC"
192
+ }
193
+ ]
194
+ },
195
+ {
196
+ "donor_id": "Uri-S134",
197
+ "assigned_stratum": true,
198
+ "selected_sample_id": "Uri-S134",
199
+ "candidates": [
200
+ {
201
+ "sample_id": "Uri-S134",
202
+ "time_value": 0.0,
203
+ "time_raw": "none (single sample per donor)",
204
+ "group": "adult_sepsis"
205
+ }
206
+ ]
207
+ },
208
+ {
209
+ "donor_id": "Uri-S147",
210
+ "assigned_stratum": true,
211
+ "selected_sample_id": "Uri-S147",
212
+ "candidates": [
213
+ {
214
+ "sample_id": "Uri-S147",
215
+ "time_value": 0.0,
216
+ "time_raw": "none (single sample per donor)",
217
+ "group": "adult_sepsis"
218
+ }
219
+ ]
220
+ },
221
+ {
222
+ "donor_id": "Res-S164",
223
+ "assigned_stratum": true,
224
+ "selected_sample_id": "Res-S164",
225
+ "candidates": [
226
+ {
227
+ "sample_id": "Res-S164",
228
+ "time_value": 0.0,
229
+ "time_raw": "none (single sample per donor)",
230
+ "group": "adult_sepsis"
231
+ }
232
+ ]
233
+ },
234
+ {
235
+ "donor_id": "Res-S166",
236
+ "assigned_stratum": true,
237
+ "selected_sample_id": "Res-S166",
238
+ "candidates": [
239
+ {
240
+ "sample_id": "Res-S166",
241
+ "time_value": 0.0,
242
+ "time_raw": "none (single sample per donor)",
243
+ "group": "adult_sepsis"
244
+ }
245
+ ]
246
+ }
247
+ ],
248
+ "sha256": "01f2ac75fba1c6d47daabd6b42f207f6920bd54c1ed463ed437e6fc7056e6a2a"
249
+ }