Archive 4 checkpoints (1-4)
Browse files- paper-releases/pbisc-diffusion/updates/20261013T023822Z-pbisc-yellow-scsemi-blue/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/data/method_palette_20261013/yellow_revision/before_palette.json +306 -0
- paper-releases/pbisc-diffusion/updates/20261013T023822Z-pbisc-yellow-scsemi-blue/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/data/method_palette_20261013/yellow_revision/before_results_review_style_plots.py +303 -0
- paper-releases/pbisc-diffusion/updates/20261013T023822Z-pbisc-yellow-scsemi-blue/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/figures/method_palette_20261013/secA_scsemi_readout.palette.json +93 -0
- paper-releases/pbisc-diffusion/updates/20261013T023822Z-pbisc-yellow-scsemi-blue/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/figures/method_palette_20261013/secA_scsemi_readout.png +3 -0
paper-releases/pbisc-diffusion/updates/20261013T023822Z-pbisc-yellow-scsemi-blue/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/data/method_palette_20261013/yellow_revision/before_palette.json
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema": "pbisc.method-palette.v1",
|
| 3 |
+
"user_directive": "PBISC red family, scSemiProfiler blue family throughout current results review",
|
| 4 |
+
"primary": {
|
| 5 |
+
"PBISC": "#B2182B",
|
| 6 |
+
"scSemiProfiler": "#2166AC"
|
| 7 |
+
},
|
| 8 |
+
"rules": {
|
| 9 |
+
"fig1b_overview_nature": {
|
| 10 |
+
"mapping": {
|
| 11 |
+
"#5B6E8F": "#B2182B",
|
| 12 |
+
"#E6EAF1": "#F8E8EB",
|
| 13 |
+
"#A5AFC1": "#D5808A",
|
| 14 |
+
"#8E6C9E": "#9E1B32"
|
| 15 |
+
},
|
| 16 |
+
"reason": "PBISC model blocks, model arrows and optional adaptation only; preserve expression, detection, bulk and cell-type encodings.",
|
| 17 |
+
"source_pdf": "/home/sj_server_1/PBISC/paper-release-20260928/manuscript/figures/fig01_architecture_nature.pdf"
|
| 18 |
+
},
|
| 19 |
+
"sec02_bulk_conditioning": {
|
| 20 |
+
"mapping": {},
|
| 21 |
+
"reason": "Orange denotes bulk-conditioning/context, not a method comparison; preserve semantic diagram colors."
|
| 22 |
+
},
|
| 23 |
+
"fig1d_corpus": {
|
| 24 |
+
"mapping": {},
|
| 25 |
+
"reason": "Cell types and cohort composition, not method colors."
|
| 26 |
+
},
|
| 27 |
+
"review_style_20261013_ablation": {
|
| 28 |
+
"mapping": {
|
| 29 |
+
"#D55E00": "#B2182B",
|
| 30 |
+
"#009E73": "#E57F88",
|
| 31 |
+
"#332288": "#7F0000",
|
| 32 |
+
"#0072B2": "#D96874",
|
| 33 |
+
"#A6CBE3": "#F1A6AE",
|
| 34 |
+
"#882255": "#8F2638"
|
| 35 |
+
},
|
| 36 |
+
"reason": "PBISC architecture and gene-panel variants; black real-R2 reference retained."
|
| 37 |
+
},
|
| 38 |
+
"sec03_panel": {
|
| 39 |
+
"mapping": {
|
| 40 |
+
"#D55E00": "#B2182B",
|
| 41 |
+
"#E69F00": "#2166AC",
|
| 42 |
+
"#0072B2": "#D96874",
|
| 43 |
+
"#A6CBE3": "#F1A6AE",
|
| 44 |
+
"#882255": "#8F2638"
|
| 45 |
+
},
|
| 46 |
+
"reason": "PBISC gene panels in red shades; scSemi reference line blue."
|
| 47 |
+
},
|
| 48 |
+
"review_style_20261013_rank": {
|
| 49 |
+
"mapping": {
|
| 50 |
+
"#E07B39": "#7F0000",
|
| 51 |
+
"#D55E00": "#B2182B"
|
| 52 |
+
},
|
| 53 |
+
"reason": "Full fine-tuning dark red and LoRA red; rank markers preserve their shapes."
|
| 54 |
+
},
|
| 55 |
+
"fig3_healthy_pairs": {
|
| 56 |
+
"mapping": {
|
| 57 |
+
"#D55E00": "#B2182B",
|
| 58 |
+
"#E69F00": "#2166AC",
|
| 59 |
+
"#A6CBE3": "#F1A6AE",
|
| 60 |
+
"#0072B2": "#D96874"
|
| 61 |
+
},
|
| 62 |
+
"reason": "PBISC and its raw/calibrated inputs in red shades; scSemi blue. Neutral reference/errorbar styles retained."
|
| 63 |
+
},
|
| 64 |
+
"fig3_healthy_fewpair": {
|
| 65 |
+
"mapping": {
|
| 66 |
+
"#D55E00": "#B2182B",
|
| 67 |
+
"#E69F00": "#2166AC",
|
| 68 |
+
"#A6CBE3": "#F1A6AE",
|
| 69 |
+
"#0072B2": "#D96874"
|
| 70 |
+
},
|
| 71 |
+
"reason": "PBISC and its raw/calibrated inputs in red shades; scSemi blue. Neutral reference/errorbar styles retained."
|
| 72 |
+
},
|
| 73 |
+
"fig3_healthy_copy": {
|
| 74 |
+
"mapping": {
|
| 75 |
+
"#D55E00": "#B2182B",
|
| 76 |
+
"#E69F00": "#2166AC",
|
| 77 |
+
"#A6CBE3": "#F1A6AE",
|
| 78 |
+
"#0072B2": "#D96874"
|
| 79 |
+
},
|
| 80 |
+
"reason": "PBISC and its raw/calibrated inputs in red shades; scSemi blue. Neutral reference/errorbar styles retained."
|
| 81 |
+
},
|
| 82 |
+
"fig2_healthy_pairs": {
|
| 83 |
+
"mapping": {
|
| 84 |
+
"#D55E00": "#B2182B",
|
| 85 |
+
"#E69F00": "#2166AC",
|
| 86 |
+
"#A6CBE3": "#F1A6AE",
|
| 87 |
+
"#0072B2": "#D96874"
|
| 88 |
+
},
|
| 89 |
+
"reason": "PBISC and its raw/calibrated inputs in red shades; scSemi blue. Neutral reference/errorbar styles retained."
|
| 90 |
+
},
|
| 91 |
+
"fig4_disease_fewpair": {
|
| 92 |
+
"mapping": {
|
| 93 |
+
"#D55E00": "#B2182B",
|
| 94 |
+
"#E69F00": "#2166AC",
|
| 95 |
+
"#A6CBE3": "#F1A6AE",
|
| 96 |
+
"#0072B2": "#D96874"
|
| 97 |
+
},
|
| 98 |
+
"reason": "PBISC and its raw/calibrated inputs in red shades; scSemi blue. Neutral reference/errorbar styles retained."
|
| 99 |
+
},
|
| 100 |
+
"sec09_fewpair_cells": {
|
| 101 |
+
"mapping": {
|
| 102 |
+
"#D55E00": "#B2182B",
|
| 103 |
+
"#E69F00": "#2166AC",
|
| 104 |
+
"#A6CBE3": "#F1A6AE",
|
| 105 |
+
"#0072B2": "#D96874"
|
| 106 |
+
},
|
| 107 |
+
"reason": "PBISC and its raw/calibrated inputs in red shades; scSemi blue. Neutral reference/errorbar styles retained."
|
| 108 |
+
},
|
| 109 |
+
"sec09_extra_ksens": {
|
| 110 |
+
"mapping": {
|
| 111 |
+
"#D55E00": "#B2182B",
|
| 112 |
+
"#E69F00": "#2166AC",
|
| 113 |
+
"#A6CBE3": "#F1A6AE",
|
| 114 |
+
"#0072B2": "#D96874"
|
| 115 |
+
},
|
| 116 |
+
"reason": "PBISC and its raw/calibrated inputs in red shades; scSemi blue. Neutral reference/errorbar styles retained."
|
| 117 |
+
},
|
| 118 |
+
"sec09_same_pairs": {
|
| 119 |
+
"mapping": {
|
| 120 |
+
"#D55E00": "#B2182B",
|
| 121 |
+
"#E69F00": "#2166AC",
|
| 122 |
+
"#A6CBE3": "#F1A6AE",
|
| 123 |
+
"#0072B2": "#D96874"
|
| 124 |
+
},
|
| 125 |
+
"reason": "PBISC and its raw/calibrated inputs in red shades; scSemi blue. Neutral reference/errorbar styles retained."
|
| 126 |
+
},
|
| 127 |
+
"sec04_sle_benchmark": {
|
| 128 |
+
"mapping": {
|
| 129 |
+
"#D55E00": "#B2182B",
|
| 130 |
+
"#E69F00": "#2166AC",
|
| 131 |
+
"#A6CBE3": "#F1A6AE",
|
| 132 |
+
"#0072B2": "#D96874"
|
| 133 |
+
},
|
| 134 |
+
"reason": "PBISC and its raw/calibrated inputs in red shades; scSemi blue. Neutral reference/errorbar styles retained."
|
| 135 |
+
},
|
| 136 |
+
"review_style_20261013_healthy_composition": {
|
| 137 |
+
"mapping": {
|
| 138 |
+
"#D55E00": "#B2182B",
|
| 139 |
+
"#0072B2": "#2166AC"
|
| 140 |
+
},
|
| 141 |
+
"reason": "Two-method paired comparison; this asset already used blue for scSemi."
|
| 142 |
+
},
|
| 143 |
+
"sec05_condition_space": {
|
| 144 |
+
"mapping": {},
|
| 145 |
+
"reason": "Input-space diagnostic: measured/shift-corrected inputs, no method comparison."
|
| 146 |
+
},
|
| 147 |
+
"sec09_time_to_apply": {
|
| 148 |
+
"mapping": {
|
| 149 |
+
"#D55E00": "#B2182B",
|
| 150 |
+
"#E69F00": "#2166AC",
|
| 151 |
+
"#F2B48C": "#F1B4BC",
|
| 152 |
+
"#F5D08A": "#67A9CF"
|
| 153 |
+
},
|
| 154 |
+
"reason": "PBISC adaptation/generation red shades; scSemi training/inference blue shades."
|
| 155 |
+
},
|
| 156 |
+
"sec09_cohorts": {
|
| 157 |
+
"mapping": {},
|
| 158 |
+
"reason": "Cohort metadata table, no method colors."
|
| 159 |
+
},
|
| 160 |
+
"fig4_disease_fivefold": {
|
| 161 |
+
"mapping": {
|
| 162 |
+
"#D55E00": "#B2182B",
|
| 163 |
+
"#E69F00": "#2166AC",
|
| 164 |
+
"#A6CBE3": "#F1A6AE",
|
| 165 |
+
"#0072B2": "#D96874",
|
| 166 |
+
"#CC79A7": "#8F4666"
|
| 167 |
+
},
|
| 168 |
+
"reason": "PBISC LoRA, zero-shot/calibrated and sc-only fine-tuning red family; scSemi blue."
|
| 169 |
+
},
|
| 170 |
+
"sec09_cat_curves": {
|
| 171 |
+
"mapping": {
|
| 172 |
+
"#D55E00": "#B2182B",
|
| 173 |
+
"#E69F00": "#2166AC",
|
| 174 |
+
"#A6CBE3": "#F1A6AE",
|
| 175 |
+
"#0072B2": "#D96874",
|
| 176 |
+
"#CC79A7": "#8F4666"
|
| 177 |
+
},
|
| 178 |
+
"reason": "PBISC LoRA, zero-shot/calibrated and sc-only fine-tuning red family; scSemi blue."
|
| 179 |
+
},
|
| 180 |
+
"secS_deconv_disease": {
|
| 181 |
+
"mapping": {
|
| 182 |
+
"#D55E00": "#B2182B",
|
| 183 |
+
"#E69F00": "#2166AC",
|
| 184 |
+
"#CC79A7": "#6A51A3"
|
| 185 |
+
},
|
| 186 |
+
"reason": "PBISC red, scSemi blue where present; CIBERSORTx purple and BayesPrism green."
|
| 187 |
+
},
|
| 188 |
+
"secS_deconv_composition": {
|
| 189 |
+
"mapping": {
|
| 190 |
+
"#D55E00": "#B2182B",
|
| 191 |
+
"#E69F00": "#2166AC",
|
| 192 |
+
"#CC79A7": "#6A51A3"
|
| 193 |
+
},
|
| 194 |
+
"reason": "PBISC red, scSemi blue where present; CIBERSORTx purple and BayesPrism green."
|
| 195 |
+
},
|
| 196 |
+
"review_style_20261013_rare_observed": {
|
| 197 |
+
"mapping": {},
|
| 198 |
+
"reason": "Observed-frequency heatmap encodes abundance, not a method."
|
| 199 |
+
},
|
| 200 |
+
"review_style_20261013_rare_corrected_comparison": {
|
| 201 |
+
"mapping": {},
|
| 202 |
+
"reason": "Points encode cohorts; x/y axes explicitly name methods. Preserve cohort color legend."
|
| 203 |
+
},
|
| 204 |
+
"review_style_20261013_behcet": {
|
| 205 |
+
"mapping": {
|
| 206 |
+
"#0072B2": "#D96874",
|
| 207 |
+
"#D55E00": "#B2182B"
|
| 208 |
+
},
|
| 209 |
+
"reason": "PBISC raw/calibrated and LoRA predictions in red family; observed native/depth-matched references black."
|
| 210 |
+
},
|
| 211 |
+
"sec05_cells_umap": {
|
| 212 |
+
"mapping": {},
|
| 213 |
+
"reason": "UMAP points and legend encode cell types. Preserve images and biological labels."
|
| 214 |
+
},
|
| 215 |
+
"sec05_cells_metrics": {
|
| 216 |
+
"mapping": {
|
| 217 |
+
"#A6CBE3": "#F1A6AE",
|
| 218 |
+
"#5E8FB5": "#D96874"
|
| 219 |
+
},
|
| 220 |
+
"reason": "Raw-bulk and pseudobulk-input PBISC reconstructions red; observed real cells grey. Scope black replacement to four verified rectangles only.",
|
| 221 |
+
"rectangle_rules": [
|
| 222 |
+
{
|
| 223 |
+
"rect": [
|
| 224 |
+
66.389,
|
| 225 |
+
247.078,
|
| 226 |
+
91.925,
|
| 227 |
+
361.296
|
| 228 |
+
],
|
| 229 |
+
"old": "#1A1A1A",
|
| 230 |
+
"new": "#B2182B"
|
| 231 |
+
},
|
| 232 |
+
{
|
| 233 |
+
"rect": [
|
| 234 |
+
207.736,
|
| 235 |
+
98.028,
|
| 236 |
+
233.272,
|
| 237 |
+
361.296
|
| 238 |
+
],
|
| 239 |
+
"old": "#1A1A1A",
|
| 240 |
+
"new": "#B2182B"
|
| 241 |
+
},
|
| 242 |
+
{
|
| 243 |
+
"rect": [
|
| 244 |
+
349.082,
|
| 245 |
+
217.017,
|
| 246 |
+
374.618,
|
| 247 |
+
361.296
|
| 248 |
+
],
|
| 249 |
+
"old": "#1A1A1A",
|
| 250 |
+
"new": "#B2182B"
|
| 251 |
+
},
|
| 252 |
+
{
|
| 253 |
+
"rect": [
|
| 254 |
+
172.368,
|
| 255 |
+
8.734,
|
| 256 |
+
185.568,
|
| 257 |
+
17.134
|
| 258 |
+
],
|
| 259 |
+
"old": "#1A1A1A",
|
| 260 |
+
"new": "#B2182B"
|
| 261 |
+
}
|
| 262 |
+
]
|
| 263 |
+
},
|
| 264 |
+
"sec08_cross_cohort": {
|
| 265 |
+
"mapping": {
|
| 266 |
+
"#A6CBE3": "#F1A6AE",
|
| 267 |
+
"#0072B2": "#D96874",
|
| 268 |
+
"#44AA99": "#E57F88",
|
| 269 |
+
"#117733": "#8F2638",
|
| 270 |
+
"#332288": "#5F0F24",
|
| 271 |
+
"#D55E00": "#B2182B"
|
| 272 |
+
},
|
| 273 |
+
"reason": "All PBISC adaptation/cohort variants in distinct red shades; existing line styles preserved."
|
| 274 |
+
},
|
| 275 |
+
"sec08_cross_cohort_steps": {
|
| 276 |
+
"mapping": {
|
| 277 |
+
"#A6CBE3": "#F1A6AE",
|
| 278 |
+
"#0072B2": "#D96874",
|
| 279 |
+
"#44AA99": "#E57F88",
|
| 280 |
+
"#117733": "#8F2638",
|
| 281 |
+
"#332288": "#5F0F24",
|
| 282 |
+
"#D55E00": "#B2182B"
|
| 283 |
+
},
|
| 284 |
+
"reason": "All PBISC adaptation/cohort variants in distinct red shades; existing line styles preserved."
|
| 285 |
+
},
|
| 286 |
+
"sec07_no_pretraining": {
|
| 287 |
+
"mapping": {
|
| 288 |
+
"#D55E00": "#B2182B",
|
| 289 |
+
"#882255": "#7F0000",
|
| 290 |
+
"#0072B2": "#D96874"
|
| 291 |
+
},
|
| 292 |
+
"reason": "Pretrained LoRA red, same-architecture scratch ablation dark red, zero-shot rose."
|
| 293 |
+
},
|
| 294 |
+
"secA_scsemi_readout": {
|
| 295 |
+
"mapping": {
|
| 296 |
+
"#D55E00": "#B2182B",
|
| 297 |
+
"#E69F00": "#2166AC",
|
| 298 |
+
"#F5D08A": "#67A9CF"
|
| 299 |
+
},
|
| 300 |
+
"reason": "PBISC red; official scSemi blue and modified readout pale blue with original hatch."
|
| 301 |
+
}
|
| 302 |
+
},
|
| 303 |
+
"reference_policy": "Biological/cohort colors and neutral observed/oracle diagnostic references are separate encodings, not model identity.",
|
| 304 |
+
"unused_fill_policy": "Matplotlib #1F77B4 fill on neutral errorbar caps is not painted; preserve.",
|
| 305 |
+
"preserve_geometry_text_data": true
|
| 306 |
+
}
|
paper-releases/pbisc-diffusion/updates/20261013T023822Z-pbisc-yellow-scsemi-blue/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/data/method_palette_20261013/yellow_revision/before_results_review_style_plots.py
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Restyle three saved-table review figures with the original deck's visual style.
|
| 2 |
+
|
| 3 |
+
CPU plotting only. Healthy composition uses paired absolute errors before averaging held-out draws.
|
| 4 |
+
Rare-state estimates are preserved. Only saved CSVs are read; no new experiment.
|
| 5 |
+
build() returns ordered PDF paths, all export paths and source provenance.
|
| 6 |
+
"""
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
+
import hashlib
|
| 10 |
+
import json
|
| 11 |
+
import os
|
| 12 |
+
from pathlib import Path
|
| 13 |
+
|
| 14 |
+
os.environ["CUDA_VISIBLE_DEVICES"] = ""
|
| 15 |
+
|
| 16 |
+
import numpy as np
|
| 17 |
+
import pandas as pd
|
| 18 |
+
import style as ST
|
| 19 |
+
import matplotlib.pyplot as plt
|
| 20 |
+
from matplotlib.lines import Line2D
|
| 21 |
+
from matplotlib.patches import Patch
|
| 22 |
+
from matplotlib.ticker import MaxNLocator
|
| 23 |
+
|
| 24 |
+
D = Path(__file__).resolve().parents[1]
|
| 25 |
+
M = D.parents[1]
|
| 26 |
+
P = M / "plans/paper_figures_strictpairs_20261012"
|
| 27 |
+
O = M / "plans/paired_finetune_intradataset_20260927"
|
| 28 |
+
FIG = D / "figures"
|
| 29 |
+
STEM = "review_style_20261013_"
|
| 30 |
+
|
| 31 |
+
TYPES = ["T cell", "B cell", "Monocyte", "NK cell", "DC", "Other"]
|
| 32 |
+
# These are cell-type colours from the saved-table review, not method colours.
|
| 33 |
+
TYPE_COLORS = ["#56B4E9", "#E69F00", "#009E73", "#CC79A7", "#0072B2", "#B1B7BE"]
|
| 34 |
+
COHORTS = ["ye2026_sepsis", "imperial_eskd", "giroux2022", "ji2025_chili"]
|
| 35 |
+
COHORT_NAMES = ["Sepsis", "Imperial", "Giroux", "Ji"]
|
| 36 |
+
# Identical to the original deck's tools/fig5_rare_states.py COH mapping.
|
| 37 |
+
COHORT_COLORS = {"ye2026_sepsis": "#CC79A7", "imperial_eskd": "#0072B2",
|
| 38 |
+
"giroux2022": "#009E73", "ji2025_chili": "#E69F00"}
|
| 39 |
+
STATE_LABELS = {
|
| 40 |
+
"C1Q-high monocyte (reference)": "C1Q-high monocyte",
|
| 41 |
+
"Cycling activated T (CD38/HLA-DR)": "Cycling activated T",
|
| 42 |
+
"Cycling monocyte (Ye 2026)": "Cycling monocyte",
|
| 43 |
+
"ISG-high monocyte (positive control)": "ISG-high monocyte (+ control)",
|
| 44 |
+
"Platelet signal in monocytes (negative control)": "Platelet signal in mono (− control)",
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def _source(path: Path, role: str, inputs: dict[str, dict]) -> Path:
|
| 49 |
+
path = path.resolve()
|
| 50 |
+
with path.open("rb") as stream:
|
| 51 |
+
digest = hashlib.file_digest(stream, "sha256").hexdigest()
|
| 52 |
+
inputs[str(path)] = {"path": str(path), "sha256": digest, "role": role}
|
| 53 |
+
return path
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def _save(fig, name: str, assets: list[str]) -> str:
|
| 57 |
+
"""Use the deck's on-slide sizes/fonts; export the same artwork in three formats."""
|
| 58 |
+
for ext in ("png", "pdf", "svg"):
|
| 59 |
+
path = FIG / f"{STEM}{name}.{ext}"
|
| 60 |
+
fig.savefig(path, dpi=ST.DPI, facecolor="white", bbox_inches="tight", pad_inches=0.05)
|
| 61 |
+
assets.append(str(path))
|
| 62 |
+
plt.close(fig)
|
| 63 |
+
return str(FIG / f"{STEM}{name}.pdf")
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def _healthy(inputs: dict[str, dict], assets: list[str]) -> tuple[str, dict]:
|
| 67 |
+
frames = []
|
| 68 |
+
for draw in range(5):
|
| 69 |
+
for folder in (f"draw{draw}", f"draw{draw}_scsemi5"):
|
| 70 |
+
path = _source(O / "scores/immicro/fewshot_n5" / folder / "per_donor.csv",
|
| 71 |
+
"existing healthy per-donor scores", inputs)
|
| 72 |
+
frame = pd.read_csv(path)
|
| 73 |
+
frame["draw"] = draw
|
| 74 |
+
frames.append(frame)
|
| 75 |
+
table = pd.concat(frames, ignore_index=True)
|
| 76 |
+
order = ["zs_raw", "zs_cal", "scsemi5", "lora5"]
|
| 77 |
+
table = table[table.arm.isin(order)].copy()
|
| 78 |
+
assert table.groupby("arm").size().to_dict() == {arm: 510 for arm in order}
|
| 79 |
+
assert not table.duplicated(["arm", "draw", "donor"]).any()
|
| 80 |
+
keys = {arm: set(map(tuple, table[table.arm == arm][["draw", "donor"]].to_numpy())) for arm in order}
|
| 81 |
+
assert all(keys[arm] == keys["lora5"] for arm in order)
|
| 82 |
+
observed = table[table.arm == "lora5"].set_index(["draw", "donor"])[[f"obs_{c}" for c in TYPES]].sort_index()
|
| 83 |
+
for arm in order:
|
| 84 |
+
got = table[table.arm == arm].set_index(["draw", "donor"])[observed.columns].sort_index()
|
| 85 |
+
assert np.allclose(got.to_numpy(), observed.to_numpy(), atol=1e-12, rtol=0)
|
| 86 |
+
# Identical descriptive estimator: first average held-out draws within each
|
| 87 |
+
# donor, then average donors. Every scatter point is the same donor mean.
|
| 88 |
+
grouped = table.groupby(["arm", "donor"])[[f"{pre}_{c}" for pre in ("obs", "gen") for c in TYPES]].mean()
|
| 89 |
+
observed_values = grouped.loc["lora5"][[f"obs_{c}" for c in TYPES]].mean().to_numpy()
|
| 90 |
+
values = np.vstack([observed_values] + [grouped.loc[arm][[f"gen_{c}" for c in TYPES]].mean().to_numpy()
|
| 91 |
+
for arm in order])
|
| 92 |
+
assert np.allclose(values.sum(1), 1, atol=1e-8)
|
| 93 |
+
|
| 94 |
+
# Compare errors before averaging repeated draws; averaging signed errors
|
| 95 |
+
# first can cancel mistakes. Donors, not donor-draw rows, receive equal weight.
|
| 96 |
+
errors = {}
|
| 97 |
+
for arm in ("lora5", "scsemi5"):
|
| 98 |
+
rows = table[table.arm == arm].set_index(["draw", "donor"]).sort_index()
|
| 99 |
+
err = pd.DataFrame({typ: 100 * (rows[f"gen_{typ}"] - rows[f"obs_{typ}"]).abs()
|
| 100 |
+
for typ in TYPES}, index=rows.index)
|
| 101 |
+
assert np.allclose(err.sum(axis=1) / 100, rows["comp_l1"], atol=1e-12, rtol=0)
|
| 102 |
+
errors[arm] = err.groupby(level="donor").mean().sort_index()
|
| 103 |
+
assert errors["lora5"].index.equals(errors["scsemi5"].index)
|
| 104 |
+
assert len(errors["lora5"]) == 107
|
| 105 |
+
assert all(np.isfinite(x.to_numpy()).all() for x in errors.values())
|
| 106 |
+
delta = errors["scsemi5"] - errors["lora5"]
|
| 107 |
+
tolerance = 1e-10
|
| 108 |
+
wins = (delta > tolerance).sum()
|
| 109 |
+
losses = (delta < -tolerance).sum()
|
| 110 |
+
ties = (delta.abs() <= tolerance).sum()
|
| 111 |
+
assert ((wins + losses + ties) == 107).all()
|
| 112 |
+
means = {arm: data.mean() for arm, data in errors.items()}
|
| 113 |
+
totals = {arm: data.sum(axis=1) / 100 for arm, data in errors.items()}
|
| 114 |
+
total_delta = totals["scsemi5"] - totals["lora5"]
|
| 115 |
+
overall_wins = int((total_delta > tolerance / 100).sum())
|
| 116 |
+
reduction = 100 * (1 - totals["lora5"].mean() / totals["scsemi5"].mean())
|
| 117 |
+
summary = pd.DataFrame({"cell_type": TYPES,
|
| 118 |
+
"pbisc_mae_pp": means["lora5"].to_numpy(),
|
| 119 |
+
"scsemi_mae_pp": means["scsemi5"].to_numpy(),
|
| 120 |
+
"scsemi_minus_pbisc_pp": delta.mean().to_numpy(),
|
| 121 |
+
"pbisc_wins": wins.to_numpy(), "scsemi_wins": losses.to_numpy(),
|
| 122 |
+
"ties": ties.to_numpy(), "donors": 107})
|
| 123 |
+
rows = []
|
| 124 |
+
for donor in errors["lora5"].index:
|
| 125 |
+
for typ in TYPES:
|
| 126 |
+
rows.append({"donor": donor, "cell_type": typ,
|
| 127 |
+
"pbisc_mae_pp": errors["lora5"].loc[donor,typ],
|
| 128 |
+
"scsemi_mae_pp": errors["scsemi5"].loc[donor,typ],
|
| 129 |
+
"scsemi_minus_pbisc_pp": delta.loc[donor,typ]})
|
| 130 |
+
audit = D / "data/composition_error_20261013"
|
| 131 |
+
audit.mkdir(exist_ok=True)
|
| 132 |
+
summary.to_csv(audit/"cell_type_summary.csv",index=False)
|
| 133 |
+
pd.DataFrame(rows).to_csv(audit/"paired_donor_errors.csv",index=False)
|
| 134 |
+
_source(audit/"cell_type_summary.csv", "derived donor-weighted absolute-error summary", inputs)
|
| 135 |
+
_source(audit/"paired_donor_errors.csv", "derived paired donor errors; repeated draws averaged within donor", inputs)
|
| 136 |
+
|
| 137 |
+
# High contrast is deliberate for this two-method comparison; other slides'
|
| 138 |
+
# palettes are preserved. Separate bars + labels carry the result, not colour alone.
|
| 139 |
+
colors = {"lora5": ST.ARM["lora"], "scsemi5": "#0072B2"}
|
| 140 |
+
labels = ["T cells", "B cells", "Monocytes", "NK cells", "DC", "Other"]
|
| 141 |
+
fig, axes = plt.subplots(1, 2, figsize=ST.FULL,
|
| 142 |
+
gridspec_kw={"width_ratios": [1.15, 1], "wspace": 0.43})
|
| 143 |
+
fig.subplots_adjust(left=0.10, right=0.98, bottom=0.15, top=0.70)
|
| 144 |
+
fig.text(0.10,0.975,
|
| 145 |
+
f"Overall composition L1: {totals['lora5'].mean():.3f} vs {totals['scsemi5'].mean():.3f}",
|
| 146 |
+
fontsize=17,weight="bold",ha="left",va="top",color=ST.INK)
|
| 147 |
+
fig.text(0.10,0.895,
|
| 148 |
+
f"PBISC: {reduction:.1f}% lower mean error; closer in {overall_wins}/107 donors",
|
| 149 |
+
fontsize=14,ha="left",va="top",color=ST.INK)
|
| 150 |
+
fig.legend([Patch(facecolor=colors[a]) for a in ("lora5","scsemi5")],
|
| 151 |
+
["PBISC LoRA", "scSemiProfiler"], loc="upper right",bbox_to_anchor=(0.99,1.005),
|
| 152 |
+
ncol=1,fontsize=12,handlelength=1.1,handletextpad=0.55)
|
| 153 |
+
y = np.arange(len(TYPES)); height=0.29
|
| 154 |
+
for offset,arm in [(-0.17,"lora5"),(0.17,"scsemi5")]:
|
| 155 |
+
v=means[arm].to_numpy()
|
| 156 |
+
axes[0].barh(y+offset,v,height=height,color=colors[arm],zorder=3)
|
| 157 |
+
for yy,value in zip(y+offset,v):
|
| 158 |
+
axes[0].text(value+0.10,yy,f"{value:.2f}",va="center",ha="left",fontsize=11,color=ST.INK)
|
| 159 |
+
axes[0].set(yticks=y,yticklabels=labels,xlim=(0,8.05),xlabel="Mean absolute error (percentage points)")
|
| 160 |
+
axes[0].set_title("Error by cell type ↓",loc="left",fontsize=14,pad=13)
|
| 161 |
+
axes[0].set_xticks([0,2,4,6,8]);axes[0].invert_yaxis()
|
| 162 |
+
axes[0].grid(axis="x",color="#E9E9E9",linewidth=.7,zorder=0)
|
| 163 |
+
for ax in axes:
|
| 164 |
+
ax.tick_params(axis="y",length=0,pad=8,labelsize=12)
|
| 165 |
+
ax.spines["left"].set_visible(False)
|
| 166 |
+
width=wins.to_numpy()/107*100
|
| 167 |
+
tied=ties.to_numpy()/107*100
|
| 168 |
+
other=losses.to_numpy()/107*100
|
| 169 |
+
axes[1].barh(y,width,height=.62,color=colors["lora5"],zorder=2)
|
| 170 |
+
axes[1].barh(y,tied,left=width,height=.62,color="#AAAAAA",zorder=2)
|
| 171 |
+
axes[1].barh(y,other,left=width+tied,height=.62,color=colors["scsemi5"],zorder=2)
|
| 172 |
+
for i,(nw,nl,nt) in enumerate(zip(wins,losses,ties)):
|
| 173 |
+
# Counts identify small segments without shrinking their text.
|
| 174 |
+
axes[1].text(width[i]/2,i,str(nw),ha="center",va="center",color="white",fontsize=12,weight="bold")
|
| 175 |
+
axes[1].text(width[i]+tied[i]+other[i]/2,i,str(nl),ha="center",va="center",color="white",fontsize=12,weight="bold")
|
| 176 |
+
if nt:
|
| 177 |
+
axes[1].text(101,i,f"{nt} tie",ha="left",va="center",fontsize=10)
|
| 178 |
+
axes[1].axvline(50,color=ST.INK,linestyle=(0,(3,3)),linewidth=.8,zorder=1)
|
| 179 |
+
axes[1].set(yticks=y,yticklabels=labels,xlim=(0,100),xlabel="Donors with lower error (%)")
|
| 180 |
+
axes[1].set_title("Which method is closer?",loc="left",fontsize=14,pad=13)
|
| 181 |
+
axes[1].set_xticks([0,25,50,75,100]);axes[1].invert_yaxis()
|
| 182 |
+
fig.text(.10,.012,"Absolute error per draw, then averaged within donor. Equal donor weights; descriptive comparison.",
|
| 183 |
+
fontsize=10.5,color=ST.SUBINK,ha="left")
|
| 184 |
+
fig.text(.98,.805,"Numbers in bars = donors (n = 107)",fontsize=11,color=ST.SUBINK,ha="right")
|
| 185 |
+
return _save(fig, "healthy_composition", assets), {
|
| 186 |
+
"estimator": "100*abs(generated-observed) per donor-draw; average held-out draws within donor; equal donor weight",
|
| 187 |
+
"comparison": "paired errors, not error after averaging proportions",
|
| 188 |
+
"rows_per_arm":510,"donors":107,"cell_types":TYPES,
|
| 189 |
+
"summary":summary.to_dict(orient="records"),
|
| 190 |
+
"composition_l1":{arm:float(data.mean()) for arm,data in totals.items()},
|
| 191 |
+
"overall_pbisc_win_donors":overall_wins,"relative_l1_reduction_percent":float(reduction),
|
| 192 |
+
"tie_tolerance_pp":tolerance,"method_colors":{"PBISC LoRA":colors["lora5"],"scSemiProfiler":colors["scsemi5"]},
|
| 193 |
+
"unchanged_mean_composition_fractions":values.tolist(),
|
| 194 |
+
"raw_predictions_changed":False,"derived_summary_changed":True,
|
| 195 |
+
"inference":"descriptive only; overlapping support draws are not independent training replicates"}
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
def _rare_observed(inputs: dict[str, dict], assets: list[str]) -> tuple[str, dict]:
|
| 199 |
+
path = _source(P / "source_data/rare_all_states.csv", "existing corrected rare-state summaries", inputs)
|
| 200 |
+
table = pd.read_csv(path)
|
| 201 |
+
assert set(table.evidence_tier) == {"diagnostic"} and set(table.design) == {"legacy_5donor"}
|
| 202 |
+
states = list(dict.fromkeys(table.state))
|
| 203 |
+
values = table[table.arm == "lora5"].groupby(["state", "cohort"]).obs_pct.median().unstack().reindex(
|
| 204 |
+
index=states, columns=COHORTS)
|
| 205 |
+
fig, ax = plt.subplots(figsize=ST.FULL)
|
| 206 |
+
fig.subplots_adjust(left=0.305, right=0.87, bottom=0.09, top=0.95)
|
| 207 |
+
cmap = plt.get_cmap("YlGnBu").copy()
|
| 208 |
+
cmap.set_bad("#F2F2F2")
|
| 209 |
+
image = ax.imshow(values.to_numpy(), cmap=cmap, aspect="auto", vmin=0,
|
| 210 |
+
vmax=np.nanmax(values.to_numpy()), interpolation="nearest")
|
| 211 |
+
ax.set_xticks(range(4), COHORT_NAMES)
|
| 212 |
+
ax.set_yticks(range(len(states)), [STATE_LABELS.get(state, state) for state in states])
|
| 213 |
+
ax.xaxis.tick_top()
|
| 214 |
+
ax.tick_params(axis="both", length=0, pad=8, labelsize=ST.FS - 2)
|
| 215 |
+
ax.set_xticks(np.arange(-0.5, 4, 1), minor=True)
|
| 216 |
+
ax.set_yticks(np.arange(-0.5, len(states), 1), minor=True)
|
| 217 |
+
ax.grid(which="minor", color="white", linewidth=1.4)
|
| 218 |
+
ax.tick_params(which="minor", length=0)
|
| 219 |
+
for spine in ax.spines.values():
|
| 220 |
+
spine.set_visible(False)
|
| 221 |
+
for i, state in enumerate(states):
|
| 222 |
+
for j, cohort in enumerate(COHORTS):
|
| 223 |
+
value = values.iloc[i, j]
|
| 224 |
+
rgb = image.cmap(image.norm(value))[:3] if pd.notna(value) else (1, 1, 1)
|
| 225 |
+
luminance = 0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]
|
| 226 |
+
ax.text(j, i, "NA" if pd.isna(value) else f"{value:.2g}", ha="center", va="center",
|
| 227 |
+
fontsize=ST.FS - 2, color="white" if luminance < 0.45 else ST.INK)
|
| 228 |
+
color_ax = fig.add_axes([0.895, 0.14, 0.018, 0.70])
|
| 229 |
+
bar = fig.colorbar(image, cax=color_ax)
|
| 230 |
+
bar.set_label("Observed share within parent (%)", fontsize=ST.FS - 1, labelpad=10)
|
| 231 |
+
bar.ax.tick_params(labelsize=ST.FS - 2)
|
| 232 |
+
bar.outline.set_visible(False)
|
| 233 |
+
return _save(fig, "rare_observed", assets), {
|
| 234 |
+
"estimator": "median obs_pct across draws from the lora5 observed reference; no additional state filtering",
|
| 235 |
+
"states": states, "display_labels": [STATE_LABELS.get(state, state) for state in states],
|
| 236 |
+
"cohorts": COHORTS, "state_cohort_combinations": int(values.notna().sum().sum()),
|
| 237 |
+
"percentages": [[None if pd.isna(v) else float(v) for v in row] for row in values.to_numpy()]}
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
def _rare_comparison(inputs: dict[str, dict], assets: list[str]) -> tuple[str, dict]:
|
| 241 |
+
path = _source(P / "source_data/rare_all_states_aggregate.csv", "existing zero-aware rare-state metrics", inputs)
|
| 242 |
+
table = pd.read_csv(path)
|
| 243 |
+
errors = table.pivot(index=["cohort", "state"], columns="arm", values="abundance_error")
|
| 244 |
+
ranks = table.pivot(index=["cohort", "state"], columns="arm", values="ranking")
|
| 245 |
+
assert len(errors) == 59
|
| 246 |
+
fig, axes = plt.subplots(1, 2, figsize=ST.FULL, gridspec_kw={"wspace": 0.34})
|
| 247 |
+
fig.subplots_adjust(left=0.085, right=0.975, bottom=0.20, top=0.88)
|
| 248 |
+
for cohort, label in zip(COHORTS, COHORT_NAMES):
|
| 249 |
+
for ax, data in zip(axes, (errors, ranks)):
|
| 250 |
+
points = data.loc[cohort]
|
| 251 |
+
ax.scatter(points.scsemi5, points.lora5, color=COHORT_COLORS[cohort], s=34,
|
| 252 |
+
edgecolor=ST.INK, linewidth=0.4, alpha=0.85, label=label, zorder=3)
|
| 253 |
+
limit = float(np.nanmax(errors[["scsemi5", "lora5"]].to_numpy())) * 1.05
|
| 254 |
+
axes[0].plot([0, limit], [0, limit], color=ST.GREY, linewidth=0.9, linestyle="--", zorder=1)
|
| 255 |
+
axes[0].set(xlim=(0, limit), ylim=(0, limit))
|
| 256 |
+
axes[0].xaxis.set_major_locator(MaxNLocator(nbins=5))
|
| 257 |
+
axes[0].yaxis.set_major_locator(MaxNLocator(nbins=5))
|
| 258 |
+
axes[0].set_title("Abundance error (pp)", loc="left", fontsize=ST.FS, pad=12)
|
| 259 |
+
axes[1].plot([-1, 1], [-1, 1], color=ST.GREY, linewidth=0.9, linestyle="--", zorder=1)
|
| 260 |
+
axes[1].set(xlim=(-1, 1), ylim=(-1, 1))
|
| 261 |
+
axes[1].set_xticks([-1, -0.5, 0, 0.5, 1]); axes[1].set_yticks([-1, -0.5, 0, 0.5, 1])
|
| 262 |
+
axes[1].set_title("Donor ranking (Spearman ρ)", loc="left", fontsize=ST.FS, pad=12)
|
| 263 |
+
for ax in axes:
|
| 264 |
+
ax.set_xlabel("scSemiProfiler", fontsize=ST.FS)
|
| 265 |
+
ax.set_ylabel("PBISC LoRA", fontsize=ST.FS)
|
| 266 |
+
ax.set_aspect("equal")
|
| 267 |
+
ax.grid(color="#EEEEEE", linewidth=0.7, zorder=0)
|
| 268 |
+
ax.tick_params(labelsize=ST.FS - 2)
|
| 269 |
+
handles = [Line2D([], [], linestyle="none", marker="o", color=COHORT_COLORS[cohort],
|
| 270 |
+
markeredgecolor=ST.INK, markeredgewidth=0.4, markersize=7) for cohort in COHORTS]
|
| 271 |
+
fig.legend(handles, COHORT_NAMES, loc="lower center", bbox_to_anchor=(0.53, 0.025), ncol=4,
|
| 272 |
+
fontsize=ST.FS - 2, columnspacing=1.9, handletextpad=0.4)
|
| 273 |
+
return _save(fig, "rare_corrected_comparison", assets), {
|
| 274 |
+
"estimator": "saved abundance_error and ranking columns; pivot only, no recomputation or imputation",
|
| 275 |
+
"state_cohort_combinations": len(errors), "cohort_colors": COHORT_COLORS,
|
| 276 |
+
"finite_abundance_pairs": int(np.isfinite(errors[["scsemi5", "lora5"]]).all(axis=1).sum()),
|
| 277 |
+
"finite_ranking_pairs": int(np.isfinite(ranks[["scsemi5", "lora5"]]).all(axis=1).sum())}
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
def build() -> dict:
|
| 281 |
+
"""Return figures=[composition, observed, comparison] PDFs plus exports/provenance."""
|
| 282 |
+
inputs: dict[str, dict] = {}
|
| 283 |
+
assets: list[str] = []
|
| 284 |
+
_source(Path(ST.__file__), "original 76-slide matplotlib style and method palette", inputs)
|
| 285 |
+
_source(D / "tools/fig5_rare_states.py", "original Fig. 5 cohort-colour mapping", inputs)
|
| 286 |
+
_source(Path(__file__), "saved-table figure restyling code", inputs)
|
| 287 |
+
# An importing deck builder may already have changed matplotlib defaults.
|
| 288 |
+
# Reapply the shared style's conventions locally without mutating style.py.
|
| 289 |
+
with plt.rc_context({"font.family": "sans-serif", "font.sans-serif": ["Arial", "Liberation Sans", "DejaVu Sans"],
|
| 290 |
+
"font.size": ST.FS, "axes.titlesize": ST.FS, "axes.labelsize": ST.FS,
|
| 291 |
+
"xtick.labelsize": ST.FS - 2, "ytick.labelsize": ST.FS - 2, "legend.fontsize": ST.FS - 2,
|
| 292 |
+
"axes.spines.top": False, "axes.spines.right": False, "axes.linewidth": 1.0,
|
| 293 |
+
"legend.frameon": False, "figure.facecolor": "white", "axes.facecolor": "white",
|
| 294 |
+
"pdf.fonttype": 42, "ps.fonttype": 42, "svg.fonttype": "none"}):
|
| 295 |
+
results = [_healthy(inputs, assets), _rare_observed(inputs, assets), _rare_comparison(inputs, assets)]
|
| 296 |
+
return {"figures": [path for path, _ in results], "assets": assets, "inputs": list(inputs.values()),
|
| 297 |
+
"calculations": {name: record for name, (_, record) in zip(
|
| 298 |
+
("healthy_composition", "rare_observed", "rare_corrected_comparison"), results)},
|
| 299 |
+
"new_training": False, "new_generation": False, "scientific_estimates_changed": True, "underlying_experiment_outputs_changed": False}
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
if __name__ == "__main__":
|
| 303 |
+
print(json.dumps(build(), indent=2))
|
paper-releases/pbisc-diffusion/updates/20261013T023822Z-pbisc-yellow-scsemi-blue/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/figures/method_palette_20261013/secA_scsemi_readout.palette.json
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/secA_scsemi_readout.pdf",
|
| 4 |
+
"source_sha256": "8d88d3ba4d9e6bab62c739d03830dd5c90a72a580ea6ac1bca679ab6584ccad2",
|
| 5 |
+
"destination": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/method_palette_20261013/secA_scsemi_readout.pdf",
|
| 6 |
+
"destination_sha256": "f2993d3ff6b0dffa4f728a6d9055c933a7743f303dfab4f8b1cdf0381158cf5d",
|
| 7 |
+
"mapping": {
|
| 8 |
+
"#D55E00": "#C5AA4B",
|
| 9 |
+
"#E69F00": "#2166AC",
|
| 10 |
+
"#F5D08A": "#67A9CF"
|
| 11 |
+
},
|
| 12 |
+
"rgb_absolute_tolerance": 1e-08,
|
| 13 |
+
"streams_inspected": 59,
|
| 14 |
+
"modified_streams": 2,
|
| 15 |
+
"stream_checks": [
|
| 16 |
+
{
|
| 17 |
+
"stream": "page0/Contents0",
|
| 18 |
+
"noncolor_operator_sha256_before": "d2ba19f4c4ae008977c0bf15a507dfda7f4e9eb2ed9556194607f8b644e39415",
|
| 19 |
+
"noncolor_operator_sha256_after": "d2ba19f4c4ae008977c0bf15a507dfda7f4e9eb2ed9556194607f8b644e39415",
|
| 20 |
+
"colour_operators_changed": 107
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"stream": "page0/Pattern//H1",
|
| 24 |
+
"noncolor_operator_sha256_before": "745e292337bbbaf4c1e0d7de9b706b7e41b61b28f427b614194c152d6e69afbe",
|
| 25 |
+
"noncolor_operator_sha256_after": "745e292337bbbaf4c1e0d7de9b706b7e41b61b28f427b614194c152d6e69afbe",
|
| 26 |
+
"colour_operators_changed": 1
|
| 27 |
+
}
|
| 28 |
+
],
|
| 29 |
+
"colour_counts": [
|
| 30 |
+
{
|
| 31 |
+
"old": "#D55E00",
|
| 32 |
+
"new": "#C5AA4B",
|
| 33 |
+
"operator": "RG",
|
| 34 |
+
"count": 1
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"old": "#D55E00",
|
| 38 |
+
"new": "#C5AA4B",
|
| 39 |
+
"operator": "rg",
|
| 40 |
+
"count": 42
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"old": "#E69F00",
|
| 44 |
+
"new": "#2166AC",
|
| 45 |
+
"operator": "RG",
|
| 46 |
+
"count": 1
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"old": "#E69F00",
|
| 50 |
+
"new": "#2166AC",
|
| 51 |
+
"operator": "rg",
|
| 52 |
+
"count": 42
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"old": "#F5D08A",
|
| 56 |
+
"new": "#67A9CF",
|
| 57 |
+
"operator": "rg",
|
| 58 |
+
"count": 22
|
| 59 |
+
}
|
| 60 |
+
],
|
| 61 |
+
"image_payload_count": 0,
|
| 62 |
+
"image_payloads": [],
|
| 63 |
+
"rectangle_rules_matched": 0,
|
| 64 |
+
"rectangle_checks": [],
|
| 65 |
+
"scope_insertions": "Only balanced q/RGB/RGB/paint/Q wrappers; original non-colour operators preserved",
|
| 66 |
+
"preservation": {
|
| 67 |
+
"noncolor_operators": true,
|
| 68 |
+
"text_geometry": true,
|
| 69 |
+
"page_rectangles": true,
|
| 70 |
+
"image_payloads": true,
|
| 71 |
+
"source_unchanged": true
|
| 72 |
+
},
|
| 73 |
+
"preservation_pass": true,
|
| 74 |
+
"render": {
|
| 75 |
+
"pdf": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/method_palette_20261013/secA_scsemi_readout.pdf",
|
| 76 |
+
"png": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/method_palette_20261013/secA_scsemi_readout.png",
|
| 77 |
+
"dpi": 200,
|
| 78 |
+
"page_rect": [
|
| 79 |
+
0.0,
|
| 80 |
+
0.0,
|
| 81 |
+
714.8524780273438,
|
| 82 |
+
327.13275146484375
|
| 83 |
+
],
|
| 84 |
+
"width": 1986,
|
| 85 |
+
"height": 909,
|
| 86 |
+
"png_sha256": "4ea8b33687f89e8545477e9c89d01e171026d3dadeac194a765b4b0c0ea96557",
|
| 87 |
+
"rendering": "native PDF rendering; no raster recolouring"
|
| 88 |
+
},
|
| 89 |
+
"original_png": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/secA_scsemi_readout.png",
|
| 90 |
+
"original_png_sha256": "06468c2e50e6107184e5345dbfe3e9e79783410b3ff30f133f84a7e28d0d5b8b",
|
| 91 |
+
"semantic_reason": "PBISC gold; official scSemi blue and modified readout pale blue with original hatch.",
|
| 92 |
+
"policy_sha256": "a94e734ef7e35a2cb09f63acb81eb48b0c2edaccd3743caf3002cf8f8314d07d"
|
| 93 |
+
}
|
paper-releases/pbisc-diffusion/updates/20261013T023822Z-pbisc-yellow-scsemi-blue/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/figures/method_palette_20261013/secA_scsemi_readout.png
ADDED
|
Git LFS Details
|