RELION Cryo-EM Refinement

RELION single-particle refinement

by K-Dense-AI · MIT license · ★ 45,977 on GitHub · updated Sep 21

RELION single-particle refinement cover

Validates and executes RELION single-particle cryo-EM refinement and half-map postprocessing. Supports STAR optics/acquisition checks, particle-stack consistency, gold-standard half sets, soft-mask validation, diagnostic Fourier shell…

---
name: relion
description: Validates and executes RELION single-particle cryo-EM refinement and half-map postprocessing. Supports STAR optics/acquisition checks, particle-stack consistency, gold-standard half sets, soft-mask validation, diagnostic Fourier shell correlation, and restart guidance.
license: MIT
compatibility: Python 3.12+ with numpy, mrcfile and starfile for bundled validation; RELION 5.0.1 CPU/MPI executables for refinement and postprocessing. Native workflows require MPI, OpenMP and an FFT library (FFTW or MKL). GPU builds require their supported accelerator stack. Network is needed for installation only.
metadata:
  version: "1.1"
  skill-author: K-Dense Inc.
  upstream-version: "5.0.1"
  last-reviewed: "2026-10-01"
---

# RELION single-particle refinement

Use for a RELION single-particle project, especially extracted particles → homogeneous selected
particle subset → gold-standard refinement → half-map validation and postprocessing. The bundled
runner starts from **CTF-annotated extracted particles and an initial 3D reference**. It does not
replace motion correction, picking, 2D/3D selection, or a biological interpretation of map quality.

Overview

Use for a RELION single-particle project, especially extracted particles → homogeneous selected particle subset → gold-standard refinement → half-map validation and postprocessing. The bundled runner starts from CTF-annotated extracted particles and an initial 3D reference. It does not replace motion correction, picking, 2D/3D selection, or a biological interpretation of map quality. For tomography, helical reconstruction, Blush, or heterogeneous-state modeling, use the appropriate upstream workflow rather than forcing those data into this bounded SPA runner.

Manual install (npx, ZIP)
Claude Codenpx skills add K-Dense-AI/scientific-agent-skills --skill relion -g -a claude-code
Claude Code (degit)npx degit K-Dense-AI/scientific-agent-skills/skills/relion#main ~/.claude/skills/relion
Claude.ai / desktopZip the folder and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md7.9 KB
Read SKILL.md here
K-Dense-AI/main1 file shown
SKILL.md
Show the full text130 lines

RELION single-particle refinement

Use for a RELION single-particle project, especially extracted particles → homogeneous selected particle subset → gold-standard refinement → half-map validation and postprocessing. The bundled runner starts from CTF-annotated extracted particles and an initial 3D reference. It does not replace motion correction, picking, 2D/3D selection, or a biological interpretation of map quality. For tomography, helical reconstruction, Blush, or heterogeneous-state modeling, use the appropriate upstream workflow rather than forcing those data into this bounded SPA runner.

Preserve acquisition and coordinate conventions

Read references/acquisition-and-restarts.md when starting from movies or resuming jobs. Confirm pixel size in Å/pixel, voltage in kV, spherical aberration in mm, defocus in Å, amplitude contrast as a fraction, and the symmetry justified by the specimen. Do not “correct” a suspicious value by guessing its units.

data_optics describes acquisition/image groups; data_particles references them through _rlnOpticsGroup. Particle filenames use one-based index@stack.mrcs; leading zeros such as 00000001@stack.mrcs are valid. Relative paths resolve from the RELION project directory, not the STAR file's directory. Keep optics groups when merging or subsetting STAR files. _rlnOriginXAngst/_rlnOriginYAngst are Å translations, not pixels.

Run from this skill directory with paths to the real project:

python scripts/spa_workflow.py validate-star project/particles.star --project project

This opens referenced stacks and checks optics membership, finite acquisition/CTF values, indices, box sizes, duplicate particle references and existing half-set assignments. Use --metadata-only only when stacks are genuinely unavailable; the JSON records stack_checks_performed: false. It does not scan every particle pixel for corruption or establish correct image normalization. Physical-range warnings are review prompts, not proof that unusual microscope settings are wrong.

Refine a selected particle population

Before running, inspect representative particles and class averages, defocus distributions, CTF fits, particle orientation distribution, and the initial reference. Ensure the map and particle boxes/pixel sizes agree after any downsampling. The runner deliberately supports one effective box/pixel size across optics groups; handle heterogeneous sampling with an explicit upstream resampling workflow. Use conventionally extracted, normalized particles that have not already been phase-flipped or Wiener-filtered; this runner does not configure those special input cases.

python scripts/spa_workflow.py refine \
  --star project/particles.star --reference project/initial.mrc \
  --project project --diameter 180 --symmetry C1 \
  --initial-lowpass 40 --mpi-ranks 3 --threads 2 --output project/RefinePilot

The diameter and low-pass filter above are illustrative Å values. Use specimen-appropriate values. Refinement executes mpirun -np 3 relion_refine_mpi with --auto_refine, --split_random_halves, --ctf, and a low-pass starting reference. Gold-standard splitting requires MPI; the plain sequential relion_refine executable cannot perform this split. Use odd ranks ≥3 (master plus balanced half-set workers), with a matching MPI installation. The CPU command is useful for a bounded pilot; choose a documented GPU/MPI launch for full data.

The runner keeps the command, native version and log in a new output directory, records an explicit random seed (default 1), surfaces runtime warnings, stops on process failure, and requires converged unfiltered half maps before reporting success. It does not automatically retry expensive jobs or silently discard failed-job artifacts. Keep _optimiser.star, model/sampling STAR files, and referenced particle paths for restart. Use the original job's optimiser rather than starting a new random split from a partially processed table.

Inspect independent half maps

Use the two independently refined unfiltered half maps, never two copies of the combined, sharpened map. Matching headers cannot establish statistical independence; the independent particle assignments and refinement history provide that evidence. Inspect directional anisotropy, preferred orientation and local resolution as well as a global FSC curve.

python scripts/spa_workflow.py fsc \
  project/RefinePilot/run_half1_class001_unfil.mrc \
  project/RefinePilot/run_half2_class001_unfil.mrc --output diagnostic-fsc.tsv

This checks map dimensions, finite values, pixel size, origin, axis order and duplicate maps, then writes an unmasked diagnostic FSC. The reported 0.143 crossing uses linear interpolation; null means no downward crossing was detected, not infinite resolution. Nyquist resolution is 2 × pixel size. This diagnostic is limited to even cubic maps ≤256³; use RELION's native relion_image_handler --fsc for larger maps. It does not substitute for mask-corrected FSC. The helper requires real-space maps with canonical axes, zero MRC start indices and orthogonal cell angles. Convert other grids explicitly with provenance; merely editing headers can misalign density. Matching headers and FSC cannot determine absolute handedness.

Postprocess with a soft mask

Construct the solvent mask from an appropriately low-pass-filtered density, with an expanded boundary and a smooth edge. Inspect all slices; a tight mask can inflate correlation. Avoid a mask derived from high-frequency noise shared between half maps.

python scripts/spa_workflow.py postprocess \
  --half1 project/RefinePilot/run_half1_class001_unfil.mrc \
  --half2 project/RefinePilot/run_half2_class001_unfil.mrc \
  --mask project/soft_mask.mrc --output project/PostProcessPilot

The helper checks a nonconstant mask in [0,1], soft-edge voxels and matching map grids, then runs relion_postprocess with explicit half maps, mask and pixel size. RELION performs its own mask/randomization correction and writes postprocess.star. The bounded command leaves the B-factor at zero (no automatic B-factor estimation); add automatic/manual sharpening only after choosing a defensible fit range and inspecting map quality. A valid range and some fractional mask voxels do not prove the mask is scientifically appropriate. Inspect the phase-randomized masked FSC near the reported resolution: residual correlation calls for a smoother/wider mask and another postprocessing run.

See references/runtime-and-validation.md for the tested native utilities and the distinction between pipeline execution and reconstruction validation.

Primary references

1---
2name: relion
3description: Validates and executes RELION single-particle cryo-EM refinement and half-map postprocessing. Supports STAR optics/acquisition checks, particle-stack consistency, gold-standard half sets, soft-mask validation, diagnostic Fourier shell correlation, and restart guidance.
4license: MIT
5compatibility: Python 3.12+ with numpy, mrcfile and starfile for bundled validation; RELION 5.0.1 CPU/MPI executables for refinement and postprocessing. Native workflows require MPI, OpenMP and an FFT library (FFTW or MKL). GPU builds require their supported accelerator stack. Network is needed for installation only.
6metadata:
7 version: "1.1"
8 skill-author: K-Dense Inc.
9 upstream-version: "5.0.1"
10 last-reviewed: "2026-10-01"
11---
12 
13# RELION single-particle refinement
14 
15Use for a RELION single-particle project, especially extracted particles → homogeneous selected
16particle subset → gold-standard refinement → half-map validation and postprocessing. The bundled
17runner starts from **CTF-annotated extracted particles and an initial 3D reference**. It does not
18replace motion correction, picking, 2D/3D selection, or a biological interpretation of map quality.
19For tomography, helical reconstruction, Blush, or heterogeneous-state modeling, use the appropriate
20upstream workflow rather than forcing those data into this bounded SPA runner.
21 
22## Preserve acquisition and coordinate conventions
23 
24Read [references/acquisition-and-restarts.md](references/acquisition-and-restarts.md) when starting
25from movies or resuming jobs. Confirm pixel size in **Å/pixel**, voltage in **kV**, spherical
26aberration in **mm**, defocus in **Å**, amplitude contrast as a fraction, and the symmetry justified
27by the specimen. Do not “correct” a suspicious value by guessing its units.
28 
29`data_optics` describes acquisition/image groups; `data_particles` references them through
30`_rlnOpticsGroup`. Particle filenames use **one-based** `index@stack.mrcs`; leading zeros such as
31`00000001@stack.mrcs` are valid. Relative paths resolve
32from the RELION project directory, not the STAR file's directory. Keep optics groups when merging
33or subsetting STAR files. `_rlnOriginXAngst`/`_rlnOriginYAngst` are Å translations, not pixels.
34 
35Run from this skill directory with paths to the real project:
36 
37```bash
38python scripts/spa_workflow.py validate-star project/particles.star --project project
39```
40 
41This opens referenced stacks and checks optics membership, finite acquisition/CTF values, indices,
42box sizes, duplicate particle references and existing half-set assignments. Use `--metadata-only`
43only when stacks are genuinely unavailable; the JSON records `stack_checks_performed: false`.
44It does not scan every particle pixel for corruption or establish correct image normalization.
45Physical-range warnings are review prompts, not proof that unusual microscope settings are wrong.
46 
47## Refine a selected particle population
48 
49Before running, inspect representative particles and class averages, defocus distributions, CTF
50fits, particle orientation distribution, and the initial reference. Ensure the map and particle
51boxes/pixel sizes agree after any downsampling. The runner deliberately supports one effective
52box/pixel size across optics groups; handle heterogeneous sampling with an explicit upstream
53resampling workflow. Use conventionally extracted, normalized particles that have not already
54been phase-flipped or Wiener-filtered; this runner does not configure those special input cases.
55 
56```bash
57python scripts/spa_workflow.py refine \
58 --star project/particles.star --reference project/initial.mrc \
59 --project project --diameter 180 --symmetry C1 \
60 --initial-lowpass 40 --mpi-ranks 3 --threads 2 --output project/RefinePilot
61```
62 
63The diameter and low-pass filter above are illustrative **Å** values. Use specimen-appropriate
64values. Refinement executes `mpirun -np 3 relion_refine_mpi` with `--auto_refine`,
65`--split_random_halves`, `--ctf`, and a low-pass starting reference. Gold-standard splitting
66requires MPI; the plain sequential `relion_refine` executable cannot perform this split.
67Use odd ranks ≥3 (master plus balanced half-set workers), with a matching MPI installation.
68The CPU command is useful for a bounded pilot; choose a documented GPU/MPI launch for full data.
69 
70The runner keeps the command, native version and log in a new output directory, records an
71explicit random seed (default 1), surfaces runtime warnings, stops on process failure, and
72requires converged unfiltered half maps before reporting success. It does not automatically retry
73expensive jobs or silently discard failed-job artifacts. Keep `_optimiser.star`, model/sampling
74STAR files, and referenced particle paths for restart. Use the original job's optimiser rather
75than starting a new random split from a partially processed table.
76 
77## Inspect independent half maps
78 
79Use the two independently refined **unfiltered** half maps, never two copies of the combined,
80sharpened map. Matching headers cannot establish statistical independence; the independent
81particle assignments and refinement history provide that evidence. Inspect directional
82anisotropy, preferred orientation and local resolution as well as a global FSC curve.
83 
84```bash
85python scripts/spa_workflow.py fsc \
86 project/RefinePilot/run_half1_class001_unfil.mrc \
87 project/RefinePilot/run_half2_class001_unfil.mrc --output diagnostic-fsc.tsv
88```
89 
90This checks map dimensions, finite values, pixel size, origin, axis order and duplicate maps, then
91writes an **unmasked diagnostic FSC**. The reported 0.143 crossing uses linear interpolation;
92`null` means no downward crossing was detected, not infinite resolution. Nyquist resolution is
932 × pixel size. This diagnostic is limited to even cubic maps ≤256³; use RELION's native
94`relion_image_handler --fsc` for larger maps. It does not substitute for mask-corrected FSC.
95The helper requires real-space maps with canonical axes, zero MRC start indices and orthogonal
96cell angles. Convert other grids explicitly with provenance; merely editing headers can misalign
97density. Matching headers and FSC cannot determine absolute handedness.
98 
99## Postprocess with a soft mask
100 
101Construct the solvent mask from an appropriately low-pass-filtered density, with an expanded
102boundary and a smooth edge. Inspect all slices; a tight mask can inflate correlation. Avoid a
103mask derived from high-frequency noise shared between half maps.
104 
105```bash
106python scripts/spa_workflow.py postprocess \
107 --half1 project/RefinePilot/run_half1_class001_unfil.mrc \
108 --half2 project/RefinePilot/run_half2_class001_unfil.mrc \
109 --mask project/soft_mask.mrc --output project/PostProcessPilot
110```
111 
112The helper checks a nonconstant mask in [0,1], soft-edge voxels and matching map grids, then runs
113`relion_postprocess` with explicit half maps, mask and pixel size. RELION performs its own
114mask/randomization correction and writes `postprocess.star`. The bounded command leaves the
115B-factor at zero (no automatic B-factor estimation); add automatic/manual sharpening only after choosing a defensible fit
116range and inspecting map quality. A valid range and some fractional mask voxels do not prove the
117mask is scientifically appropriate. Inspect the phase-randomized masked FSC near the reported
118resolution: residual correlation calls for a smoother/wider mask and another postprocessing run.
119 
120See [references/runtime-and-validation.md](references/runtime-and-validation.md) for the tested
121native utilities and the distinction between pipeline execution and reconstruction validation.
122 
123## Primary references
124 
125- [RELION 5.0 installation](https://relion.readthedocs.io/en/release-5.0/Installation.html).
126- [STAR and map conventions](https://relion.readthedocs.io/en/release-5.0/Reference/Conventions.html).
127- [Single-particle tutorial](https://relion.readthedocs.io/en/release-5.0/SPA_tutorial/index.html).
128- [Gold-standard refinement](https://relion.readthedocs.io/en/release-5.0/SPA_tutorial/Refine3D.html).
129- [Mask creation and postprocessing](https://relion.readthedocs.io/en/release-5.0/SPA_tutorial/Mask.html).
130 
View all files on GitHub →

Details

Updated
Sep 21, 2026
License
MIT
Stars on the repo
★ 45,977
Checked
Source
K-Dense-AI/scientific-agent-skills ↗
Creator
K-Dense-AI · 168 listings
View creator

Similar skills

See all →

More from K-Dense-AI

SkillAdaptyv Bio Foundry APIK-Dense-AI/scientific-agent-skills · by K-Dense-AIHow to use the Adaptyv Bio Foundry API and Python SDK for protein experiment design, submission, and results retrieval. Use this skill whenever the user mentions Adaptyv, Foundry API, protein binding assays, protein screening experiments, BLI/SPR assays, thermostability assays, or wants to submit protein sequences for experimental characterization. Also trigger when code imports `adaptyv`, `adaptyv_sdk`, or `FoundryClient`, or references `foundry-api-public.adaptyvbio.com`.★ 46k GitHub starsSkillTime Series MLK-Dense-AI/scientific-agent-skills · by K-Dense-AIThis skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorithms beyond standard ML approaches. Particularly suited for univariate and multivariate time series analysis with scikit-learn compatible APIs.★ 46k GitHub starsSkillAnalytical Method ValidatorK-Dense-AI/scientific-agent-skills · by K-Dense-AIPlan, execute, and document validation, verification, and transfer of analytical procedures under the governing framework - ICH Q2(R2) and Q14, USP <1220>/<1225>/<1226>, ICH M10 bioanalytical, CLSI EP, or ISO/IEC 17025. Use for HPLC, LC-MS/MS, GC, CE, ICP-MS, dissolution, qNMR, qPCR, NIR, and ligand binding or cell-based assays whenever the question is whether a procedure is fit for its intended purpose. Triggers include "method validation", "analytical method validation", "AMV", "validation protocol", "acceptance criteria", "linearity", "reportable range", "accuracy and precision", "repeatability", "intermediate precision", "recovery", "LOD", "LOQ", "detection limit", "quantitation limit", "specificity", "robustness", "method transfer", "method comparison", "Deming", "Passing-Bablok", "Bland-Altman", "equivalence testing", "OOS investigation", "ICH Q2", "Q2(R2)", "Q14", "USP 1225", "ICH M10", "incurred sample reanalysis", "ISR", "CLSI EP", and any request to show that an assay works.★ 46k GitHub starsSkillSingle-Cell Data StructureK-Dense-AI/scientific-agent-skills · by K-Dense-AIData structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.★ 46k GitHub starsSkillAutonomous Artifact OptimizerK-Dense-AI/scientific-agent-skills · by K-Dense-AIAutonomously improve a real artifact (code, training recipe, agent harness, data pipeline, prompt) against an objective and an evaluator, using Hypothesis Tree Refinement (HTR) from the Arbor paper. Use this whenever someone wants to iteratively optimize something over many experiments without overfitting — e.g. "get my model's eval score up", "improve this agent/harness", "tune this pipeline", "beat the baseline on this benchmark", "run a search over approaches and keep the best", "do an MLE-bench / Kaggle-style optimization", or any long-horizon "make this artifact better and don't just memorize the dev set" task. Trigger it even when the user doesn't say "Arbor" or "hypothesis tree" but describes repeated experiment-and-evaluate loops, branching exploration of competing ideas, or worries about a dev/test gap. Runs Claude itself as the coordinator with subagent executors in isolated git worktrees; for the standalone `arbor` CLI tool see references/arbor-upstream.md.★ 46k GitHub starsSkillGene Regulatory Network InferrerK-Dense-AI/scientific-agent-skills · by K-Dense-AIInfer gene regulatory networks (GRNs) from gene expression data using scalable algorithms (GRNBoost2, GENIE3). Use when analyzing transcriptomics data (bulk RNA-seq, single-cell RNA-seq) to identify transcription factor-target gene relationships and regulatory interactions. Supports distributed computation for large-scale datasets.★ 46k GitHub stars