adibvafa's picture
mean-pool cell embeddings: 47 genetic + 47 chemical contexts, STATE 2058-d
6a4dccc verified
|
Raw History Blame Contribute Delete
3.33 kB
---
license: cc-by-nc-4.0
tags:
- biology
- single-cell
- perturbation
- cell-embeddings
extra_gated_prompt: >-
These embeddings are released for non-commercial academic research. Please
tell us who you are and what you plan to use them for.
extra_gated_fields:
Name: text
Affiliation: text
Intended use: text
I will use these embeddings for non-commercial research only: checkbox
---
# BioReasonCell — cell embeddings
Mean-pooled cell-state embeddings for the perturbation datasets used by
[BioReasonCell](https://huggingface.co/wanglab). One vector per biological context, consumed by the
model as the `<|CELL_START|> … <|CELL_END|>` block.
## `mean_pool/`
| folder | vectors | contexts |
|---|---:|---|
| `mean_pool/genetic/` | 47 | CRISPRi / CRISPRa screens — Kaufman2025 (6 lines × 5 stimuli), Replogle (K562 gwps, RPE1), Norman, Papalexi, Marson (D1–D4), Xaira (HCT116, HEK293T), Xu2026, HepG2 / Jurkat / iPSC |
| `mean_pool/chemical/` | 47 | Tahoe drug screen — one per cell line |
Every file is a **1-D `torch.float32` tensor of shape `(2058,)`**, the per-context mean of STATE
(`st-se-replogle-full`) cell embeddings over that context's control cells. 936 KB total.
These are **cell-state** vectors, not perturbation vectors: the same file is used for every
perturbation measured in that context, and the perturbation itself reaches the model through the
prompt text. The genetic and chemical sets are disjoint in filename, so the two folders can be
merged into one directory if you prefer a single source.
## Filenames are lookup keys — do not rename
A file's name (minus `.pt`) is exactly the key the loader resolves. Given a dataset row's
`cell_file`, the key is built by stemming **twice**:
```python
from pathlib import Path
key = Path(Path(row["cell_file"]).stem).stem # collate.py stems an already-stemmed column
emb = torch.load(f"{cell_file_dir}/{key}.pt") # -> (2058,) float32
```
The double stem is deliberate and load-bearing. `tahoe_Panc 03.27_merged.h5ad` resolves to
`tahoe_Panc 03.pt`, because `.27_merged` is read as a suffix — so that file is correctly named and
renaming it to `tahoe_Panc 03.27_merged.pt` would break the lookup. Names also contain spaces
(`tahoe_SW 1088_merged.pt`, `tahoe_AN3 CA_merged.pt`); keep them.
## Use
```python
from huggingface_hub import snapshot_download
local = snapshot_download("wanglab/BioReasonCell-embeddings", repo_type="dataset")
# then point the training / eval config at the folder you want:
# cell_file_dir: {local}/mean_pool/chemical
```
The loader (`bioreason_cell/dataset/cell_embedding_store.py`) takes a directory of per-cell `.pt`
files and casts each to bfloat16, unsqueezing 1-D tensors to `(1, 2058)`.
## Coverage
Verified against the sampled batches under the double-stem transform: **47/47** keys present for
chemical (`chemical_tahoe_v1.2_50k`, `chemical_tahoe_10k`) and **47/47** for genetic
(`genetic_v7.5_50k`, `genetic_v7.6_50k`, `genetic_v7.6_relabel`, `genetic_batch1_5k`), with no
missing keys in either. Train and test splits draw from the same context pool, so one folder covers
both.
## Related
- `wanglab/BioReasonCell-ReasoningData` — perturbation rows, gene/pathway/cell annotations
- `wanglab/BioReasonCell-ExperimentData` — per-experiment train/validation/test splits