Archive 4 checkpoints (1-4)
Browse files- paper-releases/pbisc-diffusion/updates/20261008T050202Z-scsemi-imperial-deck/diffusion/dataset/server_1/model8/plans/bayesprism_paired_20261006/README.md +127 -0
- paper-releases/pbisc-diffusion/updates/20261008T050202Z-scsemi-imperial-deck/diffusion/dataset/server_1/model8/plans/bayesprism_paired_20261006/results/TABLE_cv_cibersortx.csv +6 -0
- paper-releases/pbisc-diffusion/updates/20261008T050202Z-scsemi-imperial-deck/diffusion/dataset/server_1/model8/plans/bayesprism_paired_20261006/results/TABLE_cv_full.csv +6 -0
- paper-releases/pbisc-diffusion/updates/20261008T050202Z-scsemi-imperial-deck/diffusion/dataset/server_1/model8/plans/bayesprism_paired_20261006/tools/build_archive_request.py +157 -0
paper-releases/pbisc-diffusion/updates/20261008T050202Z-scsemi-imperial-deck/diffusion/dataset/server_1/model8/plans/bayesprism_paired_20261006/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Bulk deconvolution with the same paired donors (BayesPrism, CIBERSORTx) vs PBISC LoRA
|
| 2 |
+
|
| 3 |
+
Started 2026-10-06; results final 2026-10-08. CPU only, no GPU.
|
| 4 |
+
|
| 5 |
+
User requests:
|
| 6 |
+
- 2026-10-06: compare BayesPrism; then add CIBERSORTx and the paired COVID cohort (Imperial). The paired COVID cohort
|
| 7 |
+
already in the benchmark was judged enough.
|
| 8 |
+
- 2026-10-06 user decision: deconvolution methods go to the paper's Supplementary only, because PBISC generates single
|
| 9 |
+
cells, a different task.
|
| 10 |
+
|
| 11 |
+
Deck: two Supplementary slides in `presentations/2026-09-30--paper-summary--r00`, made by `tools/secS_deconvolution.py`:
|
| 12 |
+
"Deconvolution with the same pairs: composition" and "...: disease signal".
|
| 13 |
+
|
| 14 |
+
## Question and design
|
| 15 |
+
|
| 16 |
+
Can standard bulk deconvolution, given the same paired donors that PBISC LoRA fine-tunes on, recover what PBISC
|
| 17 |
+
recovers on the paired benchmark (`plans/paired_finetune_intradataset_20260927`)?
|
| 18 |
+
|
| 19 |
+
Everything except the method is the benchmark's own:
|
| 20 |
+
- **Splits** (`tools/common.py split_rows`)
|
| 21 |
+
- 5-donor draws: reference = the draw's 5 training donors.
|
| 22 |
+
- 5-fold CV: reference = each fold's LoRA training plus inner-validation rows (from its RUN.json).
|
| 23 |
+
- Mixture = the test samples' real bulk raw counts.
|
| 24 |
+
- Only paired samples are used.
|
| 25 |
+
- **Truth and scorer**: score_ft.py functions imported unchanged, on the same donors, observed cells, case/control
|
| 26 |
+
groups and `--exclude-genes` (Giroux: sex-linked genes excluded, from `scores_nosex/`).
|
| 27 |
+
- **Gates** (fail closed):
|
| 28 |
+
- The observed composition equals the stored per_donor values.
|
| 29 |
+
- The recomputed bulk-broadcast logFC r and top-50 DEG overlap equal the stored values for every split.
|
| 30 |
+
- Older pooled scorings have no DEG rows; for those, only the r gate applies.
|
| 31 |
+
- **Cohorts**: ImMicro (healthy; composition only), sepsis (Ye 2026), Ji ChILI, Imperial ESKD COVID, Giroux.
|
| 32 |
+
|
| 33 |
+
### Methods
|
| 34 |
+
|
| 35 |
+
**BayesPrism** (`tools/run_bp.R`; R library `utility_studies_final6k_20260925/deconv/Rlib`):
|
| 36 |
+
- Settings:
|
| 37 |
+
- input.type GEP.
|
| 38 |
+
- States = "six-type gate | AIFI L2", with states under 20 cells merged into "type|minor".
|
| 39 |
+
- outlier.cut 0.01, outlier.fraction 0.1.
|
| 40 |
+
- Gene modes:
|
| 41 |
+
- `full` (main): BayesPrism's recommended set, canonical protein-coding minus chrX/Y/M and RPS/RPL/MRPS/MRPL,
|
| 42 |
+
measured by the sc assay; 15-19k genes.
|
| 43 |
+
- `score` (sensitivity): the scorer's ~5.5-6k scoring genes. This handicaps composition.
|
| 44 |
+
- Outputs: θ initial ("first", Gibbs) and θ updated ("final", after the reference update), plus Z (posterior
|
| 45 |
+
cell-type expression).
|
| 46 |
+
- θ is in mRNA units. It is converted to cell units by dividing by each type's mean UMI per reference cell, then
|
| 47 |
+
renormalising.
|
| 48 |
+
|
| 49 |
+
**CIBERSORTx** (`tools/build_cibersortx_inputs.py`, `tools/run_cibersortx.sh`):
|
| 50 |
+
- Runs from the official Docker images `cibersortx/fractions` and `cibersortx/hires`.
|
| 51 |
+
- The images are amd64-only. On server_1 (aarch64) they run under qemu binfmt emulation, registered with
|
| 52 |
+
`tonistiigi/binfmt` (user-approved 2026-10-06; undo with `--uninstall amd64`).
|
| 53 |
+
- **Fractions** (single-cell reference mode with S-mode batch correction):
|
| 54 |
+
- Reference: up to 400 cells per type, seeded.
|
| 55 |
+
- Flags: `--fraction 0 --replicates 5 --sampling 0.5 --G.min 300 --G.max 500 --q.value 0.01 --QN FALSE`.
|
| 56 |
+
- **HiRes**:
|
| 57 |
+
- Runs on the scoring genes, with the Fractions signature and S-mode source GEPs.
|
| 58 |
+
- HiRes regresses each gene on the 6 type fractions, so splits with 8 or fewer test samples are skipped. That
|
| 59 |
+
affects the Ji and Giroux CV folds.
|
| 60 |
+
- HiRes imputes a different gene subset per type and writes exactly 1 in every sample for the other genes. The
|
| 61 |
+
scorer treats those rows as not expressed (zero) and not covered (`score_bp.py load_cx`).
|
| 62 |
+
- In 3 of 20 disease draws (Ji draw 3, Giroux draws 1 and 4), HiRes imputed no gene of the four contrast types.
|
| 63 |
+
Those draws have no CIBERSORTx disease score.
|
| 64 |
+
- **Credentials**:
|
| 65 |
+
- Read at run time from `/home/sj_server_1/cibersortx.key` into a mode-600 env file that only the container reads.
|
| 66 |
+
- The binary echoes its options, so its output is redacted before logging.
|
| 67 |
+
- Checked 2026-10-08: no token or username in any plan file (counts only).
|
| 68 |
+
|
| 69 |
+
## Results (main: BayesPrism gene mode full)
|
| 70 |
+
|
| 71 |
+
Full tables:
|
| 72 |
+
- `results/RESULTS_full.md` (BayesPrism, main)
|
| 73 |
+
- `results/RESULTS_score.md` (BayesPrism, score-gene sensitivity)
|
| 74 |
+
- `results/RESULTS_cibersortx.md`
|
| 75 |
+
- Machine-readable versions: `results/TABLE_{fewshot,cv}_{full,score,cibersortx}.csv`
|
| 76 |
+
- Per split: `results/<cohort>/<comparison>/{summary.json, per_donor.csv, contrast.csv}`
|
| 77 |
+
|
| 78 |
+
Five-donor draws (25 draws; 20 with a case/control contrast). Number of draws where LoRA-5 beats the method:
|
| 79 |
+
|
| 80 |
+
| | composition L1 | logFC r | partial r beyond bulk | top-50 DEG |
|
| 81 |
+
|---|---|---|---|---|
|
| 82 |
+
| BayesPrism (better θ) | 22/25 | 15/20 | 18/20 | 6/20 (BayesPrism ahead 8, ties 6) |
|
| 83 |
+
| CIBERSORTx | 24/25 | 17/17 | 17/17 | 6/17 (many ties at 0) |
|
| 84 |
+
|
| 85 |
+
- **Composition.** Deconvolution is far off in most cohorts. For example, in Giroux BayesPrism's L1 is 1.46 vs
|
| 86 |
+
LoRA-5's 0.26, and CIBERSORTx's is 0.67.
|
| 87 |
+
- **Pipeline check.** On sc pseudobulk mixtures, BayesPrism recovers the observed mRNA shares (Giroux T 0.386 vs
|
| 88 |
+
0.375; ImMicro T 0.54 vs 0.60). The error therefore comes from real bulk, not from the pipeline.
|
| 89 |
+
- **Disease signal.** BayesPrism Z is ahead of LoRA-5 on logFC r only in Giroux, where the plain bulk broadcast is
|
| 90 |
+
best of all. CIBERSORTx HiRes is below the broadcast everywhere.
|
| 91 |
+
- **DEG.** Both deconvolutions are ahead on top-50 DEG in sepsis (27 and 25 vs 16); LoRA-5 is ahead in Imperial (114
|
| 92 |
+
vs 72 and 31).
|
| 93 |
+
- **5-fold CV, pooled.**
|
| 94 |
+
- LoRA has the lowest composition L1 in ImMicro, sepsis, Ji and Imperial.
|
| 95 |
+
- In Giroux, scSemiProfiler is slightly lower (0.243 vs 0.258).
|
| 96 |
+
- scSemiProfiler's 5-fold column comes from `scores[_nosex]/<ds>/scsemi_cv_20261002/pooled` for all five cohorts.
|
| 97 |
+
Imperial finished on server_2 on 2026-10-08 13:45 and was finalized on server_1 from sha-checked fold copies.
|
| 98 |
+
In Imperial, LoRA leads on every metric (L1 0.376 vs 0.520, logFC r 0.819 vs 0.705, DEG 143 vs 87).
|
| 99 |
+
|
| 100 |
+
## Rebuild
|
| 101 |
+
|
| 102 |
+
```bash
|
| 103 |
+
P=/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/bayesprism_paired_20261006
|
| 104 |
+
PY=/home/sj_server_1/miniforge3/envs/cxg_corpus/bin/python
|
| 105 |
+
# per cohort: aggregates and split inputs (CPU)
|
| 106 |
+
CUDA_VISIBLE_DEVICES= $PY $P/tools/build_aggregates.py DATASET full
|
| 107 |
+
CUDA_VISIBLE_DEVICES= $PY $P/tools/build_split.py DATASET {fewshot|cv} IDX full
|
| 108 |
+
GENES=full bash $P/tools/run_all.sh LANE CORES DATASET ... # BayesPrism, bounded units
|
| 109 |
+
CUDA_VISIBLE_DEVICES= $PY $P/tools/build_cibersortx_inputs.py DATASET
|
| 110 |
+
bash $P/tools/run_cibersortx.sh LANE CORES DATASET ... # CIBERSORTx (qemu on aarch64; hours per split)
|
| 111 |
+
bash $P/tools/finalize_full.sh # score + tables, BayesPrism (full and score modes)
|
| 112 |
+
RESCORE_FULL_CV="cohorts with new scSemiProfiler CV" bash $P/tools/finalize_cx.sh # CIBERSORTx (+ refresh CV)
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
`remote_cache/` holds sha-checked copies of inputs that live only on spark-0110: condition NPZs and the Imperial
|
| 116 |
+
few-shot RUN.json (`common.local_copy`).
|
| 117 |
+
|
| 118 |
+
## Changes
|
| 119 |
+
|
| 120 |
+
- 2026-10-08:
|
| 121 |
+
- `score_bp.py`:
|
| 122 |
+
- HiRes placeholder rows (all exactly 1) are no longer read as expression.
|
| 123 |
+
- The covered variant is per type for CIBERSORTx.
|
| 124 |
+
- Giroux's scSemiProfiler CV is read from `scores_nosex/`, matching LoRA's gene exclusion.
|
| 125 |
+
- The BayesPrism metrics were rechecked identical after the change.
|
| 126 |
+
- `aggregate_bp.py`: labels its table by method.
|
| 127 |
+
- New: `finalize_cx.sh`.
|
paper-releases/pbisc-diffusion/updates/20261008T050202Z-scsemi-imperial-deck/diffusion/dataset/server_1/model8/plans/bayesprism_paired_20261006/results/TABLE_cv_cibersortx.csv
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cohort,bp_l1_final,bp_l1_first,lora_l1,bp_r,bp_r_covered,lora_r,broadcast_r,broadcast_r_covered,bp_partial,lora_partial,bp_deg,lora_deg,broadcast_deg,scsemi_l1,scsemi_r,scsemi_deg
|
| 2 |
+
immicro,0.5065033643252109,0.5065033643252109,0.16172890350786212,,,,,,,,,,,0.2170087237986556,,
|
| 3 |
+
ye2026_sepsis,0.607149641152929,0.607149641152929,0.3618246783833512,-0.035832909681658,-0.12522813744518627,0.5267612711229187,0.31594581626202867,0.601490367831679,-0.0739317360248297,0.46874787884206276,0.0,23.0,21.0,0.5022299158951089,0.43526410070392063,6.0
|
| 4 |
+
ji2025_chili,0.914073829946989,0.914073829946989,0.5044992874562503,,,,,,,,,,,0.575388570715078,0.2730887293849816,0.0
|
| 5 |
+
imperial_eskd,0.5918271288164071,0.5918271288164071,0.37638560875745664,0.21113497684457377,0.3693097049105145,0.8187448084273437,0.6606053132085035,0.5831498842343769,0.015667623661280307,0.6899314750539278,1.0,143.0,84.0,0.5203155086290455,0.7053598964433999,87.0
|
| 6 |
+
giroux2022,0.5914100321768722,0.5914100321768722,0.2580442754044374,,,,,,,,,,,0.24307690277174857,0.5372927269740906,0.0
|
paper-releases/pbisc-diffusion/updates/20261008T050202Z-scsemi-imperial-deck/diffusion/dataset/server_1/model8/plans/bayesprism_paired_20261006/results/TABLE_cv_full.csv
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cohort,bp_l1_final,bp_l1_first,lora_l1,bp_r,bp_r_covered,lora_r,broadcast_r,broadcast_r_covered,bp_partial,lora_partial,bp_deg,lora_deg,broadcast_deg,scsemi_l1,scsemi_r,scsemi_deg
|
| 2 |
+
immicro,0.5745628784374615,0.9085350102150449,0.16172890350786212,,,,,,,,,,,0.2170087237986556,,
|
| 3 |
+
ye2026_sepsis,0.6029270442284831,0.4750523423944086,0.3618246783833512,0.2554670801971232,0.2533386702661269,0.5267612711229187,0.31594581626202867,0.2531577574908379,0.09471562043764327,0.46874787884206276,37.0,23.0,21.0,0.5022299158951089,0.43526410070392063,6.0
|
| 4 |
+
ji2025_chili,0.8832571878464304,1.054524674985768,0.5044992874562503,0.1857896942054881,0.20352470183066124,0.47928798340225065,0.2398746224459366,0.21227266152493962,0.02042361532730819,0.45204372964017614,4.0,15.0,4.0,0.575388570715078,0.2730887293849816,0.0
|
| 5 |
+
imperial_eskd,0.8870870830413495,1.0215635566013643,0.37638560875745664,0.5684615839866303,0.5843506673991777,0.8187448084273437,0.6606053132085035,0.6388431994811914,0.11228628082302743,0.6899314750539278,91.0,143.0,84.0,0.5203155086290455,0.7053598964433999,87.0
|
| 6 |
+
giroux2022,1.8027760246078957,0.8778647964495544,0.2580442754044374,0.40594570910829286,0.40810658821060636,0.46094848304079133,0.5752659929360795,0.5750505878963892,0.02157078325029122,0.3230347269696575,3.0,5.0,5.0,0.24307690277174857,0.5372927269740906,0.0
|
paper-releases/pbisc-diffusion/updates/20261008T050202Z-scsemi-imperial-deck/diffusion/dataset/server_1/model8/plans/bayesprism_paired_20261006/tools/build_archive_request.py
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Archive-maintenance request (paper-release-20260928/maintenance/POLICY.md, project pbisc-diffusion) for the
|
| 3 |
+
2026-10-08 deconvolution + scSemiProfiler update. CPU only; reads files, writes the request and one manifest.
|
| 4 |
+
|
| 5 |
+
Payload (server_1):
|
| 6 |
+
this plan tools, README, results/ (tables, summaries, RESULTS*.md), logs (credential-free; checked by count),
|
| 7 |
+
small inputs metadata (SPLIT.json, state_types.tsv, AGGREGATES*.json, INPUT.json, hires_genes.txt),
|
| 8 |
+
BayesPrism theta + genes_used (both gene modes), CIBERSORTx fractions / signature / phenoclasses /
|
| 9 |
+
run logs
|
| 10 |
+
paired FT new scSemiProfiler score units (Giroux and sepsis 5-fold, sepsis equal budget, Giroux without
|
| 11 |
+
sex-linked genes, contrast and realism extras) and today's finalize / scoring logs
|
| 12 |
+
deck every deck file; unchanged ones are skipped by update.py (same sha already archived)
|
| 13 |
+
Large outputs kept in place, listed with bytes + sha256 in results/LARGE_OUTPUTS_SHA256.tsv (archived): BayesPrism Z
|
| 14 |
+
(full mode), CIBERSORTx HiRes, source GEPs, S-mode adjusted mixtures, inferred reference copies, per-state aggregates.
|
| 15 |
+
Inference locations: the pooled scSemiProfiler NPZs (receipt = POOL_MANIFEST.json); fold NPZs are registered already.
|
| 16 |
+
usage: build_archive_request.py OUT.json
|
| 17 |
+
"""
|
| 18 |
+
from __future__ import annotations
|
| 19 |
+
|
| 20 |
+
import glob
|
| 21 |
+
import hashlib
|
| 22 |
+
import json
|
| 23 |
+
import sys
|
| 24 |
+
from pathlib import Path
|
| 25 |
+
|
| 26 |
+
P = Path(__file__).resolve().parents[1]
|
| 27 |
+
FT = Path("/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paired_finetune_intradataset_20260927")
|
| 28 |
+
DECK = Path("/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/"
|
| 29 |
+
"2026-09-30--paper-summary--r00")
|
| 30 |
+
LARGE_CX = ("CIBERSORTx_refsample_inferred_refsample.txt", "CIBERSORTx_Mixtures_Adjusted.txt",
|
| 31 |
+
"CIBERSORTx_cell_type_sourceGEP.txt")
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def sha(p: Path) -> str:
|
| 35 |
+
h = hashlib.sha256()
|
| 36 |
+
with open(p, "rb") as f:
|
| 37 |
+
for b in iter(lambda: f.read(1 << 22), b""):
|
| 38 |
+
h.update(b)
|
| 39 |
+
return h.hexdigest()
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def files(root: Path, patterns, exclude=lambda p: False):
|
| 43 |
+
out = set()
|
| 44 |
+
for pat in patterns:
|
| 45 |
+
for f in glob.glob(str(root / pat), recursive=True):
|
| 46 |
+
q = Path(f)
|
| 47 |
+
if q.is_file() and not q.is_symlink() and "__pycache__" not in q.parts and not exclude(q):
|
| 48 |
+
out.add(q)
|
| 49 |
+
return sorted(out)
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def main(out: str) -> int:
|
| 53 |
+
assets = []
|
| 54 |
+
|
| 55 |
+
def add(paths, kind):
|
| 56 |
+
for p in paths:
|
| 57 |
+
assets.append({"host": "server_1", "source": str(p), "kind": kind, "state": "completed"})
|
| 58 |
+
|
| 59 |
+
# ---- large outputs: manifest only
|
| 60 |
+
large = (files(P, ["inputs/*/*_full/bp/Z_type_*.tsv.gz", "cibersortx/*/*/out_hires/CIBERSORTxHiRes_*.txt",
|
| 61 |
+
"data/*/aggregates*.npz"])
|
| 62 |
+
+ [q for n in LARGE_CX for q in files(P, [f"cibersortx/*/*/out_fractions/{n}"])])
|
| 63 |
+
man = P / "results" / "LARGE_OUTPUTS_SHA256.tsv"
|
| 64 |
+
man.write_text("path\tbytes\tsha256\n" + "".join(f"{q.relative_to(P)}\t{q.stat().st_size}\t{sha(q)}\n" for q in large))
|
| 65 |
+
# ---- this plan
|
| 66 |
+
add(files(P, ["tools/*.py", "tools/*.sh", "tools/*.R"]), "code")
|
| 67 |
+
add(files(P, ["README.md"]), "document")
|
| 68 |
+
add(files(P, ["results/**/*.csv", "results/**/*.json", "results/*.tsv"]), "table")
|
| 69 |
+
add(files(P, ["results/*.md"]), "report")
|
| 70 |
+
add(files(P, ["logs/*.log"]), "log")
|
| 71 |
+
add(files(P, ["inputs/*/*/SPLIT.json", "inputs/*/*/state_types.tsv", "data/*/AGGREGATES*.json",
|
| 72 |
+
"cibersortx/*/*/INPUT.json", "cibersortx/*/*/hires_genes.txt"]), "metadata")
|
| 73 |
+
add(files(P, ["inputs/*/*/bp/theta_*.csv", "inputs/*/*/bp/genes_used.txt"]), "data")
|
| 74 |
+
add(files(P, ["cibersortx/*/*/out_fractions/CIBERSORTx_Adjusted.txt",
|
| 75 |
+
"cibersortx/*/*/out_fractions/CIBERSORTx_sigmatrix_Adjusted.txt",
|
| 76 |
+
"cibersortx/*/*/out_fractions/CIBERSORTx_refsample_inferred_phenoclasses*.txt",
|
| 77 |
+
"cibersortx/*/*/out_hires/fractions_results.txt"]), "data")
|
| 78 |
+
add(files(P, ["cibersortx/*/*/out_fractions/.run.log", "cibersortx/*/*/hires_run.log"]), "log")
|
| 79 |
+
# ---- paired fine-tuning plan: new scSemiProfiler units
|
| 80 |
+
units = ["scores/giroux2022/scsemi_cv_20261002", "scores_nosex/giroux2022/scsemi_cv_20261002",
|
| 81 |
+
"scores/ye2026_sepsis/scsemi_cv_20261002", "scores/ye2026_sepsis/scsemi_budget_20261002",
|
| 82 |
+
"scores/imperial_eskd/scsemi_cv_20261002"] + \
|
| 83 |
+
[f"scores_contrast/{d}/scsemi_cv_20261002" for d in ("ye2026_sepsis", "giroux2022", "imperial_eskd")] + \
|
| 84 |
+
[f"scores_extra/{d}/scsemi_cv_20261002" for d in ("immicro", "ye2026_sepsis", "ji2025_chili", "giroux2022",
|
| 85 |
+
"imperial_eskd")]
|
| 86 |
+
for u in units:
|
| 87 |
+
fs = files(FT, [f"{u}/**/*"])
|
| 88 |
+
add([q for q in fs if q.suffix in (".csv", ".json", ".tsv", ".parquet")], "table")
|
| 89 |
+
add([q for q in fs if q.suffix == ".md"], "report")
|
| 90 |
+
add(files(FT, ["logs/finalize_scsemi_*server1_20261008*.log", "logs/score-giroux2022-scsemi_cv_20261002-*_20261008*.log",
|
| 91 |
+
"logs/score-ye2026_sepsis-scsemi_budget_20261002-*_20261008*.log", "logs/pool-*_20261008*.log",
|
| 92 |
+
"logs/scores_nosex-giroux2022-scsemi_cv-pooled_20261008*.log", "logs/extra-scsemi-cv_20261008*.log",
|
| 93 |
+
"logs/finalize_scsemi_cv_imperial_server1_20261008*.log",
|
| 94 |
+
"logs/score-imperial_eskd-scsemi_cv_20261002-*_20261008*.log",
|
| 95 |
+
"logs/extra-imperial-scsemi-cv_20261008*.log",
|
| 96 |
+
"scores_contrast/_logs/cx-sepsis-giroux-scsemi-cv_20261008*.log",
|
| 97 |
+
"scores_contrast/_logs/cx-imperial-scsemi-cv_20261008*.log"]), "log")
|
| 98 |
+
# ---- deck
|
| 99 |
+
add(files(DECK, ["*.pptx", "*.pdf"]), "report")
|
| 100 |
+
add(files(DECK, ["README.md"]), "document")
|
| 101 |
+
add(files(DECK, ["generate_deck.py", "tools/*.py"]), "code")
|
| 102 |
+
add(files(DECK, ["figures/*.png", "figures/*.pdf", "figures/*.svg"]), "figure")
|
| 103 |
+
add(files(DECK, ["data/*.csv"]), "table")
|
| 104 |
+
add(files(DECK, ["data/*.json"]), "config")
|
| 105 |
+
# ---- inference locations: pooled scSemiProfiler NPZs
|
| 106 |
+
locs = []
|
| 107 |
+
for ds, sub in (("giroux2022", "pooled_scsemi_cv_20261002"), ("ye2026_sepsis", "pooled_scsemi_cv_20261002"),
|
| 108 |
+
("ye2026_sepsis", "pooled_scsemi_budget_20261002"), ("imperial_eskd", "pooled_scsemi_cv_20261002")):
|
| 109 |
+
d = FT / "generated" / ds / sub
|
| 110 |
+
m = json.loads((d / "POOL_MANIFEST.json").read_text())
|
| 111 |
+
for arm, a in m["arms"].items():
|
| 112 |
+
got = sha(Path(a["path"]))
|
| 113 |
+
if got != a["sha256"]:
|
| 114 |
+
raise SystemExit(f"{a['path']}: sha differs from POOL_MANIFEST.json")
|
| 115 |
+
locs.append({"artifact_role": "inference_output", "cohort": ds, "experiment": f"scsemi_{sub[7:]}",
|
| 116 |
+
"host": "server_1", "path": a["path"], "receipt": str(d / "POOL_MANIFEST.json"),
|
| 117 |
+
"sha256": got, "output_sha256": got, "state": "completed",
|
| 118 |
+
"note": f"scSemiProfiler {arm}, five test folds pooled (pool_folds.py); fold NPZs registered earlier"})
|
| 119 |
+
# fold NPZs: the server_1 copies used by the finalize (sha-checked against the server_2 receipts), and Imperial
|
| 120 |
+
# fold 4 on server_2, finished 2026-10-08 13:45 KST
|
| 121 |
+
for ds in ("giroux2022", "imperial_eskd"):
|
| 122 |
+
for k in range(5):
|
| 123 |
+
npz = FT / "generated" / ds / f"fold{k}" / "scsemi__raw.npz"
|
| 124 |
+
rec = npz.with_suffix(".log")
|
| 125 |
+
want = json.loads(rec.read_text())["output_sha256"]
|
| 126 |
+
if sha(npz) != want:
|
| 127 |
+
raise SystemExit(f"{npz}: sha differs from its receipt")
|
| 128 |
+
locs.append({"artifact_role": "inference_output", "cohort": ds, "experiment": "scsemi_cv_20261002",
|
| 129 |
+
"host": "server_1", "path": str(npz), "receipt": str(rec), "sha256": want,
|
| 130 |
+
"output_sha256": want, "state": "completed",
|
| 131 |
+
"note": "sha-checked copy of the spark-0110 original, used for the server_1 finalize"})
|
| 132 |
+
if ds == "imperial_eskd" and k == 4:
|
| 133 |
+
locs.append({"artifact_role": "inference_output", "cohort": ds, "experiment": "scsemi_cv_20261002",
|
| 134 |
+
"host": "server_2", "path": str(npz), "receipt": str(rec), "sha256": want,
|
| 135 |
+
"output_sha256": want, "state": "completed",
|
| 136 |
+
"note": "original; run finished 2026-10-08 13:45 KST (queue scsemi-queue-cv-gi-s2, success)"})
|
| 137 |
+
req = {"project_id": "pbisc-diffusion",
|
| 138 |
+
"summary": ("2026-10-08: bulk deconvolution with the same paired donors (BayesPrism recommended genes + score-gene "
|
| 139 |
+
"sensitivity; official CIBERSORTx Fractions S-mode + HiRes under qemu on server_1) scored with the "
|
| 140 |
+
"paired benchmark's own truth and scorer (plans/bayesprism_paired_20261006, README + RESULTS*.md); "
|
| 141 |
+
"new scSemiProfiler results (5-fold CV of Giroux, sepsis and Imperial, finalized on server_1 from "
|
| 142 |
+
"sha-checked fold copies; Giroux without sex-linked genes; sepsis equal budget; contrast and realism "
|
| 143 |
+
"extras), so scSemiProfiler 5-fold now covers all five cohorts; paper-summary deck updated (two "
|
| 144 |
+
"Supplementary slides, Fig. 3 scSemiProfiler slides refreshed; 64 slides). Large deconvolution "
|
| 145 |
+
"outputs stay on server_1, listed with sha256 in results/LARGE_OUTPUTS_SHA256.tsv."),
|
| 146 |
+
"assets": assets, "inference_locations": locs}
|
| 147 |
+
Path(out).write_text(json.dumps(req, indent=1))
|
| 148 |
+
kinds = {}
|
| 149 |
+
for a in assets:
|
| 150 |
+
kinds[a["kind"]] = kinds.get(a["kind"], 0) + 1
|
| 151 |
+
print(json.dumps({"assets": len(assets), "by_kind": kinds, "locations": len(locs), "large_outputs": len(large),
|
| 152 |
+
"large_bytes": sum(q.stat().st_size for q in large)}, indent=1))
|
| 153 |
+
return 0
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
if __name__ == "__main__":
|
| 157 |
+
sys.exit(main(sys.argv[1]))
|