Skip to content

Commit 53f2466

Browse files
Merge pull request #6 from lagillenwater/restore-custom-loaders
Restore custom loaders
2 parents eb31fcc + 44d0ba6 commit 53f2466

53 files changed

Lines changed: 5072 additions & 327 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
Foundation-model evaluation harness for patient-derived tumor organoid (PDTO) drug-response prediction. Realizing the benefits of foundation models requires careful evaluations that map the boundaries of generalization.
44

5-
The harness produces a registry-backed report comparing three models against three out-of-distribution split strategies on two PDTO datasets, with negative/positive controls, bootstrap confidence intervals, and a pretraining-leakage exposure profile per result.
6-
7-
See [docs/fm-pdo-evaluator-plan.md](docs/fm-pdo-evaluator-plan.md) for the 3-week plan.
5+
The harness trains a fixed downstream head on cell-line drug screens (GDSC2) and tests it, frozen, on sarcoma organoids (Soragni 2024), comparing foundation-model embeddings (Stack) against simple expression baselines under negative and positive controls. It is the companion code for *Prospective Evaluation of Foundation Model Performance in Precision Medicine* (greenelab/fm-pm-eval-manuscript).
86

97
## Quickstart
108

@@ -19,11 +17,76 @@ uv sync --extra dev
1917
uv run pytest
2018
```
2119

20+
## Evaluation design
21+
22+
A model is scored as a **representation** (PCA/NMF of expression, or a Stack embedding) fed to a swappable **head** (linear ridge or RBF kernel ridge). The head is trained on GDSC2 cell lines and frozen, then asked to predict held-out Soragni organoids. Negative (within-drug permutation) and positive (planted interaction) controls bracket every result. See [docs/models.md](docs/models.md) for each model and [docs/adapter_contract.md](docs/adapter_contract.md) for the encoder interface.
23+
24+
```mermaid
25+
flowchart LR
26+
G[GDSC2 sarcoma<br/>cell lines] --> R
27+
S[Soragni PDTOs<br/>organoids] --> R
28+
subgraph R[Representation]
29+
E[log1p CPM<br/>expression PCA/NMF]
30+
K[Stack-Large<br/>embedding]
31+
end
32+
R --> H
33+
subgraph H[Head]
34+
L[linear ridge<br/>SimpleProbe]
35+
N[RBF kernel ridge<br/>KernelProbe]
36+
B[bilinear<br/>z, g, z⊗g]
37+
end
38+
H --> T[train on GDSC2,<br/>predict frozen on Soragni]
39+
T --> M[metrics:<br/>interaction rho,<br/>within-drug rho,<br/>regret@k]
40+
M --> C{controls}
41+
C --> NEG[negative:<br/>within-drug permutation]
42+
C --> POS[positive:<br/>planted interaction]
43+
```
44+
2245
## Datasets
2346

24-
- **Soragni 2024** sarcoma PDTOs ([Synapse PDTOSarcoma](https://www.synapse.org/PDTOSarcoma))
25-
- **Yang 2024** primary liver cancer PDOs ([Cancer Cell](https://www.cell.com/cancer-cell/fulltext/S1535-6108(24)00089-8))
47+
- **Soragni 2024** sarcoma PDTOs ([Synapse PDTOSarcoma](https://www.synapse.org/PDTOSarcoma)) — 17 matched organoids, 21 drugs shared with GDSC2 by PubChem CID
48+
- **GDSC2** sarcoma cell lines (DepMap RNA-seq + GDSC2 screen) — 28 lines, the powered training cohort
49+
- **Yang 2024** primary liver cancer PDOs ([Cancer Cell](https://www.cell.com/cancer-cell/fulltext/S1535-6108(24)00089-8)) — deferred to v2
50+
51+
The cohorts and the shared drug panel (the raw inputs, no model):
52+
53+
![Cohort composition](docs/figures/cohort_composition.png)
54+
![Response distributions](docs/figures/response_distributions.png)
55+
![Soragni organoid x drug viability](docs/figures/soragni_response_heatmap.png)
56+
![Shared drug panel](docs/figures/shared_panel.png)
57+
58+
Regenerate with `uv run python scripts/plot_data.py`.
59+
60+
## Results
2661

62+
**A Stack-Large embedding gives no advantage over PCA of expression for sarcoma drug response.** In-distribution (within GDSC2 sarcoma), the embedding signal beyond the drug mean is, if anything, weaker than expression PCA (interaction rho: expression 0.224 > Stack 0.199 > subtype 0.138). Out of distribution (GDSC2 → Soragni, frozen), the transcriptome models collapse toward the drug-mean prior, and the predictive signal lives in the functional organoid screens rather than the transcriptome. Positive controls confirm each apparatus has full power when signal is planted in its own representation, so the null is biological, not a dead pipeline.
63+
64+
### Head-invariance
65+
66+
The headline comparison rides on a *linear* head, so the obvious objection is that a foundation-model embedding might only pay off under a *nonlinear* head. Running the same frozen GDSC2 → Soragni transfer through linear ridge, RBF kernel ridge, and the bilinear model shows the result holds across head families — the nonlinear head does **not** rescue Stack:
67+
68+
| head | representation | interaction rho | p |
69+
|---|---|--:|--:|
70+
| linear | expression PCA | +0.130 | 0.105 |
71+
| linear | expression NMF | +0.184 | 0.035 |
72+
| linear | Stack | +0.130 | 0.085 |
73+
| kernel | expression PCA | **+0.225** | 0.005 |
74+
| kernel | Stack | +0.076 | 0.225 |
75+
| bilinear | 16 shared drugs | −0.019 | 0.420 |
76+
77+
Under the linear head expression and Stack tie; under the kernel head **expression rises to 0.225 while Stack stays at 0.076** — the nonlinear capacity benefits expression, not the embedding. Stack ≤ expression is head-invariant.
78+
79+
![Head-invariance](docs/figures/head_invariance.png)
80+
81+
Regenerate the table and figure:
82+
83+
```bash
84+
uv run python scripts/transfer_gdsc_soragni.py --all-heads \
85+
--stack-gdsc stack_gdsc.csv --stack-soragni stack_soragni.csv \
86+
--out results/head_invariance.csv
87+
uv run python scripts/transfer_pharmaformer_lite.py --out results/head_invariance.csv
88+
uv run python scripts/plot_data.py
89+
```
2790

2891
## Affiliation
2992

data/static/drug_xref.parquet

27.8 KB
Binary file not shown.

data/static/manifest.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"dataset": "fmharness_static_assets",
3+
"files": {
4+
"drug_xref.parquet": {
5+
"bytes": 28487,
6+
"cols": 8,
7+
"columns": [
8+
"input_name",
9+
"source",
10+
"source_drug_id",
11+
"pubchem_cid",
12+
"inchikey",
13+
"drugbank_id",
14+
"resolution_method",
15+
"notes"
16+
],
17+
"rows": 655,
18+
"sha256": "449c7dfccc2286c3c76b9bbfe80df49550ddbd7a0d9d12300e629afd9d29a732",
19+
"source_uri": "built://scripts/build/build_drug_xref.py"
20+
}
21+
},
22+
"release": {
23+
"asset_set": "drug_xref_v1"
24+
},
25+
"updated_utc": "2026-05-25T18:14:46+00:00"
26+
}

0 commit comments

Comments
 (0)