03 · LAMBDA-BER Use Case

Auto-orchestrate processing:
the technique picks the pipeline

A catalogued run knows what it is — cryo-EM, crystallography, SAXS — and the agent uses that to dispatch the right processing pipeline without being told. It reads technique, locates the inputs by their pointers, runs the appropriate tools, and writes each step back as a typed WorkflowRun. Phenix is one engine in the rack, not the whole rack.

Trigger: processing_status = collected Route by: technique Engines: RELION · DIALS · ATSAS · Phenix Record: a WorkflowRun per step

The idea

Routing, not babysitting

Each technique has a well-trodden processing path, but they share almost no tools. A cryo-EM movie needs motion correction and 3D classification; a diffraction dataset needs indexing and scaling; a scattering curve needs buffer subtraction and a Guinier fit. The agent reads the typed metadata and sends each run down the correct lane — and because the WorkflowTypeEnum names these steps, the plan is legible before anything runs.

Not a Phenix story. Phenix does the crystallographic refinement and map-model work, but the cryo-EM lane leans on RELION / cryoSPARC, the indexing on DIALS / XDS, and the SAXS lane on ATSAS / RAW. The schema is the common ground that lets one agent drive all of them.

Technique-routed lanes

One trigger, three pipelines

Every step maps to a workflow_type from the schema, so the pipeline is just a sequence of typed WorkflowRun rows — auditable, resumable, and the same shape regardless of which external tool did the work.

cryo_em
movies → map
motion_correction · MotionCor2 ctf_estimation · CTFFIND particle_picking · RELION classification_3d · RELION/cryoSPARC refinement · RELION model_building · Phenix
xray_crystallography
frames → model
integration · DIALS/XDS scaling · Aimless phasing · Phaser model_refinement · phenix.refine model_validation · MolProbity
saxs
curves → envelope
saxs_analysis · RAW (subtract) saxs_analysis · Guinier/Rg ab_initio · DAMMIF (ATSAS) model_validation · SASBDB checks

How the router decides

Read the type, fetch the inputs, dispatch

collected runs status = collected/raw inputs by storage_uri router switch(technique) cryo_em → RELION + Phenix motion → ctf → pick → 3D → refine → build xray → DIALS + phenix.refine integrate → scale → phase → refine → validate saxs → ATSAS / RAW subtract → Guinier → ab initio → validate

The record it leaves

Each step is a typed WorkflowRun

Whatever tool ran, the result is the same kind of row — capturing the type, the software, the version, and the status. That uniformity is what lets the re-analysis use case (06) later find and re-run exactly the right steps.

a step the agent wrote back
workflow_runs:
- id: lambdaber:wf_ncp_refine_001
  workflow_code: WF-NCP-REFINE-001
  workflow_type: model_refinement        # from WorkflowTypeEnum
  software_name: Phenix
  software_version: 1.21.1-5286          # pinned — matters for use case 06
  processing_status: completed

workflow_input_associations:
- workflow_id: lambdaber:wf_ncp_refine_001
  data_file_id: lambdaber:df_ncp_mtz          # resolved via storage_uri at run time

The agent at work

Drain the queue of un-processed runs

beril · claude-code · ~/lab-catalog
> process everything that's still raw

⏺ scan WHERE processing_status IN ('collected','raw')
→ 3 runs · 1 cryo_em · 1 xray_crystallography · 1 saxs

⏺ route cryo_em (EXP-NCP-CRYOEM-001)
fetch movies by storage_uri → MotionCor2 → CTFFIND → RELION 3D → refine
✓ 2.5 Å map · 6 WorkflowRun rows written

⏺ route xray (EXP-NCP-XTAL-002)
DIALS integrate → Aimless → Phaser → phenix.refine
✓ R-free 0.214 · model + validation recorded

⏺ route saxs (EXP-CHD1-SAXS-001)
RAW subtract → Guinier (Rg 38 Å) → DAMMIF envelope
✓ done · all 3 runs now processing_status = completed

Payoff

What auto-routing buys

[ ⋔ ] Right tool, no prompting

The technique field decides the pipeline, so a mixed queue of cryo-EM, X-ray, and SAXS runs all clears itself correctly.

[ ◫ ] Tool-agnostic record

RELION, DIALS, ATSAS, and Phenix all leave the same shape of WorkflowRun — one provenance model across every technique.

[ ▷ ] Resumable & legible

Typed steps mean a half-finished pipeline can be inspected and resumed, not restarted from scratch.

[ ↻ ] Sets up re-analysis

Pinned software_version on each step is what lets use case 06 later target exactly what a new release affects.