File size: 35,829 Bytes
c7217ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
# Reproducing CryoDynaScape: every figure and table

This guide maps every display item in the manuscript (`cryodynascape_overleaf/main.tex`) to the runs, result files and
commands that produce it. Paths are relative to the project root (`ROOT=/n/netscratch/kempner_mzitnik_lab/Lab/hxu66/cryodynascape`).
Commands were recovered from three sources, in this order:

1. **`logs/<run>.log`, first line `args {...}`.** `run_pipeline.py`, `run_v1.py`, `run_hinge.py` and `run_rigid.py`
   log every argument, so this is the exact configuration of a run. The same dict is stored under the key `args` in
   `checkpoints/<run>/*.pth`, which is on HF. `logs/` itself is not.
2. **`sacct -P -j <id> -o SubmitLine%2000`.** It records `--wrap` commands and `--export=` variables. Variables set
   with a shell `export` before `sbatch` are not recorded. For those wrappers the `RUN/STAGE1/V1` values below come
   from source 1.
3. The project log (`memory/cryodynascape-project.md`) and `results/SUMMARY.md`.

Items marked **[untraced]** could not be recovered exactly (none affects a number in the manuscript: all AU-FSC latents are traced in `results/official/latent_sources.json`). Items marked **[inferred]** were reconstructed from file
names and shapes, not from a recorded command.

## 0. Shortcut: download instead of recompute

Everything the paper reads is public at <https://huggingface.co/datasets/Xu-AI4Science/CryoDynaScape-data>
(26,652 files, 446 GB). It uses the same relative paths as this repository: `results/`, `checkpoints/`,
`baselines/inputs/`, `baselines/runs/`, `data/synth_*`, `data/Spike-MD-128/`, `data/real/empiar10180_128/` and
`data/real/empiar10076_128/`.

```bash
huggingface-cli download Xu-AI4Science/CryoDynaScape-data --repo-type dataset --local-dir $ROOT \
    --include "results/*"          # figures/tables only need results/ (+ data/* for GT-dependent panels)
```
With `results/` in place, every step in Section 4 that runs on CPU (scripts `fig_*`, `*_compose`, `supp_table_paired`
and `table_hier`) regenerates its figure or table without a GPU. The GT-dependent panels (Fig. 3a/c, Table 2) also
need the CryoBench data from Section 2.

The HF dataset does not contain:
- CryoBench originals or EMPIAR raw micrographs/stacks.
- `data/structures/` (templates, AF3 models).
- The CryoSTAR work dirs (`baselines/cryostar/projects/star/work_dirs/`). The CryoSTAR latents
  `.../<run>_0/0061_0096000/z.npy` are therefore only available locally.
- `logs/`.

## 1. Environments

All wrappers hard-code `/n/holylabs/kempner_mzitnik_lab/Lab/hxu66/conda/envs/<env>`. The env migration to netscratch
was cancelled, so `envs/README.md`, which still names `.../cds_envs/<env>`, is stale on location only. Its specs are
current. To run elsewhere, edit `PY=`, `E=` and `RE=` at the top of each wrapper.

| env | spec in `envs/` | kind | used by |
|---|---|---|---|
| `cryodynascape` | `cryodynascape.requirements.txt` + `.pyvenv.cfg` (Mambaforge Py 3.10.13, torch 2.5.1+cu121) | venv | every `scripts/*.py` of ours, AU-FSC scoring (`official_fsc.py`, `prep_official.py`), all figure/table scripts |
| `recovar` | `recovar.requirements.txt` (Py 3.12, jax 0.9.0.1) | venv | RECOVAR baseline and the kernel-regression generator inside every AU-FSC evaluation |
| `cryodrgn` | `cryodrgn.requirements.txt` (Py 3.12) | venv | cryoDRGN baseline, `write_star.py`, `parse_pose_star` checks |
| `cryostar` | `cryostar.yml` (+ `pip install baselines/cryostar`) | conda | CryoSTAR, `baseline_displacement.py --method cryostar` |
| `cryosphere` | `cryosphere.yml` (numpy<2, torchvision 0.16.2) | conda | cryoSPHERE, `cryosphere_resume.py`, `baseline_displacement.py --method cryosphere` |
| `dynamight` | `dynamight.yml` (+ DynaMight git `358db04d5`) | conda | DynaMight, `dynamight_latent.py` |
| `eman2` | `eman2.yml` (`-c cryoem -c conda-forge eman-dev`) | conda | e2gmm (`run_e2gmm.py`) |
| `cds_render` | `cds_render.yml` (conda-forge `mesalib<24.1`) | conda | OSMesa for headless ChimeraX (`scripts/chimerax_offscreen.sh`) |
| `scipion3`, `oXmipp` | `*.yml` | conda | HEMNMA attempt only (reported n.r.) |

Rebuild:
```bash
python -m venv <path>; <path>/bin/pip install -r envs/<env>.requirements.txt --extra-index-url https://download.pytorch.org/whl/cu121
conda env create -p <path> -f envs/<env>.yml          # conda envs
sbatch scripts/rebuild_envs.sh                         # scripted rebuild of all envs (test partition, CPU)
```
Never create envs on the login node: `conda create` gets OOM-killed there. External software:
- **RELION 5:** built from source; recipe in `envs/README.md`. Used by `submit_baseline_prep.sh` (`relion_reconstruct`)
  and `submit_multibody.sh`.
- **ChimeraX 1.8:** el8 RPM extracted to `.../software/chimerax/root`. Extract with `rpm2cpio | cpio -id` *without*
  `-m`, so files get fresh mtimes and survive the purge.

## 2. Data

| dataset | source | local path | preprocessing |
|---|---|---|---|
| IgG-1D, IgG-RL | CryoBench, Zenodo 11629428 | `data/IgG-1D`, `data/IgG-RL` | none (128 px used directly; pipeline auto-detects contrast and pose convention) |
| Ribosembly, Tomotwin-100 | Zenodo 12528292 | `data/Ribosembly`, `data/Tomotwin-100` | none |
| Spike-MD | Zenodo 14941494 | `data/Spike-MD` → `data/Spike-MD-128` | `scripts/prep_spike128.py` (job 49082715); GT maps: `scripts/spike_frames.py` then `scripts/spike_gt_vols.py` → `data/Spike-MD-128/vols/gt` |
| EMPIAR-10180 | EMPIAR + cryoDRGN EMPIAR inputs (github zhonge/cryodrgn_empiar → `data/real/cryodrgn_empiar`) | `data/real/empiar10180` → `data/real/empiar10180_128` | see below |
| EMPIAR-10076 | same | `data/real/empiar10076` → `data/real/empiar10076_128` | see below |
| synthetic | `scripts/make_synth_hier.py` | `data/synth_*` | see Table 5 |
| structures | RCSB (1N0X, 3AVE, 1HZH, 4YBB); AF3 (`scripts/submit_af3_igg.sh`, `submit_af3_iggrl.sh`) | `data/structures/` | `scripts/build_template_model.py` → `igg_templates.pdb`, `iggrl_templates.pdb` (+ `_domains.npy`); exact build args **[untraced]** |

```bash
sbatch scripts/redownload_cryobench.sh            # IgG-1D, IgG-RL, Ribosembly, Tomotwin-100 (size check, unzip -DD)
sbatch scripts/download_ranges.sh <zenodo-url> data/<X>.zip 16   # ranged download used for the large zips (curl -sf)
sbatch scripts/download_empiar.sh 10180 data/real/empiar10180 24
sbatch scripts/download_empiar.sh 10076 data/real/empiar10076 12
sbatch scripts/redownload_empiar_meta.sh          # 10180 Example/ + Mask-and-Ref/, 10076 Parameters.star/.par
# EMPIAR-10180 (job 48615770, test partition):
python scripts/preprocess_empiar.py --star data/real/empiar10180/data/Example/consensus_data.star \
  --datadir data/real/empiar10180/data --ind data/real/cryodrgn_empiar/empiar10180/inputs/filtered.ind.pkl \
  --poses data/real/cryodrgn_empiar/empiar10180/inputs/poses.pkl --ctf data/real/cryodrgn_empiar/empiar10180/inputs/ctf.pkl \
  --D_out 128 --out data/real/empiar10180_128
# EMPIAR-10076 (job 51770970): same with --star data/real/empiar10076/data/Parameters.star, empiar10076 inputs
```
More inputs:
- **10076 symlink:** `run_hier.sh` reads `particles.mrcs`, so EMPIAR-10076 has a symlink `particles.mrcs → particles.128.mrcs`.
- **RECOVAR particle lists:** RECOVAR reads `data/<DSET>_snr0.01_abs.txt`. Each is the per-state `.mrcs` stack list
  with absolute paths, as RECOVAR ≥0.5 requires. They were written by hand **[untraced one-liner]**: one absolute
  path per stack, in the order of `sorted_particles.128.txt`.
- **Baseline inputs:** `baselines/inputs/<DSET>/` holds a RELION-convention stack, a validated star,
  `particles_halves.star` and `relion_recon.mrc`. Build with
  `DSET=... STAGES="<stage1>:<pdb|none> ..." sbatch scripts/submit_baseline_prep.sh`, which calls
  `prep_baseline_inputs.py`, `write_star.py`, a cryoDRGN round trip, `relion_reconstruct` and `check_star.py`. Spike
  (job 51092976): `DSET=Spike-MD-128 PART=images/particles.128.mrcs STAGES=spike_seed:data/Spike-MD/seed_structure.pdb`.
  CryoSTAR/cryoSPHERE configs come from `scripts/make_baseline_configs.py`.

## 3. Pipeline and dependency order

```
stage 1 (v0)      run_pipeline.py      consensus G0, pose convention, beads, low-rank latent z   -> results/<X>_v0
  two-pass (v0c)  run_pipeline.py --bead_map_from <X>_v0   (beads placed on cluster maps)        -> results/<X>_v0c
domains (v1)      run_v1.py --stage1 <X>_v0c                                                     -> results/<X>_v0c_v1
motion            run_hinge.py (IgG-1D) | run_rigid.py (IgG-RL, Spike, EMPIAR)                   -> <X>_v0c_hinge | _rigid
model selection   model_select.py (BIC low-rank vs domain) ; run_discrete.py --tag L1 (Level-1 discrete classes)
Level 1           level1_relate.py --stage1 <X>_v0c                                              -> level1_relate.json
Level 2           level2_blocks.py ; run_rigid.py ... --run <X>_v0c_rigid2 --domains init --merge v1
Level 3           particle_explain.py --null map --tag _mapnull[_full]                           -> particle_explain*.json/npz
decision          hier_decide.py --run <rigid run> --tag _mapnull[_full]                         -> hier_decide*.json
evaluation        submit_ext_eval.sh / submit_ext_serial.sh (AU-FSC); metrics.json (k-NN, displacement)
```
- **Wrappers:** `scripts/run_hier.sh` runs Level 1 → v1 → Level 2 → rigid2 → `particle_explain` → `hier_decide`
  end to end (`NAME=... DATA=... [L1_ARGS=...] sbatch scripts/run_hier.sh`) and resumes on resubmit.
  `scripts/submit_level23.sh` (`S1=... V1=... IN="..." [RIGID_ARGS=...]`) runs Levels 2–3 on an existing v0c/v1 pair.
- **AU-FSC (official protocol):** `prep_official.py` writes `query.npy`, which is `arange(0, N, N//100)`, plus
  `<NAME>_emb.pkl/_targets.txt`. `recovar reconstruct_from_external_embedding` then writes
  `results/official/<TAG>/extp_<NAME>/state###.mrc`. Finally `official_fsc.py` (CryoBench FSC logic) writes
  `score_ext_<NAME>.json`, which holds the mean and the per-query values. Latent specs are `path.h5:key`,
  `path.npy` or `recovar:<dir>:<zdim>`. `theta_all` gives the (cos, sin) of every hinge angle.
  ```bash
  DSET=IgG-1D TAG=igg1d NAME=hinge_v0c LATENT=$ROOT/results/igg1d_v0c_hinge_test_results.h5:theta_all sbatch scripts/submit_ext_eval.sh
  sbatch --export=ALL,EVALS="DSET|TAG|NAME|LATENT DSET|TAG|NAME|LATENT ..." scripts/submit_ext_serial.sh
  ```
  Run evaluations **serially**, one GPU and one at a time: the generator uses 2–5 % of the GPU, which is why the lab
  rule requires serial runs. `submit_ext_serial.sh` skips any eval whose `score_ext_*.json` already exists, so a
  timed-out chain can simply be resubmitted (example: job 51165569). Each eval takes ~1–1.5 h, about 3 h on
  Ribosembly. The serial wrapper caps each at `timeout 170m`.

### 3.1 Recovered commands for the core runs

The variables in front of `sbatch` are taken from the args in `logs/<run>.log`. Job IDs come from `logs/queue_*.log`
and sacct.

| run(s) | command (job) |
|---|---|
| `igg1d_v0` | `sbatch scripts/submit_igg1d.sh` (48235447) |
| `igg1d_v0c` → `_v1` → `_hinge` | `RUN=igg1d_v0c sbatch scripts/submit_igg1d.sh --bead_map_from igg1d_v0` (48911691); `RUN=igg1d_v0c_v1 STAGE1=igg1d_v0c sbatch scripts/submit_v1_igg1d.sh` (48911692); `RUN=igg1d_v0c_hinge STAGE1=igg1d_v0c V1=igg1d_v0c_v1 sbatch scripts/submit_hinge_igg1d.sh --n_axes 100 --rest x0` (48911693) |
| `iggrl_v0`, `iggrl_v0c` → `_v1` → `_rigid` | `DSET=IgG-RL PERIOD=0 RUN=iggrl_v0 sbatch scripts/submit_igg1d.sh`; then `RUN=iggrl_v0c ... --bead_map_from iggrl_v0` (48912675); `RUN=iggrl_v0c_v1 STAGE1=iggrl_v0c DSET=IgG-RL PERIOD=0 sbatch scripts/submit_v1_igg1d.sh` (48912676); `RUN=iggrl_v0c_rigid STAGE1=iggrl_v0c V1=iggrl_v0c_v1 sbatch scripts/submit_rigid.sh --rest x0 --em_rounds 4 --flip_pool 50 --fast_coarse --c2f 0:25:32,14:12:8,7:8:2,3.5:6:1` (48912677) |
| `ribo_v0`, `ribo_v0c` → `_v1` → `_rigid` | `ribo_v0`: `run_pipeline.py ... --n_beads 2000 --K 8 --epochs_homo 3 --epochs 30 --n_clusters 16` (see log); `ribo_v0c` = same `--bead_map_from ribo_v0 --labels ... --gt_vols data/Ribosembly/vols/128_org` (48931595, `--wrap`); `run_v1.py --stage1 ribo_v0c --run ribo_v0c_v1 --Ke 4 --epochs 20` (48931632); `run_rigid.py --stage1 ribo_v0c --v1 ribo_v0c_v1 --run ribo_v0c_rigid --rest x0 ...` (48931635; full args in log) |
| `tomo_v0`, `tomo_v0c` → `_v1` → `_rigid` | `DSET=Tomotwin-100 PERIOD=0 RUN=tomo_v0 sbatch scripts/submit_igg1d.sh` (48943326); `RUN=tomo_v0c ... --bead_map_from tomo_v0` (48943329); v1 (48943337); `submit_rigid.sh --rest x0 --em_rounds 1 --sweeps 1 --fast_coarse --pop_prior 50 --c2f ...` (48943338) |
| `spike_v0` → `spike_v0c` → `_v1` → `_rigid` | `--wrap` jobs 49083864/65/67/71: `run_pipeline.py --particles data/Spike-MD-128/images/particles.128.mrcs ... --run spike_v0 --n_beads 2000 --K 8 --epochs_homo 3 --epochs 30 --n_clusters 20`; then v0c (`--bead_map_from spike_v0`), `run_v1.py --Ke 4 --epochs 20`, `run_rigid.py --rest x0 --em_rounds 4 --flip_pool 50 ...` |
| model selection | `model_select.py --stage1 <X>_v0c --domain_run <X>_v0c_hinge|_rigid --kind hinge|rigid ...` (48913204, 48923258, 48931636, 48943341) → `results/*/model_select_*.json` |
| Level-1 discrete (Ribosembly, Tomotwin) | `run_discrete.py --stage1 ribo_v0 ... --n_sub 20000 --Ds 64 --Ks 5,10,16,25 --n_iter 6 --domain_run ribo_v0c_rigid --domain_kind rigid --domain_stage1 ribo_v0c --apply_all --tag L1` (48974832) → `results/ribo_v0/L1_posterior_K16.npy`; Tomotwin the same with `--stage1 tomo_v0 --Ks 75,100,125 --domain_run tomo_v0c_rigid` (48974831) → `results/tomo_v0/L1_posterior_K100.npy`; Spike: `run_discrete.py --stage1 spike_v0 ... --Ks 1,10,50,100,200 --domain_run spike_v0c_rigid` (49083885) → low-rank selected (`results/spike_v0/L1.json`) |

## 4. Display items

### Fig. 1 — Overview (`figures/fig1_overview.pdf` = `results/figures/overview.pdf`)
- Inputs: icon renders `results/figures/ribo/test.png`, made with `bash scripts/chimerax_offscreen.sh scripts/diag/cx_test.cxc`
  (job 51430342). It also uses `ribo/class05,12,06.png` (Fig. 4 render) and `morph/igg1d_still0,2.png` (Fig. 3b).
- Command: `python scripts/fig_overview.py --out results/figures/overview` (job 51505455, test partition).

### Fig. 2 — AU-FSC benchmark (`fig2_benchmark.pdf` = `results/figures/benchmark.pdf`)
- Reads the numbers from `tab:bench` in `main.tex`, so it always matches Extended Data Table 1. Regenerate the table
  first (ED Table 1 below).
- `python scripts/fig_benchmark.py --tex ../cryodynascape_overleaf/main.tex --out results/figures/benchmark` (job 51405401).

### Fig. 3 — Recovered motion (`fig3_motion.pdf` = `results/figures/fig3.pdf`)
| panel | run | data | command |
|---|---|---|---|
| a | `igg1d_v0c_hinge` | `results/igg1d_v0c_hinge_test_results.h5` (`theta_mean_dom1`, `labels`) | composed in `fig3_compose.py` |
| b | `igg1d_v0c_hinge` | `results/igg1d_v0c_hinge/hinge1_traj_ca.pdb` | `python scripts/fig_morph.py --traj results/igg1d_v0c_hinge/hinge1_traj_ca.pdb --h5 results/igg1d_v0c_hinge_test_results.h5 --out results/figures/morph/igg1d && bash scripts/chimerax_offscreen.sh results/figures/morph/igg1d.cxc` (job 51458988; the still/strip post-processing inline `python -c` in that job is **[untraced]**, truncated in sacct) |
| c | `iggrl_rigid_restx0` (oracle start, rest re-estimated) | `results/iggrl_rigid_restx0/motion_eval.npz` | `python scripts/fig_state_overlay.py --run results/iggrl_rigid_restx0 --out results/figures/iggrl_states && bash scripts/chimerax_offscreen.sh results/figures/iggrl_states/render.cxc` (job 51602507) |
| d | `spike_v0` vs all Spike evals | `results/official/spike/score_ext_*.json` (`per_query`) | `python scripts/fig_spike_paired.py --out results/figures/spike_paired` (job 51622677) |
Compose: `python scripts/fig3_compose.py --out results/figures/fig3` (job 51920932).

### Fig. 4 — Ribosembly containment graph (`fig4_ribosembly.pdf` = `results/figures/ribo/ribo_graph.pdf`)
- Run: `ribo_v0c` with Level 1 from `level1_relate.py --stage1 ribo_v0c ... --kgrid 1,2,3,5,8,10,16,20,30`
  (`scripts/run_level1_all.sh`, job 49858198). Outputs: `results/ribo_v0c/level1_relate.json`, `level1r_class00–15.mrc`.
- Commands (job 51430859, then 52017444):
  ```bash
  python scripts/fig_ribo.py render  --run results/ribo_v0c --out results/figures/ribo
  bash scripts/chimerax_offscreen.sh results/figures/ribo/render.cxc
  python scripts/fig_ribo.py compose --run results/ribo_v0c --out results/figures/ribo
  ```

### Fig. 5 — EMPIAR-10180 (`fig6_e10180.pdf` = `results/figures/fig6.pdf`; file name keeps the old number)

Runs (all on `data/real/empiar10180_128`, 139,722 particles):
1. `DATA=data/real/empiar10180_128 RUN=e10180_v0 sbatch scripts/submit_real.sh` (48634518; 2000 beads, 30 epochs).
2. `DATA=... STAGE=v1 STAGE1=e10180_v0 RUN=e10180_v1 sbatch scripts/submit_real_stage.sh` (48634888).
3. `DATA=... STAGE=rigid STAGE1=e10180_v0 V1=e10180_v1 RUN=e10180_rigid_gate sbatch scripts/submit_real_stage.sh --em_rounds 1 --sweeps 1 --fast_coarse --bic_gate` (49367475).
4. Map-null labels on all particles, one job per domain *j* = 1..4 (49672084–087):
   `particle_explain.py --run e10180_rigid_gate --stage1 e10180_v0 --particles data/real/empiar10180_128/particles.128.mrcs --poses .../poses.pkl --ctf .../ctf.pkl --n 0 --domain j --null map --tag _mapnull_full_dj`
5. Decision: `hier_decide.py --run e10180_rigid_gate --tag _mapnull_full` → `hier_decide_mapnull_full.json`. The
   exact invocation is **[inferred]** from the usage string; no recorded job.
6. Validation against RELION (49695252):
   `validate_labels.py --run e10180_rigid_gate --stage1 e10180_v0 <inputs> --label_tag _mapnull_full_d --rotvec_tag _mapnull_full_d --out_tag _mapnull`.
   It needs RELION multi-body `results/relion_multibody/` (`sbatch scripts/submit_multibody.sh`, 48885317, 2 H100,
   4 h 57 min) and the authors' masks `data/real/empiar10180/data/Mask-and-Ref`.
7. Motion ends (51541669): `motion_bins.py --run e10180_rigid_gate --stage1 e10180_v0 <inputs> --domains 1 3`
   → `results/e10180_rigid_gate/motion_bins/`.
   Quantify (51590700): `fig_e10180_bins.py --bins results/e10180_rigid_gate/motion_bins --out results/figures/e10180/bins`.

Render and compose:
- Render: `bash scripts/fig_e10180_render.sh` (writes `results/figures/e10180/render.cxc`, identical to the one used
  in job 51563165, and runs it with `scripts/chimerax_offscreen.sh`).
- Compose: `python scripts/fig6_compose.py --out results/figures/fig6` (job 51653150).

Text-only analyses (no figure panel):
- `e10180_latent_agreement.py --out results/e10180_rigid_gate/latent_agreement.json`
- `e10180_view_leak.py`

Both need `results/cryodrgn_e10180` and `results/recovar_e10180` (Section 5, caveat 3).

### Fig. 6 — EMPIAR-10076 (`fig7_e10076.pdf` = `results/figures/e10076/e10076_panel.pdf`)
- Stage 1 (51770971): `DATA=data/real/empiar10076_128 RUN=e10076_v0 sbatch scripts/submit_real.sh`.
- Hierarchy (51780442): `NAME=e10076 DATA=data/real/empiar10076_128 L1_ARGS="--kgrid 1,2,3,5,8,10,16,20,30" sbatch scripts/run_hier.sh`.
  `L1_ARGS` was set exactly as shown (recorded in the project log; the BIC keys in
  `results/e10076_v0/level1_relate.json` agree). This
  produces `e10076_v1`, `e10076_rigid2` and the 20k-particle `particle_explain.json` that the figure renders.
- Full labels (51849317): `particle_explain.py --run e10076_rigid2 --stage1 e10076_v0 --particles data/real/empiar10076_128/particles.mrcs ... --n 0 --null map --tag _mapnull_full`.
- Then (51860267): `hier_decide.py --run e10076_rigid2 --tag _mapnull_full` and `occupancy_check.py --run e10076_rigid2 --stage1 e10076_v0 <inputs> --domain 2 --tag _mapnull_full`.
  The 20k version, which the figure uses, is the same command without `--tag` (51809938).
- Block → 50S chains: `bash scripts/chimerax_offscreen.sh scripts/cx_fit_50s.py`, then
  `python scripts/e10076_block_map.py --write_beads && bash scripts/chimerax_offscreen.sh scripts/cx_fit_50s_beads.py`
  (51850681, 51851250). Needs `data/structures/4ybb.cif`.
- Figure (51823516): `python scripts/fig_e10076.py render --out results/figures/e10076 && bash scripts/chimerax_offscreen.sh results/figures/e10076/render.cxc && python scripts/fig_e10076.py compose --out results/figures/e10076`.

### Extended Data Fig. 1 — Calibration contrast (`results/figures/calibration_contrast.{json,pdf}`)
- Data: per-domain labelled fractions under three calibrations:
  - BIC penalty: `particle_explain_full_d*.json`
  - bead-rendered null: `particle_explain*.json` without `_mapnull`
  - consensus-map null: `particle_explain_mapnull*.json`
- Runs behind it:
  - synthetic species: `synth_hier_class{0,1}_rigid2` (49665450/464)
  - EMPIAR-10180: `e10180_rigid_gate`; bead null 49424308–315, map null 49672084–087
- Regenerate: `python scripts/fig_calibration.py` rebuilds `calibration_contrast.{json,pdf,png}` from the
  particle_explain JSON files above (checked 2026-10-12: identical JSON to the original, max difference 0).

### Extended Data Table 1 — AU-FSC (`tab:bench`)

Published values come from CryoBench. Cells marked † were evaluated here, each from
`results/official/<tag>/score_ext_<NAME>.json` (`AU-FSC_mean`):

| row | IgG-1D (`igg1d`) | IgG-RL (`iggrl`) | Ribosembly (`ribo`) | Tomotwin (`tomo`) | Spike (`spike`) |
|---|---|---|---|---|---|
| CDS (official) | `hinge_v0c` ← `igg1d_v0c_hinge:theta_all` | `rigid_v0c` ← `iggrl_v0c_rigid:features_pca` | `L1_discrete` ← `results/ribo_v0/L1_posterior_K16.npy` | `L1_discrete` ← `results/tomo_v0/L1_posterior_K100.npy` | `lowrank_v0` ← `spike_v0_test_results.h5:z_pca` |
| RECOVAR† | `RECOVAR` ← `recovar:results/recovar_igg1d:10` | same, `recovar_iggrl` | `recovar_ribo` | `recovar_tomo` (0.201; table prints published 0.258) | `recovar_spike` |
| e2gmm† | `e2gmm` ← `baselines/runs/e2gmm_<DSET>/latent.npy` (all five) | | | | |
| DynaMight† | `dynamight` ← `baselines/runs/dynamight_<DSET>/latent.npy` (via `submit_dynamight_eval.sh`) | | n.c. | n.c. | DIAM 300 |
| CryoSTAR† | `cryostar_tpl` ← `baselines/cryostar/projects/star/work_dirs/<DSET>_<s1>_tpl_0/0061_0096000/z.npy` | | — | — | `cryostar_seed` |
| cryoSPHERE† | `cryosphere_tpl` ← `baselines/runs/cryosphere_<DSET>_<s1>_tpl/analysis/z.npy` | | — | — | `cryosphere_seed` (resumed, Section 5) |
| CDS (structure) | `hinge_tpl` ← `igg1d_tpl_hinge:theta_all` | `rigid_tpl` ← `iggrl_tpl_rigid_dinit:features_pca` | — | — | `rigid_seed` ← `spike_seed_rigid:features_pca` |

The latent specs above are recorded in sacct (`--export` / `EVALS`) for these evaluations: e2gmm IgG-RL/Tomotwin/
Ribosembly/Spike, CryoSTAR Spike, `rigid_seed`, the AF3 rows, `random_latent` and cryoSPHERE/DynaMight (wrappers).
For the evaluations of 2026-09-25 to 09-28 (48913202–49202654) `LATENT` was exported in the shell and not recorded.
The exact source of **every** official embedding (53 of 53) was recovered by matching each saved
`results/official/<tag>/<name>_emb.pkl` against all candidate latents (`python scripts/trace_latents.py` →
`results/official/latent_sources.json`); use the listed source as `LATENT` (for hinge runs the key `theta_all`).

Baseline runs:
- **RECOVAR:** `DSET=<DSET> TAG=<tag> sbatch scripts/submit_recovar.sh` (zdim 1,2,4,10; `--mem=300G` for
  Ribosembly). Jobs: IgG-1D 48256679 (`submit_recovar_igg1d.sh`), IgG-RL 48312921, Ribosembly 48344994,
  Tomotwin 48944700, Spike 49197320.
- **cryoDRGN:** `DSET=... PART=... sbatch scripts/submit_cryodrgn.sh` (zdim 8, 20 epochs), then
  `DSET=... TAG=... PERIOD=100|0 sbatch scripts/submit_eval_cryodrgn.sh` → `score_drgn_own.json` (own decoder; used
  in S1). Published numbers are shown in the table.
- **CryoSTAR:** `NAME=<DSET>_<s1>_tpl sbatch scripts/submit_cryostar.sh` (Spike: `NAME=Spike-MD-128_spike_seed`, 51104007).
- **cryoSPHERE:** `NAME=... sbatch [--partition=kempner_h200] scripts/submit_cryosphere.sh` (IgG-1D 48888020,
  IgG-RL 48942834, Spike 51104008), then
  `NAME=... DSET=... TAG=... PERIOD=... EPOCH=299 [EXTNAME=cryosphere_seed] sbatch scripts/submit_cryosphere_eval.sh`.
- **DynaMight:** `DSET=... DIAM=250 sbatch scripts/submit_dynamight.sh` (Spike `DIAM=300`, 51104009), then
  `DSET=... TAG=... DIAM=... PERIOD=... sbatch scripts/submit_dynamight_eval.sh`.
- **e2gmm:**
  - Conversion on CPU: `run_e2gmm.py --dset <DSET> --apix 3.0|4.5 --box 128 --prep_only --chunks 8` (49934015–020,
    test partition).
  - Training: `DSET=... APIX=... sbatch scripts/submit_e2gmm.sh`. Ribosembly ran fully on CPU, test partition,
    180 G (50057962).
- **HEMNMA:** not run (`scripts/hemnma_scipion.py`, `scripts/scipion_compat/`; incompatibility in the caption).
- **Spike random-latent floor and map regeneration:** `sbatch scripts/submit_spike_extra.sh` (51541332) →
  `score_ext_random_latent.json` and `score_ext_lowrank_v0_maps.json`, which must equal 0.4258.

### Extended Data Table 2 — State recovery / displacement (`tab:motioncmp`)
| row | source file(s) |
|---|---|
| RECOVAR | `results/recovar_<tag>/cds_metrics.json` from `eval_recovar.py --recovar_out results/recovar_<tag> --labels ... --poses ... --label_period 100|0 --zdims ...` (48315826, 48366426) |
| cryoDRGN | `results/cryodrgn_<DSET>/latent_metrics.json` (`submit_eval_cryodrgn.sh`) |
| CryoSTAR | `baselines/cryostar/projects/star/work_dirs/<DSET>_<s1>_tpl_0/latent_metrics.json` (producer **[untraced]**); displacement `results/baseline_disp_cryostar_{igg1d,iggrl}.json` (50984766) |
| cryoSPHERE | `baselines/runs/cryosphere_*/latent_metrics.json`; displacement `results/baseline_disp_cryosphere_*.json` (50984767) |
| DynaMight, e2gmm | `baselines/runs/{dynamight,e2gmm}_<DSET>/latent_metrics.json` |
| CDS no structure | `results/igg1d_v0c_hinge/metrics.json` (`gt_knn_label_err`), `iggrl_v0c_rigid/metrics.json` (`gt_knn_purity`), `ribo_v0c` metrics |
| CDS GT start | `results/igg1d_hinge_restx0/metrics.json`, `iggrl_rigid_restx0/metrics.json` (`motion_disp_rmsd_A`) |

Displacement command, per method and dataset:
`<env>/python scripts/baseline_displacement.py --method cryostar|cryosphere --work_dir <run dir> --stage1 <s1>_tpl --gt_pdbs data/<DSET>/pdbs --labels data/<DSET>/gt_latents.pkl --out results/baseline_disp_<method>_<s1>.json`.

### Extended Data Table 3 — Starting structure (`tab:structure`)

Metrics come from `results/<run>/metrics.json`; AU-FSC from `results/official/{igg1d,iggrl}/score_ext_<NAME>.json`.

| row | IgG-1D run → eval NAME | IgG-RL run → eval NAME |
|---|---|---|
| no structure, consensus beads | `igg1d_ns_v1`→`igg1d_ns_hinge` (from `igg1d_v0`) → `hinge_ns` | `iggrl_v0`→`iggrl_ns_v1`→`iggrl_ns_rigid` (48830518/21/25) → `rigid_ns_consensus` |
| no structure, cluster-map beads | `igg1d_v0c_hinge` → `hinge_v0c` | `iggrl_v0c_rigid` → `rigid_v0c` |
| AF3 whole | `igg1d_af3`→`_v1`→`igg1d_af3_hinge` → `hinge_af3` (50059423) | `VARIANT=whole sbatch scripts/submit_iggrl_af3.sh` (50977590) → `rigid_af3` |
| AF3 PAE domains | `igg1d_af3hier`→`_hinge` (`--init_pae ... --pae_hierarchical`, see log) → `hinge_af3hier` (50059425) | `VARIANT=hier ...` (50977591, timed out in round 4), resumed by `run_rigid.py ... --run iggrl_af3hier_rigid --resume_from iggrl_af3hier_rigid --extra_rounds 1` (51092974) → `rigid_af3hier` |
| PDB 1N0X+3AVE | `igg1d_tpl` (`--init_model data/structures/igg_templates.pdb --init_domains ..._domains.npy`) → `igg1d_tpl_hinge` → `hinge_tpl` | `iggrl_tpl`→`iggrl_tpl_rigid_dinit` → `rigid_tpl` |
| oracle, rest re-estimated | `igg1d_hinge_restx0` (`--rest x0`, from `igg1d_ca`) → `hinge_nostruct` | `iggrl_rigid_restx0` → `rigid_nostruct` |
| oracle (1HZH) | `igg1d_hinge` (`submit_hinge_igg1d.sh --n_axes 100`, 48274787) → `hinge_pdb` | `iggrl_rigid_em4_flip` → `rigid_pdb` |

Notes:
- The `igg1d_ca`/`iggrl_ca` stage-1 runs used
  `submit_igg1d.sh --init_pdb data/<DSET>/pdbs/000.pdb --gt_pdbs data/<DSET>/pdbs` (48262209, 48286174).
- AF3 inputs: `submit_af3_igg.sh` (48370160) and `submit_af3_iggrl.sh` (48831257) → `data/structures/af3*/`.

### Extended Data Table 4 — Ablations (`tab:ablation`)

(a) Oracle rest shape; values from `results/<run>/metrics.json`:

| dataset | run per row |
|---|---|
| IgG-1D | `igg1d_hinge`; `igg1d_ca`; `igg1d_v1`; `igg1d_hinge_v12a` (pivot fixed at the interface; mapping **[inferred]** from metrics); `igg1d_hinge_soft` |
| IgG-RL | `iggrl_rigid_em4_flip`; `iggrl_rigid_attempt1` (centroid); `iggrl_rigid_grid`; `iggrl_rigid` (keep 8); `iggrl_rigid_c2f32` (keep 32); `iggrl_rigid_flip` (naive); `iggrl_rigid_flip2` (aligned); `iggrl_rigid_c2f32_em2`; `iggrl_rigid_c2f32_fast_prior`; `iggrl_rigid_c2f32_fast` |
| Ribosembly | `ribo_v0`; `ribo_comp`; `ribo_icm16` |

Exact args for each run are in `logs/<run>.log`.

(b) IgG-RL, official setting.
- Six rigid runs `abl_{no_flip,grid_only,centroid_pivot,no_merge,em1,with_prior}`, each followed by its AU-FSC eval
  (`logs/queue_ablation.log`). Each is
  `RUN=abl_<x> STAGE1=iggrl_v0c V1=iggrl_v0c_v1 sbatch scripts/submit_rigid.sh --rest x0 --fast_coarse --c2f 0:25:32,14:12:8,7:8:2,3.5:6:1 --em_rounds 4 --flip_pool 50 <change>`,
  where `<change>` is one of:
  - `--flip_pool 0` (48987090)
  - `--search grid` (48988015)
  - `--pivot centroid` (48992586)
  - `--merge v1` (48998119)
  - `--em_rounds 1` (48998125)
  - `--pop_prior 50` (49011449)
- Evals: `NAME=abl_<x> LATENT=results/abl_<x>_test_results.h5:features_pca`.
- "consensus beads" = `rigid_ns_consensus`. "low-rank only" = `score_ext_lowrank_ns.json`, latent
  `results/iggrl_v0_test_results.h5:z_pca` (IgG-1D: `results/igg1d_v0_test_results.h5:z_pca`; from latent_sources.json).

### Extended Data Table 5 — Hierarchical selection (`tab:hier`)

(a) Level 1:
- Synthetic variants:
  `make_synth_hier.py --out data/<v> --N 50000 [--frac_b 0 | --snr 0.01 | --snr 0.005 | --frac_b 0.1 | --b_shape globule]`
  (`--N 20000` for `synth_n20k`). Then `run_pipeline.py ... --run <v>_v0 --n_beads 1000 --K 8 --epochs_homo 3 --epochs 40 --batch 256 --n_clusters 10`
  and `level1_relate.py --stage1 <v>_v0 ... --species_gt data/<v>/gt.npz`. Jobs: 49424982, 49490302/324, 49543147–151.
- All variants plus CryoBench in one job: `sbatch scripts/run_level1_all.sh` (49858198) → `results/*_v0[c]/level1_relate.json`.
- Tomotwin discrete row:
  `level1_relate.py --stage1 tomo_v0 ... --posterior results/tomo_v0/L1_posterior_K100.npy --min_class 300` (49918976).
- Synthetic summary: `python scripts/table_hier.py --tag _mapnull` → `results/table_hier_mapnull.json`.

(b) Levels 2–3, files `results/<run>/hier_decide_mapnull.json`:
- **Synthetic:** `NAME=synth_hier DATA=data/synth_hier sbatch scripts/run_hier.sh` (49556003). Then map-null
  re-labels of `synth_hier_class{0,1}_rigid2` (49665450, 49665464). The `--wrap` commands are in Section 3, pattern
  `particle_explain.py ... --n 20000 --null map --tag _mapnull && hier_decide.py --tag _mapnull`.
- **CryoBench:** `submit_level23.sh` with `S1=<X>_v0c V1=<X>_v0c_v1 IN="<inputs>"`. Jobs: IgG-1D 49918979,
  IgG-RL 49806450, Spike 49842278, Ribosembly 49842245 (`RIGID_TO=230m RIGID_ARGS="--em_rounds 1 --sweeps 1"`).
- **Ribosembly second round:**
  `run_rigid.py --stage1 ribo_v0c --v1 ribo_v0c_v1 --run ribo_v0c_rigid2_r2 ... --resume_from ... --extra_rounds 1`
  (49857979; full args in `logs/ribo_v0c_rigid2_r2.log`), then `particle_explain` + `hier_decide` on `_r2` (49874342).

### Extended Data Table 6 — EMPIAR-10180 labels (`tab:real`)
- Labels and fractions: `results/e10180_rigid_gate/particle_explain_mapnull_full_d{1..4}.json`, and the decision in
  `hier_decide_mapnull_full.json` (Fig. 5 steps 4–5).
- RELION columns: `validate_labels_mapnull.json` (step 6).
- Body overlap: `scripts/diag/label_domains_by_masks.py`; its arguments are **[untraced]**.

### Extended Data Table 7 — Runtime (`tab:runtime`)
- CDS component times: `results/SUMMARY.md` § "Runtime", taken from sacct Elapsed of the jobs in Section 3.1.
- Baselines (sacct Elapsed):
  - RECOVAR 48256679 / 48312921 / 48344994; EMPIAR-10180 50977593 (18:09)
  - cryoDRGN 48832407 / 48860117 / 48865079; EMPIAR-10180 50084984 (45:43)
  - RELION multi-body 48885317

### Supplementary Table S1 — Per-query paired tests (`tab:supp_paired`)
- Per-query AU-FSC of directories that predate `score_ext` per-query storage:
  `python scripts/paired_test.py` (49096193, test partition) → `results/official/<tag>/pq_*.json` and `paired_tests.json`.
  It re-scores `extp_*/state###.mrc` and `drgn_own/vol_*.mrc`.
- Table: `python scripts/supp_table_paired.py --out results/official/supp_paired.tex` (51875037) →
  `supp_paired.{tex,json}`, pasted into `main.tex`. The reference is CDS: `hinge_v0c`, `rigid_v0c`, `L1_discrete`
  ×2, `lowrank_v0`.

## 5. Known caveats

1. **cryoSPHERE on Spike-MD was resumed.** The run (51104008) hit the 16 h limit at epoch ~181/300. It was continued
   with `NAME=Spike-MD-128_spike_seed sbatch --dependency=afterany:51104008 scripts/submit_cryosphere_resume.sh`
   (51239687). That job uses `scripts/cryosphere_resume.py`: same epoch counter and loss schedules, Adam moments
   re-initialised. Evaluation: `submit_cryosphere_eval.sh` with `EXTNAME=cryosphere_seed` (51239688).
   An uninterrupted 300-epoch run will differ slightly.
2. **Ribosembly used one EM round.** Its Level 2–3 run (`ribo_v0c_rigid2`) used `--em_rounds 1 --sweeps 1`; every
   other dataset used 2. A resumed second round is reported as a range in `tab:hier`. Per-particle rotations had not
   converged; the decision was unchanged.
3. **EMPIAR-10180 has three non-finite images** (indices 9955, 40867, 108052). CDS zeroes them in its loader. The
   baselines must exclude them with `--ind data/real/empiar10180_128/good_ind.pkl` (139,719 particles). Without
   this flag RECOVAR and cryoDRGN produce NaN (`results/*_e10180.failed_nan`). RECOVAR needs `--mem=160G`.
   EMPIAR-10076 has one corrupt image (7234), which is zeroed.
4. **Netscratch purge.** On 2026-10-08 the purge emptied `data/{IgG-1D,IgG-RL,Ribosembly,Tomotwin-100}`, the
   ChimeraX install and EMPIAR metadata, because extracted files keep old archive mtimes. Restore them with
   `redownload_cryobench.sh` (`unzip -DD`), `download_ranges.sh` (`curl -sf`; a 107-byte HTTP error body once
   corrupted a Tomotwin part) and `redownload_empiar_meta.sh`.
   - Not restored: the EMPIAR-10180 raw micrograph stacks. `data/real/empiar10180_128` is intact and on HF.
   - Deleted on purpose and regenerable: half/unfiltered generator maps, the zips, Spike 256-px images, and
     intermediate cryoSPHERE/DynaMight checkpoints. See `notes/DELETED_MANIFEST.md`.
   - Never delete anything in `notes/FIGURE_DATA.md`.
5. **ChimeraX offscreen** needs the `cds_render` env, which provides OSMesa (`mesalib<24.1`), and the symlinks in
   `.../software/osmesa_link`. Always call it through `scripts/chimerax_offscreen.sh`. Other requirements:
   - `.cxc` paths must be absolute.
   - Do not pipe ChimeraX output into `head`.
   - A map written from an (x, y, z) array is read by ChimeraX as (z, y, x).
6. **Spike-MD AU-FSC is evaluated here at 128 px.** The GT maps come from the query frames via CryoBench's ChimeraX
   recipe, so the values are not comparable to published Spike-MD numbers. The floor is the random latent at 0.380.
7. **Post-hoc thresholds** (disclosed in the paper):
   - The Level-1 link rule uses corr ≥ 0.7, stable over 0.60–0.80.
   - `hier_decide --mode_ratio 0.35` was chosen after an absolute threshold mislabelled Ribosembly.
   - The defaults in the scripts are the values used in the paper.
8. **No fixed seeds.** GPU fits are not bit-reproducible. Rerunning AU-FSC from the stored `_emb.pkl`/`_targets.txt`
   reproduces scores to about 1e-7 (Spike check: 0.425817 vs 0.425817).