一個關於「平均方式、估計量與實驗設計如何扭曲科學結論」的案例研究,用真實的開源 Cell Painting 資料一路走完。
載體是細胞影像「形態指紋」的作用機制(MoA)相似度檢索、候選活性篩選與去偏方法比較。
本頁的影像分割、UMAP、檢索、指紋與統計皆由真實資料預先計算(離線 Python),瀏覽器只讀取結果繪圖;附完整資料來源與一鍵可重現程式。A case study in how averages, estimators and experimental designs distort scientific conclusions, worked
through end to end on real open Cell Painting data. The vehicle is morphological fingerprinting for
mechanism-of-action (MoA) similarity retrieval, candidate-activity screening and a batch-correction comparison.
Segmentation, UMAP, retrieval, fingerprints and statistics are all pre-computed offline in Python from real data;
the browser only renders the results. Full data sources and one-command reproducibility included.
● 真實資料 · real computed◇ 表徵學習+檢索representation learning + retrieval
00 · 這份分析的主題:三個會誤導人的摘要數字00 · The theme of this analysis: three summary numbers that mislead
01 · 資料一覽(真實)01 · Data at a glance (real)
Data at a glance
關於資料:本區塊的運算資料為 (A549 細胞),其每盤 CellProfiler 形態特徵放在 GitHub 上、免帳號可取。
這是與 JUMP-CP 同一套 Cell Painting 分析法與特徵空間的公開資料;目標資料集為 。About the data: this section is computed from (A549 cells); its per-plate CellProfiler
features are hosted on GitHub and need no account. It uses the same Cell Painting assay and feature space as
JUMP-CP; the target dataset is .兩者皆放在 Both live in the Cell Painting Gallery (AWS Registry of Open Data),開源、免費、免 AWS 帳號。 — open, free, no AWS account required.
02 · 原始資料長什麼樣:真實五通道影像(可互動)02 · What the raw data looks like: real 5-channel images (interactive)
核面積分布Nucleus-area distribution此化合物 vs DMSOthis compound vs DMSO
這些是真實影像(JUMP pilot CPJUMP1,U2OS 細胞,每個化合物 1 個 field,5 個螢光通道 + 3 個明場 z 平面)。
「分割」分頁的黃色邊界是本作品自己做的細胞核分割(高斯→Otsu→分水嶺),不是現成標註。通道對應:These are real images (JUMP pilot CPJUMP1, U2OS cells, one field per compound, 5 fluorescence
channels + 3 brightfield z-planes). The yellow outlines on the "Segmented" tab are my own nucleus
segmentation (Gaussian → Otsu → watershed), not pre-supplied annotations. Channel mapping: 方法補充:每顆細胞的細胞質環採互斥領域(環帶像素指派給最近的核),避免密集區域混入鄰近細胞訊號;
DMSO 的指紋依定義為零向量,已排除在最近鄰排序之外。 Method notes: each cell's cytoplasmic ring uses an exclusive territory (ring pixels assigned to the
nearest nucleus) so crowded fields do not mix in neighbouring cells' signal; DMSO's fingerprint is a zero vector by
construction and is therefore excluded from nearest-neighbour ranking.
我的影像特徵指紋My image fingerprint59 個自建特徵 · z-score vs DMSO59 hand-built features · z-score vs DMSO
流程:讀 5 通道 TIFF → 細胞核分割 → 每顆細胞量化形狀/亮度/紋理 → 對 DMSO 標準化。
這是 CellProfiler 的簡化重製版(59 特徵 vs 官方 1,747),目的在展示從影像端到端算出指紋的能力,而非取代 CellProfiler。Pipeline: read 5-channel TIFFs → segment nuclei → quantify shape/intensity/texture per cell → standardize against DMSO.
This is a simplified re-implementation of CellProfiler (59 features vs the official 1,747), meant to demonstrate the
end-to-end image→fingerprint capability, not to replace it.
案例佐證:已知機制對得上嗎?Sanity check: does it match known biology?用我的特徵,不是官方 profileusing my features, not official profiles
兩個最強表型的核大小變化方向相反、且各自符合已知機制——作為管線可運作的 sanity check。
定位:這是案例式的端到端展示,每個化合物只有 1 個 field;證明的是管線能運作、生物學說得通,
不是統計驗證、也不宣稱可泛化。圖中的「細胞」是同一 field 內的觀測值,不是獨立實驗重複,
因此不做也不隱含顯著性檢定;也尚未證明表型強度獨立於細胞密度或細胞死亡。The two strongest phenotypes move nuclear size in opposite directions, each matching its known mechanism —
a sanity check that the hand-built pipeline behaves sensibly. Scope: this is an illustrative end-to-end case
study with one field per compound. It demonstrates pipeline functionality and biological
plausibility — not statistical validation or generalization. The cells shown are observations within a single
field, not independent experimental replicates, so no significance testing is performed or implied; nor is
phenotype strength shown to be independent of cell density or cell death.
以圖檢索:上傳你自己的影像Search by image: upload your own瀏覽器端即時運算 · 簡化版runs live in your browser · simplified
誠實說明:瀏覽器端只做得到簡化分析(單通道灰階、Otsu、連通元件、3 個統計量),
不等於上方 Python 管線的 59 維指紋。真正的分析請用附帶的 image_pipeline.py。Honest caveat: the browser can only do a simplified analysis (single grayscale channel, Otsu,
connected components, three summary statistics) — this is not the 59-D fingerprint from the Python pipeline above.
For the real thing, run the included image_pipeline.py.
03 · 分析流程03 · Analysis pipeline
STEP 1
五通道影像5-channel images
CellProfiler 分割細胞、量化形狀/亮度/紋理/顆粒等 ~1,700 特徵CellProfiler segments cells and quantifies ~1,700 shape / intensity / texture / granularity features
STEP 2
形態指紋Fingerprint
每個 well 壓成一條特徵向量,對 DMSO 對照標準化Each well becomes one feature vector, standardized against DMSO controls
STEP 3
去偏 / 表徵De-bias / represent
特徵選擇+批次校正(sphering / Harmony),彙整成每擾動的共識指紋Feature selection + batch correction (sphering / Harmony), aggregated into a per-perturbation consensus
STEP 4
相似度檢索Similarity retrieval
最近鄰比對已知化合物 → 推測未知擾動的 MoANearest neighbours among known compounds → infer the MoA of an unknown perturbation
STEP 5
候選活性篩選Candidate activity
與 DMSO 對照分布比較,篩出偏離對照的候選活性(heuristic,非顯著性檢定)Compare against the DMSO null to flag candidates (heuristic screen, not a significance test)
表型地圖 UMAPPhenotype map (UMAP)每點=一個真實化合物 · 點擊或搜尋任一藥物each dot = one real compound · click or search any drug
相似度檢索 → MoA 推測Retrieval → inferred MoAnearest neighbours by profile
paclitaxel
最近鄰化合物Nearest neighbour
相似度Similarity
已知 MoAAnnotated MoA
◇ 推測 MoA:—
形態指紋Morphological fingerprintvs DMSO · 依特徵族群平均 z-scorevs DMSO · mean z-score per feature family
影像看得到、標註看不到的機制:以 paclitaxel(紫杉醇) 為查詢,形態最相近的第一名是 KX2-391——資料庫把它標為「Src 抑制劑」,
但 KX2-391(tirbanibulin)其實同時是微管聚合抑制劑,會造成與紫杉醇類似的有絲分裂/微管表型;第二名 CYT-997 則是道地的微管抑制劑。
這正是 image-based drug discovery 的價值:不需知道分子式,看細胞長相就能指出真正的作用機制,甚至補正不完整的文獻標註。Mechanism the image sees but the annotation misses: querying with paclitaxel, the closest morphological
neighbour is KX2-391 — labelled a "Src inhibitor" in the database, yet KX2-391 (tirbanibulin) is in fact
also a tubulin-polymerization inhibitor, producing a mitotic/microtubule phenotype much like paclitaxel's.
The runner-up, CYT-997, is a bona fide tubulin inhibitor. This is exactly the value of image-based drug discovery:
without knowing the molecular structure, cell appearance alone points to the real mechanism — and can even
correct incomplete literature annotations.
以每個化合物的共識指紋與 DMSO 對照中心的 L2 距離為活性分數;門檻取自「只用 DMSO 隨機五孔中位數」的虛無分布第 95 百分位。
這是啟發式篩選、不是顯著性檢定(未做 plate-matched null、未白化、無 per-compound p/FDR);嚴謹版應改用 copairs replicate mAP+permutation p-value+FDR。
多數 Repurposing-Hub 化合物在 A549、此劑量下活性溫和,候選比例落在兩、三成屬合理。Activity score = L2 distance of each compound's consensus fingerprint from the DMSO centroid; the threshold is the
95th percentile of a DMSO-only null (medians of random 5-well groups). This is a heuristic screen, not a significance
test (no plate-matched null, no whitening, no per-compound p-value/FDR); the rigorous version would use copairs
replicate mAP + permutation p-values + FDR. Most Repurposing-Hub compounds are only mildly active in A549 at this dose,
so a candidate fraction in the twenties/thirties is reasonable.
誠實的基準線:在單一批次、未做進階校正的 pilot 標準化特徵上,最近鄰 MoA 命中率約
(約 倍於隨機;隨機基準 已排除自身、依合格查詢的 MoA 類別大小計算)。
這個「不高但明顯優於隨機」的數字正是切入點:更強的表徵(自監督 embedding)與經驗證的批次校正有機會把它往上推
(見下方方法比較——去偏必須實測驗證,效果隨設定而變)。此為與「藥物性質預測」紅海不同的差異化方向。An honest baseline: on single-batch, minimally corrected pilot features, nearest-neighbour MoA accuracy is about
(≈ chance; the random baseline
excludes the query itself and is matched to eligible-query MoA class sizes). Modest but clearly above chance —
and that gap is the point of attack: stronger representations (self-supervised embeddings) and validated batch
correction can push it up (see the comparison below — de-biasing must be measured, and its effect depends on the setup).
This is the differentiated direction, away from the crowded "molecule → property prediction" space.
05b · 方法比較:去偏是否有效(真實 · 含 95% CI)05b · Method comparison: does de-biasing help? (real, with 95% CI)
估計量提醒:本節的 mAP 走的是「先標準化 well → 再做 compound consensus」的管線;
05d 逐 MoA 那節走的是「先做 consensus → 再標準化」。兩者都合理、各自內部一致,但是不同的表徵,數值不可互相比較。Estimator note: the mAP in this section comes from a
standardise-wells-then-build-consensus pipeline; the per-MoA section 05d builds the consensus first and standardises after.
Both are legitimate and each is internally consistent, but they are different representations and the numbers are not comparable to one another.
批次去偏對 MoA 檢索的影響Effect of batch correction on MoA retrieval同一 IR-mAP · 只換前處理 · bootstrap 95% CIsame IR-mAP · only preprocessing differs · bootstrap 95% CI
怎麼讀這張圖How to read this去偏不是免費的correction is not free
關鍵結論:Bottom line:
05c · JUMP-Target 分層驗證:當實驗設計本身是混雜的05c · JUMP-Target stratified validation: when the design itself is confounded
為什麼不能直接對 plate 做批次校正Why you cannot just batch-correct by plate探索性 · CPJUMP1 真實資料exploratory · real CPJUMP1 data
條件關聯結構保留度Condition-associated structure retention1.0 = 該條件的可分辨結構已消失1.0 = that condition is no longer distinguishable
分層後:每個 cell line × timepoint 內各自評估Stratified: evaluated within each cell line × timepointplate 此時才是真正的技術重複only here is plate a genuine technical replicate
關鍵結論:Bottom line:
05d · 逐 MoA 拆解:這個方法在哪裡有效、在哪裡無效05d · Per-MoA breakdown: where this method works and where it does not
各 MoA 類別的檢索表現Retrieval performance by MoA class依 Top-1 排序 · 滑鼠移入看細節sorted by Top-1 · hover for detail
最小類別大小Min class size
完整表格Full table隨機基準每類 < 2.5% · Wilson 區間為描述性random baseline < 2.5% per class · Wilson intervals are descriptive
檢索成敗 vs 表型強度Retrieval success vs phenotype strength每點 = 一個 MoA 類別each point = one MoA class
這張圖回答什麼、不回答什麼What this figure does and does not settle
關鍵結論:Bottom line:
06 · AI 能加什麼?可落地的功能設計06 · What AI adds: deployable feature design
表徵學習 embeddingRepresentation learning
自監督影像編碼器:用 DINO/DINOv2 或 masked autoencoder 直接從五通道影像學 embedding,超越手工 CellProfiler 特徵Self-supervised encoders: learn embeddings directly from 5-channel images with DINO/DINOv2 or a masked autoencoder, going beyond hand-built CellProfiler features
弱監督對比學習:以「同擾動為正對」訓練,讓同 MoA 更靠近Weakly-supervised contrastive learning: treat replicates of the same perturbation as positive pairs so same-MoA compounds pull together
產出可直接餵給下游檢索的 128–512 維指紋Outputs a 128–512-D fingerprint that feeds straight into retrieval
批次去偏 debiasingBatch de-biasing
依 subset 不同:JUMP compound=featureselect+Harmony、CRISPR=sphering+Harmony+PCA、ORF=sphering+Harmony(各另有 interpretable 版)Differs per subset: JUMP compound = feature-select + Harmony; CRISPR = sphering + Harmony + PCA; ORF = sphering + Harmony (each also has an interpretable variant)
以 DMSO 對照做 typical-variation normalization;sphering 需正則化/降維避免放大噪訊Typical-variation normalization against DMSO controls; sphering needs regularization/dimension reduction so it does not amplify noise
雙向驗證:生物保存用 MoA/target 檢索 mAP;批次移除用 kBET / iLISI / plate-label 檢索(kBET 量的是批次混合、不是生物保存);並用 source-aware block bootstrap 給 CIValidate on both axes: biology retention via MoA/target retrieval mAP; batch removal via kBET / iLISI / plate-label retrieval (kBET measures batch mixing, not biology retention); with source-aware block-bootstrap CIs
檢索與解釋 UXRetrieval & explanation UX
以圖找相似藥:上傳/選一個擾動,秒回最近鄰與推測 MoA(本頁雛形)Find similar drugs by image: pick or upload a perturbation, get nearest neighbours and an inferred MoA instantly (prototyped on this page)
向量資料庫(FAISS)撐 10 萬級擾動即時檢索Vector database (FAISS) to serve real-time retrieval over 100k+ perturbations
LLM 助手:把最近鄰、共享 target 與文獻整理成一段機制說明LLM assistant that summarises retrieved neighbours, shared targets and literature into a mechanism narrative
07 · 差異化定位與路線圖07 · Positioning & roadmap
避開紅海:不做「分子結構 → 性質預測」那種過度 benchmark 的題目,改做表徵學習+檢索——輸入是細胞影像,不是分子式。Avoid the crowded space: not another "molecular structure → property prediction" benchmark. This is representation learning + retrieval, and the input is a cell image, not a formula.
切入點:形態指紋的 MoA 檢索 / 批次去偏 / 以圖找相似藥;solo 玩家少、CV 技能可直接用、資料真實龐大。The angle:MoA retrieval, batch de-biasing and image-based drug similarity on morphological fingerprints — few solo developers work here, CV skills transfer directly, and the data is real and large.
路線圖:① 影像→自建指紋(已完成)→ ② CellProfiler profiles+最近鄰檢索(已完成)→ ③ 雙指標+block CI 的去偏驗證(已完成,含真實 JUMP-Target)→ ④ 逐 MoA 拆解與適用範圍界定(已完成)→ ⑤ 自監督影像 embedding → ⑥ 擴到 JUMP cpg0016 全量、建 FAISS 檢索與 LLM 機制解說。Roadmap: ① image → own fingerprint (done) → ② CellProfiler profiles + nearest-neighbour retrieval (done) → ③ dual-metric, block-CI de-biasing validation (done, including real JUMP-Target) → ④ per-MoA breakdown and scope definition (done) → ⑤ self-supervised image embeddings → ⑥ scale to full JUMP cpg0016 with FAISS retrieval and an LLM explanation layer.
可展示成果:互動檢索網頁(本頁)、自建影像管線重現已知機制、去偏雙指標權衡圖(含 CI)、逐 MoA 適用範圍拆解、案例研究(紫杉醇 → 微管群)。Demonstrable output: this interactive app, an in-house image pipeline that recovers known biology, a dual-metric de-biasing trade-off figure with CIs, a per-MoA breakdown that defines where the method applies, and case studies (paclitaxel → tubulin cluster).