ESC
Code & AI · 02

ML & Foundation Models

Two deep-learning projects with deliberately honest evaluation: a CLIP-style contrastive model aligning Cell Painting morphology with L1000 transcriptomics, and a zero-shot probe of single-cell foundation models on neurodegeneration tasks. A live in-browser embedding explorer is below.

morph2expr scgpt-neurodegen-probe Live demo ← All Code & AI
01

morph2expr — CLIP-style alignment of morphology & transcriptomics

morph2expr is a CLIP-style contrastive PyTorch model that learns a shared embedding space between JUMP-CP Cell Painting morphological features and CMAP L1000 transcriptomic signatures, so a query in one modality retrieves perturbations similar in the other.

  • Two-tower contrastive trainer (PyTorch Lightning) with symmetric InfoNCE loss.
  • Perturbation-disjoint splits at every fold — the hardest defensible evaluation protocol.
  • Cross-modal recall@K, MRR, and a random-baseline floor reported in every run.
  • Hydra-driven configuration; RDKit chemistry-aware perturbation handling.

Tech. Python 3.11 · PyTorch · PyTorch Lightning · RDKit · scikit-learn · Hydra · matplotlib.

# morph2expr — symmetric InfoNCE (excerpt) def info_nce(z_img, z_exp, temperature=0.07): z_img = F.normalize(z_img, dim=-1) z_exp = F.normalize(z_exp, dim=-1) logits = z_img @ z_exp.T / temperature labels = torch.arange(z_img.size(0), device=z_img.device) return 0.5 * (F.cross_entropy(logits, labels) + F.cross_entropy(logits.T, labels))
Fig. — Recall@K, image → expression
Held-out perturbations, vs. random-baseline floor.
Representative numbers from the v0.1 checkpoint on JUMP-CP × CMAP L1000 paired data.
02

scgpt-neurodegen-probe — Zero-shot evaluation of scGPT & Geneformer

scgpt-neurodegen-probe runs three zero-shot benchmarks on frozen-weight scGPT and Geneformer embeddings — for example, ranking PD-associated genes above random gene sets in substantia-nigra dopaminergic-neuron contexts — where the ground truth is biologically known. Results are reported symmetrically on positive and negative outcomes.

  • Three biologically-grounded benchmarks; AnnData / Scanpy substrate.
  • Pretrained model loading via 🤗 transformers; no fine-tuning.
  • Negative results documented to push back on the field's tendency to over-claim.

Tech. Python 3.11 · PyTorch · 🤗 transformers · Scanpy · AnnData · scikit-learn · matplotlib.

Fig. — Per-benchmark probe AUROC (illustrative)
scGPT vs Geneformer vs PCA baseline across the three neurodegeneration tasks.
Negative outcomes are kept on the chart; the gap to the baseline is the actionable signal.
03

CLIP-style embedding explorer

Pick a query perturbation in the scatter (or use the dropdown). The demo computes cosine similarity in a 32-dimensional hard-coded "embedding" space and lights up the nearest neighbors in real time. The geometry is illustrative — the retrieval, scoring, and rank rendering are the real thing.

Query perturbation
Top-K neighbors
query: class:
    Each dot is one perturbation in 2D UMAP-style coordinates. Color = mechanism class. Highlighted dots are the K nearest neighbors of the query in the underlying 32-D space.