cryoem-acquisition / README.md
xkronosx's picture
Cryo-EM acquisition dataset: 4 EPU sessions, labels, features, loader + validator
d67b900 verified
|
Raw
History Blame Contribute Delete
6.27 kB
---
license: cc-by-4.0
task_categories:
- reinforcement-learning
- tabular-regression
tags:
- cryo-em
- cryoem
- electron-microscopy
- acquisition
- active-learning
- contextual-bandit
- epu
pretty_name: Cryo-EM Autonomous Acquisition
size_categories:
- 10K<n<100K
configs:
- config_name: combined
data_files:
- split: targets
path: index/combined/target_locations.parquet
- split: labels
path: index/combined/labels_v4_outcomes.parquet
- split: holes
path: index/combined/holes.parquet
- split: geometry
path: index/combined/square_geometry.parquet
---
# Cryo-EM Autonomous Acquisition Dataset
Data for training agents that decide **which grid square and foil hole to image next** during a cryo-EM session, so a sample reaches its target in the fewest acquisitions.
Four EPU sessions derived from public EMPIAR depositions, with per-acquisition outcome labels, pre-acquisition hole features, frozen image embeddings, and orientation-proxy profiles.
| | |
| --- | --- |
| candidate holes | 27,944 |
| acquired holes | 3,936 |
| acquisitions (label rows) | 13,526 (10,595 usable) |
| grid squares | 1,795 |
| sessions | 4 |
| size | ~137 MB |
## Quick start
```bash
pip install huggingface_hub pandas pyarrow numpy
huggingface-cli download xkronosx/cryoem-acquisition --repo-type dataset --local-dir cryoem-acquisition
cd cryoem-acquisition
python -m cryoem_au_data.validate index/combined # check the contract
python example.py # load, features, labels
```
## Layout
```
index/
combined/ all four sessions concatenated ← start here
empiar-11895__epu__grid1/ individual sessions
empiar-13296__epu__delta9/
empiar-13296__epu__delta10/
empiar-13296__epu__deltaRlmE/
empiar-11895__epu__grid1_uncensored/ censoring-ablation variant
features/
combined/embeddings_cryo_ief.parquet 8 PCA columns, keyed by hole_uid
<session>/raw_cryo_ief.parquet raw 768-d Cryo-IEF vectors
bases/ frozen PCA basis for new sessions
orientation/
orientation_class2d.parquet 2D-class view proxy (EMPIAR-11895)
cryoem_au_data/ loader, feature builder, validator
example.py
```
Each index directory holds four parquet tables:
| table | one row per | what it is |
| --- | --- | --- |
| `target_locations.parquet` | candidate hole | every hole EPU's hole-finder proposed — the agent's decision space |
| `holes.parquet` | acquired hole | the subset actually imaged |
| `square_geometry.parquet` | grid square | shape and extent, for geometric features |
| `labels_v4_outcomes.parquet` | **acquisition** | the outcomes — a hole shot 3× has 3 rows |
## The contract
**UIDs.** `session:<name>:square:<id>:hole:<id>`. The `:square:` segment is load-bearing: cross-session validation splits on the substring before it, and without it leave-one-session-out silently degrades into leave-one-hole-out.
**`sample_id`** is the micrograph stem and the join key to labels, orientation profiles and image features.
**Pre- vs post-exposure.** `target_locations` holds only what is knowable *before* firing; `labels_v4_outcomes` holds what came back. `selected` (did a human take this hole) is a legitimate training target but **never a model input** — in deployment the agent is the selector.
**Utility:**
```python
w_ctf = sigmoid((6.0 - ctf_res_adj) / 1.5)
w_ice = 1.0 / (1.0 + max(0, ice_ring - 1.5)) # missing ice => no penalty
utility = curated_count * w_ctf * w_ice # 0 where status != "ok"
```
`ctf_res_adj` is `ctf_res` with the defocus trend removed (level preserved). Those three constants were tuned on EMPIAR-11895 and **do not transfer** — on other sessions the CTF gate saturates or the ice term penalises everything. Re-tuning is a pure relabel; `compute_utility()` takes them as arguments.
**Censoring.** Two statuses mark failures that must not be read as zeros:
- `ctf_unfit` — CTFFIND reports its *search limit* when a fit fails (a sentinel, not a measurement). Those micrographs still yield ~28 real particles.
- `curation_missing` — absent from curation is not zero particles.
## Known limitations
Stated plainly, because they bound what can be concluded:
- **Timestamps exist for only one session** (`deltaRlmE`). The others fall back to a `sample_id` sort — usable but not true chronological order.
- **Label quality varies sharply.** Only EMPIAR-11895 has genuine 2D-curated particle counts (`count_source == "class2d_curated"`); the rest use LoG picks, which carry roughly 7× less learnable signal. `deltaRlmE` has a between-hole to within-hole variance ratio of ~1.07 — its holes are barely separable from shot noise.
- **Transfer between sessions is weak and sometimes negative.** Cross-session rank correlation of a feature→utility model is ≈0.04, and training on the 13296 family and testing on 11895 gives ≈−0.30. Treat this as one session plus a family of three, not four exchangeable domains.
- **Orientation labels are a 2D-class proxy**, available for EMPIAR-11895 only. Class assignment conflates viewing direction with conformation, so coverage conclusions are bounds, not measurements. Real Euler angles from a consensus 3-D refinement would replace it.
## Provenance and licence
Derived from public EMPIAR depositions — [EMPIAR-11895](https://www.ebi.ac.uk/empiar/EMPIAR-11895/) (apoferritin; ships a complete RELION project) and [EMPIAR-13296](https://www.ebi.ac.uk/empiar/EMPIAR-13296/) (70S ribosome, three strains). Cite the original depositions in any work using this data. Derived tables released CC-BY-4.0. No raw movies or micrographs are included — this is metadata and labels only.
## Building a compatible dataset
If you are producing new EPU / cryoSPARC Live data for these agents, run the validator against your index before handing it over:
```bash
python -m cryoem_au_data.validate <your_index_dir>
```
It checks UID grammar, join integrity, the candidate-vs-acquired ratio, the status vocabulary, timestamp coverage, and whether the utility constants still have dynamic range on your data. Every check corresponds to a failure mode that breaks training *silently* rather than loudly.