Archive 4 checkpoints (1-4)
Browse files- paper-releases/pbisc-diffusion/updates/20261008T125804Z-deck-fig2-3-healthy-fig5-rare/diffusion/dataset/server_1/model8/plans/rare_states_paired_20261008/tools/rare_paired.py +295 -0
- paper-releases/pbisc-diffusion/updates/20261008T125804Z-deck-fig2-3-healthy-fig5-rare/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/data/figure_plan.json +396 -0
- paper-releases/pbisc-diffusion/updates/20261008T125804Z-deck-fig2-3-healthy-fig5-rare/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/data/figure_plan_slide_text.json +132 -0
- paper-releases/pbisc-diffusion/updates/20261008T125804Z-deck-fig2-3-healthy-fig5-rare/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/data/slides_spec.json +0 -0
paper-releases/pbisc-diffusion/updates/20261008T125804Z-deck-fig2-3-healthy-fig5-rare/diffusion/dataset/server_1/model8/plans/rare_states_paired_20261008/tools/rare_paired.py
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Rare cell states in the four paired disease cohorts: generated vs observed (CPU only; 2026-10-08).
|
| 3 |
+
|
| 4 |
+
User decision of 2026-10-08 (Fig. 5): show rare-cell fractions and how well rare states are found, on the paired
|
| 5 |
+
disease cohorts. Main comparison = 5 donors (LoRA-5 vs scSemiProfiler with the same 5 donors as representatives, plus
|
| 6 |
+
the zero-shot PBISC versions); 5-fold CV is reported separately. No new generation.
|
| 7 |
+
|
| 8 |
+
Generalises plans/rare_states_screen_20261004/tools/sepsis_states.py (sepsis 5-fold only) to every cohort and design:
|
| 9 |
+
cohorts ye2026_sepsis, imperial_eskd, giroux2022, ji2025_chili (plans/paired_finetune_intradataset_20260927)
|
| 10 |
+
units fewpair draw j = 0..4: zs_raw (fewshot_n5/zs__raw_all.npz), zs_cal, lora5 (draw<j>/lora__raw.npz),
|
| 11 |
+
scsemi5 (draw<j>/scsemi5__raw.npz); fivefold: zs__raw, zs__cal, real_lora__raw (pooled/), scsemi__raw
|
| 12 |
+
(pooled_scsemi_cv_20261002/)
|
| 13 |
+
labels the benchmark's own frozen f01common scANVI labels of each scored call (scores/<ds>/.../arms/<arm>/labels);
|
| 14 |
+
so the generated counts must be the benchmark's own Poisson read-out (whole NPZ, seed 20260916, rows in NPZ
|
| 15 |
+
order), checked cell by cell against the recorded umi_scoring_genes.
|
| 16 |
+
states plans/rare_states_screen_20261004/tools/states.json (literature marker rules; label states as they are).
|
| 17 |
+
depth for marker states, observed parent cells are binomially thinned (seed 20261004) by one constant per unit,
|
| 18 |
+
arm and state to the generated parent median library on the measured panel genes (screen.py rule).
|
| 19 |
+
Commands
|
| 20 |
+
extract DS fewpair J ARM | extract DS fivefold - ARM
|
| 21 |
+
NPZ read locally, or streamed from spark-0110 when it lives there; sha256 must equal its receipt. Writes
|
| 22 |
+
work/<ds>/<unit>/<arm>.npz (marker counts per labelled cell, measured-panel library, donor, AIFI L1/L2).
|
| 23 |
+
analyze
|
| 24 |
+
out/per_donor.csv per unit, arm, state, donor: parent / state cells, observed (native, thinned), generated
|
| 25 |
+
out/summary.csv per unit, arm, state: pooled % (generated, observed thinned), ratio, Spearman over donors,
|
| 26 |
+
detection AUROC (generated % separating donors in the top vs bottom half of observed %)
|
| 27 |
+
out/contrasts.csv per unit, arm, state: case-vs-control difference of donor means, observed vs generated
|
| 28 |
+
"""
|
| 29 |
+
from __future__ import annotations
|
| 30 |
+
|
| 31 |
+
import hashlib
|
| 32 |
+
import importlib.util
|
| 33 |
+
import io
|
| 34 |
+
import json
|
| 35 |
+
import os
|
| 36 |
+
import subprocess
|
| 37 |
+
import sys
|
| 38 |
+
from pathlib import Path
|
| 39 |
+
|
| 40 |
+
import numpy as np
|
| 41 |
+
import pandas as pd
|
| 42 |
+
import scipy.sparse as sp
|
| 43 |
+
from scipy.stats import mannwhitneyu, spearmanr
|
| 44 |
+
|
| 45 |
+
PLAN = Path(__file__).resolve().parents[1]
|
| 46 |
+
M8 = Path("/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion")
|
| 47 |
+
FT = M8 / "plans/paired_finetune_intradataset_20260927"
|
| 48 |
+
SCREEN = M8 / "plans/rare_states_screen_20261004/tools"
|
| 49 |
+
sys.path.insert(0, str(SCREEN))
|
| 50 |
+
from screen import call_state, parent_mask, state_cols # noqa: E402
|
| 51 |
+
|
| 52 |
+
CANON = Path("/home/sj_server_1/gblee/datalake/paired-pbmc-bulk-sc/processing/strict_qc_v1_20260913/reference/"
|
| 53 |
+
"canonical_genes.tsv")
|
| 54 |
+
POISSON_PY = M8 / "plans/aifi_scanvi_rebuild_20260916/poisson_readout.py"
|
| 55 |
+
POISSON_SEED, THIN_SEED = 20260916, 20261004
|
| 56 |
+
REMOTE = "spark-0110"
|
| 57 |
+
COHORTS = ["ye2026_sepsis", "imperial_eskd", "giroux2022", "ji2025_chili"]
|
| 58 |
+
CASE_CTRL = {"ye2026_sepsis": (["adult_sepsis", "ped_sepsis"], ["adult_HC", "adult_ICU_ctrl", "ped_HC", "ped_ICU_ctrl"]),
|
| 59 |
+
"imperial_eskd": (["covid_positive"], ["covid_negative"]),
|
| 60 |
+
"giroux2022": (["severe"], ["mild"]),
|
| 61 |
+
"ji2025_chili": (["TOL", "FU1"], ["BC", "AC"])} # = tools/contrast_args.sh of the FT plan
|
| 62 |
+
FEW_ARMS = ["zs_raw", "zs_cal", "scsemi5", "lora5"]
|
| 63 |
+
POOL_ARMS = ["zs__raw", "zs__cal", "scsemi__raw", "real_lora__raw"]
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def unit_name(design: str, j) -> str:
|
| 67 |
+
return f"draw{j}" if design == "fewpair" else "fivefold"
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def locate(ds: str, design: str, j, arm: str) -> tuple[Path, Path]:
|
| 71 |
+
"""(NPZ stem without suffix, scored-arm directory)"""
|
| 72 |
+
g, s = FT / "generated" / ds, FT / "scores" / ds
|
| 73 |
+
if design == "fewpair":
|
| 74 |
+
stem = {"zs_raw": g / "fewshot_n5/zs__raw_all", "zs_cal": g / f"fewshot_n5/draw{j}/zs__cal",
|
| 75 |
+
"lora5": g / f"fewshot_n5/draw{j}/lora__raw", "scsemi5": g / f"fewshot_n5/draw{j}/scsemi5__raw"}[arm]
|
| 76 |
+
sdir = s / f"fewshot_n5/draw{j}_scsemi5/arms/scsemi5" if arm == "scsemi5" else s / f"fewshot_n5/draw{j}/arms/{arm}"
|
| 77 |
+
else:
|
| 78 |
+
stem = g / "pooled_scsemi_cv_20261002/scsemi__raw" if arm == "scsemi__raw" else g / f"pooled/{arm}"
|
| 79 |
+
sdir = s / "scsemi_cv_20261002/pooled/arms/scsemi__raw" if arm == "scsemi__raw" else s / f"pooled/arms/{arm}"
|
| 80 |
+
return stem, sdir
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
def fetch(path: Path) -> tuple[bytes, str]:
|
| 84 |
+
"""file bytes from server_1, else streamed from spark-0110 (same absolute path); returns (bytes, host)"""
|
| 85 |
+
if path.is_file():
|
| 86 |
+
return path.read_bytes(), "server_1"
|
| 87 |
+
r = subprocess.run(["ssh", "-n", "-o", "BatchMode=yes", REMOTE, "cat", str(path)], stdin=subprocess.DEVNULL,
|
| 88 |
+
capture_output=True, check=False) # -n: never read the caller's stdin (job lists)
|
| 89 |
+
if r.returncode != 0:
|
| 90 |
+
raise SystemExit(f"{path}: not on server_1 and not readable on {REMOTE}")
|
| 91 |
+
return r.stdout, "server_2"
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def load_poisson():
|
| 95 |
+
spec = importlib.util.spec_from_file_location("poisson_readout", POISSON_PY)
|
| 96 |
+
mod = importlib.util.module_from_spec(spec)
|
| 97 |
+
spec.loader.exec_module(mod)
|
| 98 |
+
return mod
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def marker_genes(states: list[dict]) -> list[str]:
|
| 102 |
+
out = []
|
| 103 |
+
for st in states:
|
| 104 |
+
for g in st.get("genes", []) + [x for grp in st.get("require_any", []) for x in grp] + st.get("exclude", []):
|
| 105 |
+
if g not in out:
|
| 106 |
+
out.append(g)
|
| 107 |
+
return out
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
def panel_setup(ds: str, states: list[dict]):
|
| 111 |
+
d = np.load(FT / "data" / ds / "cells_panel6k.npz", allow_pickle=False)
|
| 112 |
+
panel = d["panel_gene_ids"].astype(str)
|
| 113 |
+
measured = d["panel_measured"].any(0)
|
| 114 |
+
canon = pd.read_csv(CANON, sep="\t", dtype=str)
|
| 115 |
+
sym2id = dict(zip(canon.gene_symbol, canon.gene_id))
|
| 116 |
+
pos = {g: i for i, g in enumerate(panel)}
|
| 117 |
+
syms = [g for g in marker_genes(states) if sym2id.get(g) in pos and measured[pos[sym2id[g]]]]
|
| 118 |
+
return panel, measured, syms, np.asarray([pos[sym2id[g]] for g in syms], dtype=np.int64)
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
def cmd_extract(ds: str, design: str, j, arm: str) -> None:
|
| 122 |
+
states = json.loads((SCREEN / "states.json").read_text())
|
| 123 |
+
stem, sdir = locate(ds, design, j, arm)
|
| 124 |
+
out = PLAN / "work" / ds / unit_name(design, j) / f"{arm}.npz"
|
| 125 |
+
if out.exists():
|
| 126 |
+
print(json.dumps({"skip": str(out)}))
|
| 127 |
+
return
|
| 128 |
+
if not (sdir / "generated_cells.parquet").exists():
|
| 129 |
+
raise SystemExit(f"{ds} {design} {j} {arm}: no scored labels at {sdir}")
|
| 130 |
+
panel, measured, syms, cols = panel_setup(ds, states)
|
| 131 |
+
rec_raw, _ = fetch(stem.with_suffix(".log"))
|
| 132 |
+
rec = json.loads(rec_raw)
|
| 133 |
+
raw, host = fetch(stem.with_suffix(".npz"))
|
| 134 |
+
sha = hashlib.sha256(raw).hexdigest()
|
| 135 |
+
if sha != rec["output_sha256"]:
|
| 136 |
+
raise SystemExit(f"{stem}.npz: sha256 {sha[:12]} != receipt {rec['output_sha256'][:12]}")
|
| 137 |
+
d = np.load(io.BytesIO(raw), allow_pickle=False)
|
| 138 |
+
del raw
|
| 139 |
+
if not np.array_equal(d["gene_ids"].astype(str), panel):
|
| 140 |
+
raise SystemExit(f"{stem}.npz: gene_ids differ from the 6k panel")
|
| 141 |
+
rates = np.ascontiguousarray(d["generated_counts"], dtype=np.float32)
|
| 142 |
+
n_rows = rates.shape[0]
|
| 143 |
+
full = load_poisson().poisson_integerise(rates, seed=POISSON_SEED, chunk_rows=4096)
|
| 144 |
+
del rates, d
|
| 145 |
+
gc = pd.read_parquet(sdir / "generated_cells.parquet")
|
| 146 |
+
lab = pd.read_parquet(sdir / "labels/labels.parquet")
|
| 147 |
+
if len(gc) != len(lab) or not (lab.sample_id.astype(str).str.removesuffix("|generated").values
|
| 148 |
+
== gc.donor.astype(str).values).all():
|
| 149 |
+
raise SystemExit(f"{sdir}: generated_cells and labels are not row-aligned")
|
| 150 |
+
X = full[gc.npz_row.to_numpy()].tocsr()
|
| 151 |
+
del full
|
| 152 |
+
ref = np.load(FT / "scoring_cache" / ds / "reference.npz", allow_pickle=False)
|
| 153 |
+
umi = np.asarray(X[:, ref["score_idx"]].sum(1)).ravel()
|
| 154 |
+
if not np.array_equal(umi, gc.umi_scoring_genes.to_numpy()):
|
| 155 |
+
raise SystemExit(f"{sdir}: Poisson read-out does not reproduce the benchmark "
|
| 156 |
+
f"({int((umi != gc.umi_scoring_genes.to_numpy()).sum())} cells differ)")
|
| 157 |
+
lib = np.asarray(X[:, np.flatnonzero(measured)].sum(1)).ravel()
|
| 158 |
+
out.parent.mkdir(parents=True, exist_ok=True)
|
| 159 |
+
np.savez_compressed(out, markers=X[:, cols].toarray().astype(np.int32), marker_symbols=np.asarray(syms),
|
| 160 |
+
lib_measured=lib, donor=np.asarray(gc.donor, dtype=str),
|
| 161 |
+
aifi_l1=np.asarray(lab.aifi_l1, dtype=str), aifi_l2=np.asarray(lab.aifi_l2, dtype=str),
|
| 162 |
+
receipt=json.dumps({"dataset": ds, "design": design, "draw": j, "arm": arm,
|
| 163 |
+
"npz": str(stem) + ".npz", "host": host, "npz_sha256": sha,
|
| 164 |
+
"npz_rows": int(n_rows), "cells": int(len(gc)), "labels": str(sdir),
|
| 165 |
+
"poisson_seed": POISSON_SEED, "umi_scoring_genes_reproduced": True}))
|
| 166 |
+
print(json.dumps({"dataset": ds, "unit": unit_name(design, j), "arm": arm, "host": host, "cells": int(len(gc)),
|
| 167 |
+
"donors": int(gc.donor.nunique()), "median_lib_measured": float(np.median(lib))}))
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
def observed(ds: str, states: list[dict]) -> dict:
|
| 171 |
+
_, measured, syms, cols = panel_setup(ds, states)
|
| 172 |
+
d = np.load(FT / "data" / ds / "cells_panel6k.npz", allow_pickle=False)
|
| 173 |
+
X = sp.csr_matrix((d["data"], d["indices"], d["indptr"]), shape=tuple(d["shape"]))
|
| 174 |
+
obs = pd.read_parquet(FT / "data" / ds / "cells_obs.parquet", columns=["sample_id", "group"])
|
| 175 |
+
lab = pd.read_parquet(FT / "scoring_cache" / ds / "observed_labels/labels/labels.parquet")
|
| 176 |
+
if len(lab) != X.shape[0] or (lab.sample_id.astype(str).values != obs.sample_id.astype(str).values).any():
|
| 177 |
+
raise SystemExit(f"{ds}: observed labels not aligned with cells_panel6k.npz")
|
| 178 |
+
return {"markers": X[:, cols].toarray().astype(np.int32), "symbols": syms,
|
| 179 |
+
"lib": np.asarray(X[:, np.flatnonzero(measured)].sum(1)).ravel(),
|
| 180 |
+
"donor": obs.sample_id.astype(str).to_numpy(), "lab": lab[["aifi_l1", "aifi_l2"]].reset_index(drop=True),
|
| 181 |
+
"groups": obs.drop_duplicates("sample_id").set_index("sample_id").group}
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
def auroc_high_low(gen: pd.Series, obs: pd.Series) -> float:
|
| 185 |
+
"""AUROC of the generated % for donors in the top vs bottom half of the observed % (ties at the median dropped)"""
|
| 186 |
+
ok = gen.notna() & obs.notna()
|
| 187 |
+
g, o = gen[ok], obs[ok]
|
| 188 |
+
if o.nunique() < 2:
|
| 189 |
+
return np.nan
|
| 190 |
+
med = o.median()
|
| 191 |
+
hi, lo = g[o > med], g[o < med]
|
| 192 |
+
if len(hi) < 2 or len(lo) < 2:
|
| 193 |
+
return np.nan
|
| 194 |
+
return float(mannwhitneyu(hi, lo, alternative="two-sided").statistic / (len(hi) * len(lo)))
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def cmd_analyze() -> None:
|
| 198 |
+
states = json.loads((SCREEN / "states.json").read_text())
|
| 199 |
+
per, summ, con = [], [], []
|
| 200 |
+
for ds in COHORTS:
|
| 201 |
+
ob = observed(ds, states)
|
| 202 |
+
case, ctrl = CASE_CTRL[ds]
|
| 203 |
+
units = [("fewpair", j) for j in range(5)] + [("fivefold", None)]
|
| 204 |
+
for design, j in units:
|
| 205 |
+
unit = unit_name(design, j)
|
| 206 |
+
arms = FEW_ARMS if design == "fewpair" else POOL_ARMS
|
| 207 |
+
gens = {a: np.load(PLAN / "work" / ds / unit / f"{a}.npz", allow_pickle=False) for a in arms}
|
| 208 |
+
donors = sorted(set(gens[arms[0]]["donor"]))
|
| 209 |
+
for a in arms:
|
| 210 |
+
if sorted(set(gens[a]["donor"])) != donors:
|
| 211 |
+
raise SystemExit(f"{ds} {unit} {a}: scored donors differ from {arms[0]}")
|
| 212 |
+
keep = np.isin(ob["donor"], donors)
|
| 213 |
+
om, ol, od = ob["markers"][keep], ob["lab"][keep].reset_index(drop=True), ob["donor"][keep]
|
| 214 |
+
olib = ob["lib"][keep]
|
| 215 |
+
rng = np.random.default_rng([THIN_SEED, COHORTS.index(ds), (j if j is not None else 9)])
|
| 216 |
+
for arm in arms:
|
| 217 |
+
g = gens[arm]
|
| 218 |
+
syms = list(g["marker_symbols"].astype(str))
|
| 219 |
+
if syms != ob["symbols"]:
|
| 220 |
+
raise SystemExit(f"{ds} {unit} {arm}: marker columns differ from the observed side")
|
| 221 |
+
s2c = {s: i for i, s in enumerate(syms)}
|
| 222 |
+
lg = pd.DataFrame({"aifi_l1": g["aifi_l1"], "aifi_l2": g["aifi_l2"]})
|
| 223 |
+
for st in states:
|
| 224 |
+
po, pg = parent_mask(ol, st["parent"]), parent_mask(lg, st["parent"])
|
| 225 |
+
if st["kind"] == "label":
|
| 226 |
+
ho = ol.aifi_l2.isin(st["labels"]).to_numpy() & po
|
| 227 |
+
hg = lg.aifi_l2.isin(st["labels"]).to_numpy() & pg
|
| 228 |
+
ht, thin = ho, 1.0
|
| 229 |
+
else:
|
| 230 |
+
_, pcols, req, exc = state_cols(st, {s: s for s in syms}, s2c)
|
| 231 |
+
c = pcols + [x for r in req for x in r] + exc
|
| 232 |
+
thin = min(1.0, float(np.median(g["lib_measured"][pg])) / float(np.median(olib[po])))
|
| 233 |
+
co = om[:, c].astype(np.int64)
|
| 234 |
+
ho = call_state(co, st, len(pcols), req, exc) & po
|
| 235 |
+
ct = rng.binomial(co, thin) if thin < 1.0 else co
|
| 236 |
+
ht = call_state(ct, st, len(pcols), req, exc) & po
|
| 237 |
+
hg = call_state(g["markers"][:, c], st, len(pcols), req, exc) & pg
|
| 238 |
+
rows = []
|
| 239 |
+
for s in donors:
|
| 240 |
+
mo, mg = od == s, g["donor"] == s
|
| 241 |
+
rows.append({"dataset": ds, "design": design, "unit": unit, "arm": arm, "state": st["name"],
|
| 242 |
+
"donor": s, "group": ob["groups"].get(s),
|
| 243 |
+
"obs_parent": int((po & mo).sum()), "obs_state": int((ho & mo).sum()),
|
| 244 |
+
"obsthin_state": int((ht & mo).sum()), "gen_parent": int((pg & mg).sum()),
|
| 245 |
+
"gen_state": int((hg & mg).sum())})
|
| 246 |
+
t = pd.DataFrame(rows)
|
| 247 |
+
t["obsthin_pct"] = 100 * t.obsthin_state / t.obs_parent.where(t.obs_parent > 0)
|
| 248 |
+
t["gen_pct"] = 100 * t.gen_state / t.gen_parent.where(t.gen_parent > 0)
|
| 249 |
+
per.append(t)
|
| 250 |
+
ok = t[["gen_pct", "obsthin_pct"]].dropna()
|
| 251 |
+
rho = float(spearmanr(ok.gen_pct, ok.obsthin_pct).correlation) if len(ok) > 2 and \
|
| 252 |
+
ok.gen_pct.nunique() > 1 and ok.obsthin_pct.nunique() > 1 else np.nan
|
| 253 |
+
ro = 100 * t.obsthin_state.sum() / max(t.obs_parent.sum(), 1)
|
| 254 |
+
rg = 100 * t.gen_state.sum() / max(t.gen_parent.sum(), 1)
|
| 255 |
+
summ.append({"dataset": ds, "design": design, "unit": unit, "arm": arm, "state": st["name"],
|
| 256 |
+
"thin": round(thin, 3), "gen_state": int(t.gen_state.sum()),
|
| 257 |
+
"gen_parent": int(t.gen_parent.sum()), "obs_state_thinned": int(t.obsthin_state.sum()),
|
| 258 |
+
"obs_parent": int(t.obs_parent.sum()), "obs_state_native": int(t.obs_state.sum()),
|
| 259 |
+
"gen_pct": rg, "obs_pct": ro, "gen_over_obs": rg / ro if ro else np.nan,
|
| 260 |
+
"spearman_donors": rho,
|
| 261 |
+
"auroc_high_low": auroc_high_low(t.gen_pct, t.obsthin_pct),
|
| 262 |
+
"donors_with_state_obs": int((t.obsthin_state > 0).sum()),
|
| 263 |
+
"of_those_with_state_gen": int(((t.obsthin_state > 0) & (t.gen_state > 0)).sum()),
|
| 264 |
+
"n_donors": len(t)})
|
| 265 |
+
ga, gb = t[t.group.isin(case)], t[t.group.isin(ctrl)]
|
| 266 |
+
con.append({"dataset": ds, "design": design, "unit": unit, "arm": arm, "state": st["name"],
|
| 267 |
+
"n_case": len(ga), "n_ctrl": len(gb),
|
| 268 |
+
"obs_diff": ga.obsthin_pct.mean() - gb.obsthin_pct.mean(),
|
| 269 |
+
"gen_diff": ga.gen_pct.mean() - gb.gen_pct.mean()})
|
| 270 |
+
print(json.dumps({"dataset": ds, "unit": unit, "arms": arms, "donors": len(donors)}), flush=True)
|
| 271 |
+
C = pd.DataFrame(con)
|
| 272 |
+
C["same_direction"] = np.sign(C.obs_diff) == np.sign(C.gen_diff)
|
| 273 |
+
out = PLAN / "out"
|
| 274 |
+
out.mkdir(exist_ok=True)
|
| 275 |
+
pd.concat(per).to_csv(out / "per_donor.csv", index=False)
|
| 276 |
+
pd.DataFrame(summ).to_csv(out / "summary.csv", index=False)
|
| 277 |
+
C.to_csv(out / "contrasts.csv", index=False)
|
| 278 |
+
print(json.dumps({"rows_summary": len(summ), "rows_contrasts": len(C)}))
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
def main() -> int:
|
| 282 |
+
if os.environ.get("CUDA_VISIBLE_DEVICES") != "":
|
| 283 |
+
raise SystemExit("run with CUDA_VISIBLE_DEVICES=''")
|
| 284 |
+
a = sys.argv[1:]
|
| 285 |
+
if len(a) == 5 and a[0] == "extract":
|
| 286 |
+
cmd_extract(a[1], a[2], None if a[3] == "-" else int(a[3]), a[4])
|
| 287 |
+
elif a == ["analyze"]:
|
| 288 |
+
cmd_analyze()
|
| 289 |
+
else:
|
| 290 |
+
raise SystemExit(__doc__)
|
| 291 |
+
return 0
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
if __name__ == "__main__":
|
| 295 |
+
sys.exit(main())
|
paper-releases/pbisc-diffusion/updates/20261008T125804Z-deck-fig2-3-healthy-fig5-rare/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/data/figure_plan.json
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source": "Nature Style Manuscript Writing.pdf (paper-release-20260928/reference-papers): six main figures, up to 17 supplementary. User decisions of 2026-10-06: no PBISC-VAE; scSemiProfiler, a VAE-based method, is the comparison. User decisions of 2026-10-08 (supersede the earlier figure split): Fig. 2 shows no disease metrics; Fig. 3 compares with scSemiProfiler on healthy samples, with time as a main result; Figs 4-6 use the disease cohorts: Fig. 4 disease benchmarks (PBISC versions, scSemiProfiler, and BayesPrism / CIBERSORTx labelled as cell-type deconvolution), Fig. 5 rare-cell fractions and detection, Fig. 6 new findings from the bulk-only sepsis and COVID samples (K = 1,000 and 4,000).",
|
| 3 |
+
"status_legend": {
|
| 4 |
+
"Ready": "slide exists and fits the panel",
|
| 5 |
+
"Adapt": "slide exists; change its scope or style",
|
| 6 |
+
"Draft": "new draft exists, not yet approved",
|
| 7 |
+
"Build": "results exist; no slide yet",
|
| 8 |
+
"Run": "needs a new analysis or experiment",
|
| 9 |
+
"Plan": "not planned yet"
|
| 10 |
+
},
|
| 11 |
+
"figures": [
|
| 12 |
+
{
|
| 13 |
+
"n": 1,
|
| 14 |
+
"title": "Design and performance of PBISC",
|
| 15 |
+
"claim": "Diffusion on each gene's value and detection, conditioned on bulk, writes realistic blood cells.",
|
| 16 |
+
"panels": [
|
| 17 |
+
{
|
| 18 |
+
"p": "a",
|
| 19 |
+
"content": "Backbones compared: scDiffusion, SDD, PBISC-Diffusion",
|
| 20 |
+
"evidence": [
|
| 21 |
+
"Backbone: SDD → PBISC-Diffusion"
|
| 22 |
+
],
|
| 23 |
+
"status": "Ready"
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"p": "b",
|
| 27 |
+
"content": "Overview: pretraining, diffusion, generation",
|
| 28 |
+
"evidence": [
|
| 29 |
+
"Overview draft (Nature style)"
|
| 30 |
+
],
|
| 31 |
+
"status": "Draft"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"p": "c",
|
| 35 |
+
"content": "What the bulk condition contains",
|
| 36 |
+
"evidence": [
|
| 37 |
+
"Bulk conditioning"
|
| 38 |
+
],
|
| 39 |
+
"status": "Ready"
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"p": "d",
|
| 43 |
+
"content": "Pretraining corpus: assays, conditions, cell types",
|
| 44 |
+
"evidence": [
|
| 45 |
+
"Pretraining corpus"
|
| 46 |
+
],
|
| 47 |
+
"status": "Ready"
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"p": "e",
|
| 51 |
+
"content": "Width and context: lower loss, same biology",
|
| 52 |
+
"evidence": [
|
| 53 |
+
"Width & context ablation: loss saturation",
|
| 54 |
+
"Width & context ablation: benchmark"
|
| 55 |
+
],
|
| 56 |
+
"status": "Ready"
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"p": "f",
|
| 60 |
+
"content": "Gene panel: 2k, 3k, 6k, 15k",
|
| 61 |
+
"evidence": [
|
| 62 |
+
"Gene context: 2k / 3k / 6k / 15k"
|
| 63 |
+
],
|
| 64 |
+
"status": "Ready"
|
| 65 |
+
}
|
| 66 |
+
],
|
| 67 |
+
"candidates": [],
|
| 68 |
+
"details": [
|
| 69 |
+
"PBISC-Diffusion: bulk in, cells out",
|
| 70 |
+
"Denoiser: joint value + support diffusion"
|
| 71 |
+
]
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"n": 2,
|
| 75 |
+
"title": "Fine-tuning PBISC with LoRA",
|
| 76 |
+
"claim": "On a healthy cohort, a few pairs and a LoRA of minutes give cells close to the real ones. No disease metrics.",
|
| 77 |
+
"panels": [
|
| 78 |
+
{
|
| 79 |
+
"p": "a",
|
| 80 |
+
"content": "Real bulk differs from the training input",
|
| 81 |
+
"evidence": [
|
| 82 |
+
"Real bulk ≠ pseudobulk (model input)",
|
| 83 |
+
"Same shift in three paired cohorts"
|
| 84 |
+
],
|
| 85 |
+
"status": "Ready"
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
"p": "b",
|
| 89 |
+
"content": "Without fine-tuning, cells fall off the real manifold",
|
| 90 |
+
"evidence": [
|
| 91 |
+
"Consequence: cells off-manifold"
|
| 92 |
+
],
|
| 93 |
+
"status": "Ready"
|
| 94 |
+
},
|
| 95 |
+
{
|
| 96 |
+
"p": "c",
|
| 97 |
+
"content": "LoRA on paired bulk and cells; how it is tested",
|
| 98 |
+
"evidence": [
|
| 99 |
+
"Fine-tuning with paired bulk + sc",
|
| 100 |
+
"Evaluation design"
|
| 101 |
+
],
|
| 102 |
+
"status": "Ready",
|
| 103 |
+
"note": "design layout; example cohort sepsis"
|
| 104 |
+
},
|
| 105 |
+
{
|
| 106 |
+
"p": "d",
|
| 107 |
+
"content": "How generated cells are scored (cells and composition)",
|
| 108 |
+
"evidence": [
|
| 109 |
+
"How we score generated cells"
|
| 110 |
+
],
|
| 111 |
+
"status": "Ready",
|
| 112 |
+
"note": "metric table for Figs 2-4"
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"p": "e",
|
| 116 |
+
"content": "Healthy cohort: precision, coverage, composition",
|
| 117 |
+
"evidence": [
|
| 118 |
+
"Healthy cohort: LoRA cells cover the real ones"
|
| 119 |
+
],
|
| 120 |
+
"status": "Ready",
|
| 121 |
+
"note": "ImMicro only"
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"p": "f",
|
| 125 |
+
"content": "Healthy cohort: classifier AUROC, MMD, E_N",
|
| 126 |
+
"evidence": [
|
| 127 |
+
"Healthy cohort: realism beyond precision/coverage"
|
| 128 |
+
],
|
| 129 |
+
"status": "Ready",
|
| 130 |
+
"note": "ImMicro only"
|
| 131 |
+
},
|
| 132 |
+
{
|
| 133 |
+
"p": "g",
|
| 134 |
+
"content": "Full, LoRA and condition-encoder fine-tuning",
|
| 135 |
+
"evidence": [
|
| 136 |
+
"Healthy cohort: full vs LoRA vs condition encoder"
|
| 137 |
+
],
|
| 138 |
+
"status": "Ready",
|
| 139 |
+
"note": "ImMicro only"
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"p": "h",
|
| 143 |
+
"content": "How many pairs are needed",
|
| 144 |
+
"evidence": [
|
| 145 |
+
"Healthy cohort: how many pairs"
|
| 146 |
+
],
|
| 147 |
+
"status": "Ready",
|
| 148 |
+
"note": "ImMicro only"
|
| 149 |
+
},
|
| 150 |
+
{
|
| 151 |
+
"p": "i",
|
| 152 |
+
"content": "LoRA rank and K choices",
|
| 153 |
+
"evidence": [
|
| 154 |
+
"Healthy cohort: LoRA rank and K"
|
| 155 |
+
],
|
| 156 |
+
"status": "Ready",
|
| 157 |
+
"note": "ImMicro only; supplementary candidate"
|
| 158 |
+
}
|
| 159 |
+
],
|
| 160 |
+
"candidates": [],
|
| 161 |
+
"details": []
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"n": 3,
|
| 165 |
+
"title": "PBISC vs scSemiProfiler on healthy donors",
|
| 166 |
+
"claim": "On healthy donors, LoRA cells are closer to the real ones than scSemiProfiler's, in minutes instead of days.",
|
| 167 |
+
"panels": [
|
| 168 |
+
{
|
| 169 |
+
"p": "a",
|
| 170 |
+
"content": "Five donors: generated cells and realism",
|
| 171 |
+
"evidence": [
|
| 172 |
+
"Healthy donors, 5 pairs: LoRA-5 vs scSemiProfiler-5"
|
| 173 |
+
],
|
| 174 |
+
"status": "Ready",
|
| 175 |
+
"note": "ImMicro only"
|
| 176 |
+
},
|
| 177 |
+
{
|
| 178 |
+
"p": "b",
|
| 179 |
+
"content": "Same training pairs (5-fold) and equal pair budget (5-40)",
|
| 180 |
+
"evidence": [
|
| 181 |
+
"Healthy donors: the same pairs, 5 to all"
|
| 182 |
+
],
|
| 183 |
+
"status": "Ready",
|
| 184 |
+
"note": "ImMicro only"
|
| 185 |
+
},
|
| 186 |
+
{
|
| 187 |
+
"p": "c",
|
| 188 |
+
"content": "scSemiProfiler copies its representative",
|
| 189 |
+
"evidence": [
|
| 190 |
+
"Healthy donors: scSemiProfiler copies its representative"
|
| 191 |
+
],
|
| 192 |
+
"status": "Ready",
|
| 193 |
+
"note": "ImMicro only"
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"p": "d",
|
| 197 |
+
"content": "Time: GPU hours and days per experiment",
|
| 198 |
+
"evidence": [
|
| 199 |
+
"Time: days for scSemiProfiler, minutes for LoRA",
|
| 200 |
+
"5 donors: time to apply"
|
| 201 |
+
],
|
| 202 |
+
"status": "Ready",
|
| 203 |
+
"note": "all cohorts shown: time is a property of the method"
|
| 204 |
+
}
|
| 205 |
+
],
|
| 206 |
+
"candidates": [],
|
| 207 |
+
"details": []
|
| 208 |
+
},
|
| 209 |
+
{
|
| 210 |
+
"n": 4,
|
| 211 |
+
"title": "Disease signal on paired cohorts",
|
| 212 |
+
"claim": "LoRA cells recover the paired single cells' disease signal; compared with other PBISC versions, scSemiProfiler and deconvolution.",
|
| 213 |
+
"panels": [
|
| 214 |
+
{
|
| 215 |
+
"p": "a",
|
| 216 |
+
"content": "Five paired cohorts",
|
| 217 |
+
"evidence": [
|
| 218 |
+
"Five paired cohorts"
|
| 219 |
+
],
|
| 220 |
+
"status": "Ready"
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"p": "b",
|
| 224 |
+
"content": "With 5 pairs: LoRA-5 vs PBISC versions and scSemiProfiler-5",
|
| 225 |
+
"evidence": [
|
| 226 |
+
"Disease signal with 5 pairs: LoRA-5 vs others"
|
| 227 |
+
],
|
| 228 |
+
"status": "Ready",
|
| 229 |
+
"note": "main comparison"
|
| 230 |
+
},
|
| 231 |
+
{
|
| 232 |
+
"p": "c",
|
| 233 |
+
"content": "5-fold CV, reported separately",
|
| 234 |
+
"evidence": [
|
| 235 |
+
"5-fold CV: disease signal"
|
| 236 |
+
],
|
| 237 |
+
"status": "Ready"
|
| 238 |
+
},
|
| 239 |
+
{
|
| 240 |
+
"p": "d",
|
| 241 |
+
"content": "Disease genes at every list length (CAT)",
|
| 242 |
+
"evidence": [
|
| 243 |
+
"Disease genes at every list length (CAT)"
|
| 244 |
+
],
|
| 245 |
+
"status": "Ready"
|
| 246 |
+
},
|
| 247 |
+
{
|
| 248 |
+
"p": "e",
|
| 249 |
+
"content": "vs BayesPrism and CIBERSORTx (cell-type deconvolution)",
|
| 250 |
+
"evidence": [
|
| 251 |
+
"Cell-type deconvolution, same pairs: disease signal"
|
| 252 |
+
],
|
| 253 |
+
"status": "Ready"
|
| 254 |
+
},
|
| 255 |
+
{
|
| 256 |
+
"p": "f",
|
| 257 |
+
"content": "Lupus benchmark (sc-pseudobulk input, zero-shot)",
|
| 258 |
+
"evidence": [
|
| 259 |
+
"SLE benchmark: PBISC vs scSemiProfiler",
|
| 260 |
+
"SLE benchmark: per cell type"
|
| 261 |
+
],
|
| 262 |
+
"status": "Ready"
|
| 263 |
+
}
|
| 264 |
+
],
|
| 265 |
+
"candidates": [],
|
| 266 |
+
"details": [
|
| 267 |
+
"Sepsis: fine-tuning variants",
|
| 268 |
+
"Pairs needed: donor and disease signal",
|
| 269 |
+
"Cell-type deconvolution, same pairs: composition"
|
| 270 |
+
]
|
| 271 |
+
},
|
| 272 |
+
{
|
| 273 |
+
"n": 5,
|
| 274 |
+
"title": "Rare cell states in disease cohorts",
|
| 275 |
+
"claim": "LoRA cells carry rare disease states near their observed fractions, in the donors that have them.",
|
| 276 |
+
"panels": [
|
| 277 |
+
{
|
| 278 |
+
"p": "a",
|
| 279 |
+
"content": "Rare-state fractions with 5 pairs, four paired cohorts",
|
| 280 |
+
"evidence": [
|
| 281 |
+
"Rare states with 5 pairs: how many cells"
|
| 282 |
+
],
|
| 283 |
+
"status": "Ready",
|
| 284 |
+
"note": "LoRA-5 vs scSemiProfiler-5"
|
| 285 |
+
},
|
| 286 |
+
{
|
| 287 |
+
"p": "b",
|
| 288 |
+
"content": "Finding rare states: right donors, disease direction",
|
| 289 |
+
"evidence": [
|
| 290 |
+
"Rare states with 5 pairs: in the right donors"
|
| 291 |
+
],
|
| 292 |
+
"status": "Ready"
|
| 293 |
+
},
|
| 294 |
+
{
|
| 295 |
+
"p": "c",
|
| 296 |
+
"content": "5-fold CV, reported separately",
|
| 297 |
+
"evidence": [
|
| 298 |
+
"5-fold CV: rare states"
|
| 299 |
+
],
|
| 300 |
+
"status": "Ready"
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
"p": "d",
|
| 304 |
+
"content": "Behçet: C1Q-high monocytes from real bulk",
|
| 305 |
+
"evidence": [
|
| 306 |
+
"Consequence: disease direction flips"
|
| 307 |
+
],
|
| 308 |
+
"status": "Adapt",
|
| 309 |
+
"note": "add the LoRA-3 result (C1Q-high BD > HC)"
|
| 310 |
+
},
|
| 311 |
+
{
|
| 312 |
+
"p": "e",
|
| 313 |
+
"content": "Diseases absent from the corpus: Kawasaki MS1, SLE ISG-high T",
|
| 314 |
+
"evidence": [],
|
| 315 |
+
"status": "Build",
|
| 316 |
+
"note": "rare_states_screen_20261004 results"
|
| 317 |
+
}
|
| 318 |
+
],
|
| 319 |
+
"candidates": [],
|
| 320 |
+
"details": []
|
| 321 |
+
},
|
| 322 |
+
{
|
| 323 |
+
"n": 6,
|
| 324 |
+
"title": "Discovery from public bulk-only data",
|
| 325 |
+
"claim": "New findings from LoRA cells of bulk-only sepsis and COVID dialysis samples (K = 1,000 and 4,000).",
|
| 326 |
+
"panels": [
|
| 327 |
+
{
|
| 328 |
+
"p": "a",
|
| 329 |
+
"content": "Bulk-only samples generated: sepsis 122, COVID dialysis 164",
|
| 330 |
+
"evidence": [
|
| 331 |
+
"Next: cohorts with a paired subset (planned)"
|
| 332 |
+
],
|
| 333 |
+
"status": "Adapt",
|
| 334 |
+
"note": "update: K = 1,000 and 4,000 done"
|
| 335 |
+
},
|
| 336 |
+
{
|
| 337 |
+
"p": "b",
|
| 338 |
+
"content": "New findings",
|
| 339 |
+
"evidence": [],
|
| 340 |
+
"status": "Run",
|
| 341 |
+
"note": "earlier screen: 0 confirmed beyond the bulk"
|
| 342 |
+
}
|
| 343 |
+
],
|
| 344 |
+
"candidates": [],
|
| 345 |
+
"details": []
|
| 346 |
+
}
|
| 347 |
+
],
|
| 348 |
+
"supplementary": {
|
| 349 |
+
"slides": [
|
| 350 |
+
"5 donors: LoRA vs scSemiProfiler — cells",
|
| 351 |
+
"5 donors: realism beyond precision/coverage",
|
| 352 |
+
"5 donors: precision/coverage at k = 3, 5, 10",
|
| 353 |
+
"5-fold: realism beyond precision/coverage",
|
| 354 |
+
"Same training pairs: LoRA vs scSemiProfiler",
|
| 355 |
+
"scSemiProfiler copies its representative",
|
| 356 |
+
"Full vs LoRA vs cond.-encoder-only",
|
| 357 |
+
"Pairs needed: composition, coverage, training steps",
|
| 358 |
+
"LoRA rank: r = 4, 16, 64",
|
| 359 |
+
"K diversification: no gain",
|
| 360 |
+
"Pairs from other cohorts do not transfer",
|
| 361 |
+
"Longer training on other cohorts: gap stays",
|
| 362 |
+
"No pretraining: same cohort, from scratch",
|
| 363 |
+
"No pretraining: other cohorts, from scratch",
|
| 364 |
+
"Rare states: from scratch vs pretrained"
|
| 365 |
+
],
|
| 366 |
+
"planned": [
|
| 367 |
+
{
|
| 368 |
+
"p": "S",
|
| 369 |
+
"content": "Influenza exposure from raw clinical bulk (Randolph)",
|
| 370 |
+
"evidence": [],
|
| 371 |
+
"status": "Build",
|
| 372 |
+
"note": "manuscript result; placement open"
|
| 373 |
+
}
|
| 374 |
+
],
|
| 375 |
+
"notes": {
|
| 376 |
+
"Pairs from other cohorts do not transfer": "moved from Fig. 5; placement open",
|
| 377 |
+
"Longer training on other cohorts: gap stays": "moved from Fig. 5; placement open",
|
| 378 |
+
"5 donors: LoRA vs scSemiProfiler — cells": "all five cohorts",
|
| 379 |
+
"5 donors: realism beyond precision/coverage": "all five cohorts",
|
| 380 |
+
"5 donors: precision/coverage at k = 3, 5, 10": "all five cohorts",
|
| 381 |
+
"5-fold: realism beyond precision/coverage": "all five cohorts",
|
| 382 |
+
"Same training pairs: LoRA vs scSemiProfiler": "all five cohorts",
|
| 383 |
+
"scSemiProfiler copies its representative": "all five cohorts",
|
| 384 |
+
"Full vs LoRA vs cond.-encoder-only": "all five cohorts",
|
| 385 |
+
"Pairs needed: composition, coverage, training steps": "all five cohorts",
|
| 386 |
+
"LoRA rank: r = 4, 16, 64": "all five cohorts",
|
| 387 |
+
"K diversification: no gain": "all five cohorts"
|
| 388 |
+
}
|
| 389 |
+
},
|
| 390 |
+
"appendix": [
|
| 391 |
+
"Appendix: scSemiProfiler without output threshold"
|
| 392 |
+
],
|
| 393 |
+
"discussion": [
|
| 394 |
+
"Next: other tissues from a few dozen pairs"
|
| 395 |
+
]
|
| 396 |
+
}
|
paper-releases/pbisc-diffusion/updates/20261008T125804Z-deck-fig2-3-healthy-fig5-rare/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/data/figure_plan_slide_text.json
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"section": "figure-plan",
|
| 3 |
+
"scripts": [
|
| 4 |
+
"/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/tools/figure_plan.py"
|
| 5 |
+
],
|
| 6 |
+
"generated_from": "tools/figure_plan.py (rerun to refresh; do not edit by hand)",
|
| 7 |
+
"slides": [
|
| 8 |
+
{
|
| 9 |
+
"title": "Manuscript plan: six main figures",
|
| 10 |
+
"layout": "full",
|
| 11 |
+
"figures": [
|
| 12 |
+
"/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/figplan_overview.png"
|
| 13 |
+
],
|
| 14 |
+
"keywords": [],
|
| 15 |
+
"footnote_short": "Nature style: short abstract and introduction, descriptive results, short discussion, detailed methods; up to 17 supplementary figures.",
|
| 16 |
+
"footnote": "Nature Style Manuscript Writing.pdf (paper-release-20260928/reference-papers): six main figures, up to 17 supplementary. User decisions of 2026-10-06: no PBISC-VAE; scSemiProfiler, a VAE-based method, is the comparison. User decisions of 2026-10-08 (supersede the earlier figure split): Fig. 2 shows no disease metrics; Fig. 3 compares with scSemiProfiler on healthy samples, with time as a main result; Figs 4-6 use the disease cohorts: Fig. 4 disease benchmarks (PBISC versions, scSemiProfiler, and BayesPrism / CIBERSORTx labelled as cell-type deconvolution), Fig. 5 rare-cell fractions and detection, Fig. 6 new findings from the bulk-only sepsis and COVID samples (K = 1,000 and 4,000). Status: Ready = slide exists and fits the panel; Adapt = slide exists; change its scope or style; Draft = new draft exists, not yet approved; Build = results exist; no slide yet; Run = needs a new analysis or experiment; Plan = not planned yet.",
|
| 17 |
+
"numbers": []
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"title": "Figure 1 plan: Design and performance of PBISC",
|
| 21 |
+
"layout": "full",
|
| 22 |
+
"figures": [
|
| 23 |
+
"/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/figplan_fig1.png"
|
| 24 |
+
],
|
| 25 |
+
"keywords": [],
|
| 26 |
+
"footnote_short": "Diffusion on each gene's value and detection, conditioned on bulk, writes realistic blood cells. 5 of 6 panels ready.",
|
| 27 |
+
"footnote": "Panels: a) Backbones compared: scDiffusion, SDD, PBISC-Diffusion [Ready]. b) Overview: pretraining, diffusion, generation [Draft]. c) What the bulk condition contains [Ready]. d) Pretraining corpus: assays, conditions, cell types [Ready]. e) Width and context: lower loss, same biology [Ready]. f) Gene panel: 2k, 3k, 6k, 15k [Ready]. Details in this section: PBISC-Diffusion: bulk in, cells out; Denoiser: joint value + support diffusion.",
|
| 28 |
+
"numbers": []
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"title": "Figure 2 plan: Fine-tuning PBISC with LoRA",
|
| 32 |
+
"layout": "full",
|
| 33 |
+
"figures": [
|
| 34 |
+
"/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/figplan_fig2.png"
|
| 35 |
+
],
|
| 36 |
+
"keywords": [],
|
| 37 |
+
"footnote_short": "On a healthy cohort, a few pairs and a LoRA of minutes give cells close to the real ones. No disease metrics. 9 of 9 panels ready.",
|
| 38 |
+
"footnote": "Panels: a) Real bulk differs from the training input [Ready]. b) Without fine-tuning, cells fall off the real manifold [Ready]. c) LoRA on paired bulk and cells; how it is tested [Ready; design layout; example cohort sepsis]. d) How generated cells are scored (cells and composition) [Ready; metric table for Figs 2-4]. e) Healthy cohort: precision, coverage, composition [Ready; ImMicro only]. f) Healthy cohort: classifier AUROC, MMD, E_N [Ready; ImMicro only]. g) Full, LoRA and condition-encoder fine-tuning [Ready; ImMicro only]. h) How many pairs are needed [Ready; ImMicro only]. i) LoRA rank and K choices [Ready; ImMicro only; supplementary candidate].",
|
| 39 |
+
"numbers": []
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"title": "Figure 3 plan: PBISC vs scSemiProfiler on healthy donors",
|
| 43 |
+
"layout": "full",
|
| 44 |
+
"figures": [
|
| 45 |
+
"/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/figplan_fig3.png"
|
| 46 |
+
],
|
| 47 |
+
"keywords": [],
|
| 48 |
+
"footnote_short": "On healthy donors, LoRA cells are closer to the real ones than scSemiProfiler's, in minutes instead of days. 4 of 4 panels ready.",
|
| 49 |
+
"footnote": "Panels: a) Five donors: generated cells and realism [Ready; ImMicro only]. b) Same training pairs (5-fold) and equal pair budget (5-40) [Ready; ImMicro only]. c) scSemiProfiler copies its representative [Ready; ImMicro only]. d) Time: GPU hours and days per experiment [Ready; all cohorts shown: time is a property of the method].",
|
| 50 |
+
"numbers": []
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
"title": "Figure 4 plan: Disease signal on paired cohorts",
|
| 54 |
+
"layout": "full",
|
| 55 |
+
"figures": [
|
| 56 |
+
"/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/figplan_fig4.png"
|
| 57 |
+
],
|
| 58 |
+
"keywords": [],
|
| 59 |
+
"footnote_short": "LoRA cells recover the paired single cells' disease signal; compared with other PBISC versions, scSemiProfiler and deconvolution. 6 of 6 panels ready.",
|
| 60 |
+
"footnote": "Panels: a) Five paired cohorts [Ready]. b) With 5 pairs: LoRA-5 vs PBISC versions and scSemiProfiler-5 [Ready; main comparison]. c) 5-fold CV, reported separately [Ready]. d) Disease genes at every list length (CAT) [Ready]. e) vs BayesPrism and CIBERSORTx (cell-type deconvolution) [Ready]. f) Lupus benchmark (sc-pseudobulk input, zero-shot) [Ready]. Details in this section: Sepsis: fine-tuning variants; Pairs needed: donor and disease signal; Cell-type deconvolution, same pairs: composition.",
|
| 61 |
+
"numbers": []
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"title": "Figure 5 plan: Rare cell states in disease cohorts",
|
| 65 |
+
"layout": "full",
|
| 66 |
+
"figures": [
|
| 67 |
+
"/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/figplan_fig5.png"
|
| 68 |
+
],
|
| 69 |
+
"keywords": [],
|
| 70 |
+
"footnote_short": "LoRA cells carry rare disease states near their observed fractions, in the donors that have them. 3 of 5 panels ready.",
|
| 71 |
+
"footnote": "Panels: a) Rare-state fractions with 5 pairs, four paired cohorts [Ready; LoRA-5 vs scSemiProfiler-5]. b) Finding rare states: right donors, disease direction [Ready]. c) 5-fold CV, reported separately [Ready]. d) Behçet: C1Q-high monocytes from real bulk [Adapt; add the LoRA-3 result (C1Q-high BD > HC)]. e) Diseases absent from the corpus: Kawasaki MS1, SLE ISG-high T [Build; rare_states_screen_20261004 results].",
|
| 72 |
+
"numbers": []
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"title": "Figure 6 plan: Discovery from public bulk-only data",
|
| 76 |
+
"layout": "full",
|
| 77 |
+
"figures": [
|
| 78 |
+
"/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/figplan_fig6.png"
|
| 79 |
+
],
|
| 80 |
+
"keywords": [],
|
| 81 |
+
"footnote_short": "New findings from LoRA cells of bulk-only sepsis and COVID dialysis samples (K = 1,000 and 4,000). 0 of 2 panels ready.",
|
| 82 |
+
"footnote": "Panels: a) Bulk-only samples generated: sepsis 122, COVID dialysis 164 [Adapt; update: K = 1,000 and 4,000 done]. b) New findings [Run; earlier screen: 0 confirmed beyond the bulk].",
|
| 83 |
+
"numbers": []
|
| 84 |
+
},
|
| 85 |
+
{
|
| 86 |
+
"title": "Supplementary plan",
|
| 87 |
+
"layout": "full",
|
| 88 |
+
"figures": [
|
| 89 |
+
"/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/figplan_supp.png"
|
| 90 |
+
],
|
| 91 |
+
"keywords": [],
|
| 92 |
+
"footnote_short": "Bulk deconvolution methods appear here only: PBISC generates single cells, a different task.",
|
| 93 |
+
"footnote": "Supplementary: 5 donors: LoRA vs scSemiProfiler — cells; 5 donors: realism beyond precision/coverage; 5 donors: precision/coverage at k = 3, 5, 10; 5-fold: realism beyond precision/coverage; Same training pairs: LoRA vs scSemiProfiler; scSemiProfiler copies its representative; Full vs LoRA vs cond.-encoder-only; Pairs needed: composition, coverage, training steps; LoRA rank: r = 4, 16, 64; K diversification: no gain; Pairs from other cohorts do not transfer; Longer training on other cohorts: gap stays; No pretraining: same cohort, from scratch; No pretraining: other cohorts, from scratch; Rare states: from scratch vs pretrained. Planned: Influenza exposure from raw clinical bulk (Randolph) [Build; manuscript result; placement open]. Appendix: Appendix: scSemiProfiler without output threshold.",
|
| 94 |
+
"numbers": []
|
| 95 |
+
},
|
| 96 |
+
{
|
| 97 |
+
"title": "Overview draft (Nature style)",
|
| 98 |
+
"layout": "full",
|
| 99 |
+
"figures": [
|
| 100 |
+
"/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/fig1b_overview_nature.png"
|
| 101 |
+
],
|
| 102 |
+
"keywords": [
|
| 103 |
+
"Each cell is learned with its own bulk",
|
| 104 |
+
"Diffusion on each gene's value and detection",
|
| 105 |
+
"One bulk in, K cells out; optional LoRA"
|
| 106 |
+
],
|
| 107 |
+
"footnote_short": "Draft for Fig. 1b; schematic, no data. Plan: manuscript editorial/fig1_nature_redesign_plan.",
|
| 108 |
+
"footnote": "Candidate replacement for the engineering diagram (kept in this section as details and for Methods). Source: paper-release-20260928/manuscript/figures/fig01_architecture_nature.svg (scripts/build_figure1_architecture_nature.py).",
|
| 109 |
+
"numbers": []
|
| 110 |
+
},
|
| 111 |
+
{
|
| 112 |
+
"title": "Pretraining corpus",
|
| 113 |
+
"layout": "full",
|
| 114 |
+
"figures": [
|
| 115 |
+
"/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00/figures/fig1d_corpus.png"
|
| 116 |
+
],
|
| 117 |
+
"keywords": [
|
| 118 |
+
"41.4 M cells, 22 datasets, 3,199 donors",
|
| 119 |
+
"88.5% healthy donors; 23.6% cultured in vitro",
|
| 120 |
+
"Labels describe the corpus; never model input"
|
| 121 |
+
],
|
| 122 |
+
"footnote_short": "Detailed version: Supplementary Fig. S1 of the manuscript.",
|
| 123 |
+
"footnote": "Source: paper-release-20260928/manuscript/source_data/corpus/ (build_corpus_tables.py) and figures/fig01_corpus_nature.png (build_figure1_corpus.py).",
|
| 124 |
+
"numbers": [
|
| 125 |
+
{
|
| 126 |
+
"value": "41,395,184 cells; 22 datasets; 3,199 donors; healthy 88.5%; in vitro 23.6%",
|
| 127 |
+
"source": "manuscript/source_data/corpus/corpus_summary.json"
|
| 128 |
+
}
|
| 129 |
+
]
|
| 130 |
+
}
|
| 131 |
+
]
|
| 132 |
+
}
|
paper-releases/pbisc-diffusion/updates/20261008T125804Z-deck-fig2-3-healthy-fig5-rare/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/data/slides_spec.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|