RELION Jobs: Classification and Refinement
RELION 2D and 3D classification, initial model, refinement, polishing and particle subtraction
This page documents every RELION classification and refinement job type registered in ccpem-pipeliner: 2D classification (EM and VDAM algorithms, including helical variants), 3D classification (standard, helical, and multi-reference variants), de novo initial model generation, 3D auto-refinement (standard and helical), multi-body refinement and flexibility analysis, CTF refinement, Bayesian polishing (training and polishing), particle subtraction and reversion, symmetry expansion, and DynaMight continuous heterogeneity analysis. Understanding these job types lets you build automated pipelines that chain particle picking outputs through to publication-ready reconstructions, and lets you continue, overwrite, or branch any step programmatically.
All jobs on this page follow the same lifecycle: schedule or run the job using a parameters dict or a run.job file, wait for it to finish, then optionally continue it from the latest optimiser file. The sections below describe each registered job type, its process name, key option keys, inputs, outputs, and continuation behaviour.
Job-type reference table
| Process name | Class | Output dir | can_continue | Program |
|---|---|---|---|---|
relion.class2d.em | RelionClass2DEM | Class2D/ | ✓ | relion_refine |
relion.class2d.em.helical | RelionClass2DHelicalEM | Class2D/ | ✓ | relion_refine |
relion.class2d.vdam | RelionClass2DVDAM | Class2D/ | ✓ | relion_refine |
relion.class2d.vdam.helical | RelionClass2DHelicalVDAM | Class2D/ | ✓ | relion_refine |
relion.class3d | RelionClass3D | Class3D/ | ✓ | relion_refine |
relion.class3d.helical | RelionClass3DHelical | Class3D/ | ✓ | relion_refine |
relion.class3d.multiref | RelionClass3DMulti | Class3D/ | ✓ | relion_refine |
relion.class3d.helical.multiref | RelionClass3DHelicalMulti | Class3D/ | ✓ | relion_refine |
relion.initialmodel | InimodelJob | InitialModel/ | ✓ | relion_refine, relion_align_symmetry |
relion.refine3d | RelionRefine3D | Refine3D/ | ✓ | relion_refine |
relion.refine3d.helical | RelionRefine3DHelical | Refine3D/ | ✓ | relion_refine |
relion.multibody.refine | RelionMultiBodyRefine | MultiBody/ | ✓ | relion_refine |
relion.multibody.flexanalysis | RelionMultiBodyFlexAnalysis | MultiBody/ | ✗ | relion_flex_analyse |
relion.ctfrefine | RelionCtfRefine | CtfRefine/ | ✓ | relion_ctf_refine |
relion.polish | RelionPolishParticles | Polish/ | ✓ | relion_motion_refine |
relion.polish.train | RelionPolishTrain | Polish/ | ✓ | relion_motion_refine |
relion.subtract | RelionSubtract | Subtract/ | ✗ | relion_particle_subtract |
relion.subtract.revert | RelionSubtractRevert | Subtract/ | ✗ | relion_particle_subtract |
dynamight | DynamightContinuousHeterogeneity | DynaMight/ | ✗ | DynaMight executable |
relion.image_analysis.symmetry_expansion | RelionSymmetryExpansion | SymmetryExpansion/ | ✗ | relion_particle_symmetry_expand |
2D classification (relion.class2d.em and relion.class2d.vdam)
Category: 2D Classification
Both EM and VDAM variants classify particles into 2D averages and share the same Class2D/ output directory. The key difference is the optimisation algorithm: EM uses the expectation-maximisation algorithm (option key nr_iter_em), while VDAM uses Variable-metric Gradient Descent with Adaptive Moments (option key nr_iter_grad). Neither VDAM variant has an nr_mpi option; adding nr_mpi to a VDAM parameters dict raises ValueError.
Primary input: fn_img — particles STAR file (NODE_PARTICLEGROUPMETADATA)
Continuation input: fn_cont — an *_optimiser.star file (NODE_OPTIMISERDATA); only active in continue mode (only_in_continue=True)
Key option keys (shared between EM and VDAM variants):
| Key | Label | Default |
|---|---|---|
fn_img | Input images STAR file: | "" (required) |
fn_cont | Continue from here: | "" (continue only) |
nr_classes | Number of classes: | 1 |
tau_fudge | Regularisation parameter T: | 2 |
particle_diameter | Mask diameter (A): | 200 |
do_ctf_correction | Do CTF-correction? | True |
ctf_intact_first_peak | Ignore CTFs until first peak? | False |
do_zero_mask | Mask individual particles with zeros? | True |
highres_limit | Limit resolution E-step to (A): | None |
do_center | Center class averages? | True |
dont_skip_align | Perform image alignment? | True |
psi_sampling | In-plane angular sampling: | 6.0 |
offset_range | Offset search range (pix): | 5 |
offset_step | Offset search step (pix): | 1 |
allow_coarser | Allow coarser sampling? | False |
Outputs: Class average images (.mrcs) and per-iteration data/optimiser STAR files in Class2D/jobNNN/.
Continuation: can_continue=True. When get_continuation_job() is called, continuation_joboption_updates() automatically sets fn_cont to the most recently completed *_optimiser.star file found in the job directory and advances the iteration default. For optimiser-based jobs you must ensure fn_cont is set in continue_job.star before calling continue_job(); get_continuation_job() populates this automatically.
Helical variants (relion.class2d.em.helical, relion.class2d.vdam.helical) add:
| Key | Label | Default |
|---|---|---|
do_bimodal_psi | Do bimodal angular searches? | True |
range_psi | Angular search range - psi (deg): | 6.0 |
helical_tube_outer_diameter | Tube diameter (A): | 200.0 |
do_restrict_xoff | Restrict helical offsets to rise: | True |
helical_rise | Helical rise (A): | 4.75 |
The 19-key helical refinement set (including helical_nr_asu, helical_rise_initial) applies only to 3D helical jobs, not 2D.
3D classification (relion.class3d and variants)
Category: 3D Classification
All 3D classification variants output into Class3D/ and share can_continue=True.
Primary inputs:
| Key | Description |
|---|---|
fn_img | Particles STAR file (required) |
fn_ref | Reference map (required, NODE_DENSITYMAP); the multiref variants take several maps (Reference maps:) |
fn_mask | Reference mask (optional, NODE_MASK3D) |
fn_cont | Optimiser STAR file (continue only, NODE_OPTIMISERDATA) |
Key option keys:
| Key | Label | Default |
|---|---|---|
fn_img | Input images STAR file: | "" (required) |
fn_cont | Continue from here: | "" (continue only) |
fn_mask | Reference mask (optional): | "" |
ref_correct_greyscale | Ref. map is on absolute greyscale? | False |
ini_high | Initial low-pass filter (A): | 60 |
sym_name | Symmetry: | "C1" (required) |
nr_classes | Number of classes: | 1 |
tau_fudge | Regularisation parameter T: | 4 |
nr_iter | Number of iterations: | 25 |
do_ctf_correction | Do CTF-correction? | True |
do_fast_subsets | Use fast subsets (for large data sets)? | False |
particle_diameter | Mask diameter (A): | 200 |
do_zero_mask | Mask individual particles with zeros? | True |
Note: relion.class3d does not register do_solvent_fsc; that option belongs to relion.refine3d only.
Multiref variants (relion.class3d.multiref, relion.class3d.helical.multiref) accept multiple initial reference maps.
Helical variants (relion.class3d.helical, relion.class3d.helical.multiref) add the full 19-key helical refinement option set, including:
| Key | Label | Default |
|---|---|---|
helical_tube_outer_diameter | Tube diameter - outer (A): | 0 |
helical_tube_inner_diameter | Tube diameter - inner (A): | None |
helical_nr_asu | Number of unique asymmetrical units: | 1 |
helical_z_percentage | Central Z length (%): | 30.0 |
helical_twist_initial | Initial helical twist (deg): | 0 |
helical_rise_initial | Initial helical rise (A): | 0 |
do_apply_helical_symmetry | Apply helical symmetry? | True |
do_local_search_helical_symmetry | Do local searches of symmetry? | False |
range_rot | Angular search range - rot (deg): | 15 |
range_tilt | Angular search range - tilt (deg): | 15 |
range_psi | Angular search range - psi (deg): | 15 |
helical_range_distance | Range factor of local averaging: | -1.0 |
keep_tilt_prior_fixed | Keep tilt-prior fixed: | True |
Initial model generation (relion.initialmodel)
Category: Initial Model Generation
Output dir: InitialModel/
Programs: relion_refine, relion_align_symmetry
can_continue: True
This job uses a gradient-driven VDAM algorithm to generate a de novo 3D model. Because it uses VDAM, it has no nr_mpi option.
Key option keys:
| Key | Label | Default |
|---|---|---|
fn_img | Input images STAR file: | "" (required) |
fn_cont | Continue from here: | "" (continue only) |
nr_iter | Number of VDAM mini-batches: | 200 |
tau_fudge | Regularisation parameter T: | 4 |
nr_classes | Number of classes: | 1 |
sym_name | Symmetry: | "C1" (required) |
do_run_C1 | Run in C1 and apply symmetry later? | True |
particle_diameter | Mask diameter (A): | 200 |
do_solvent | Flatten and enforce non-negative solvent? | True |
do_ctf_correction | Do CTF-correction? | True |
sampling | Initial angular sampling: | "15 degrees" (index 1) |
offset_range | Offset search range (pix): | 6 |
offset_step | Offset search step (pix): | 2 |
Outputs: run_it<NNN>_optimiser.star (NODE_OPTIMISERDATA), run_it<NNN>_data.star (NODE_PARTICLEGROUPMETADATA), one .mrc per class (NODE_DENSITYMAP) and initial_model.mrc (NODE_DENSITYMAP), all in InitialModel/jobNNN/.
3D auto-refinement (relion.refine3d and relion.refine3d.helical)
Category: 3D Refinement
Output dir: Refine3D/
Program: relion_refine
can_continue: True
relion.refine3d uses the gold-standard FSC approach. It does not register nr_iter; that option belongs to classification jobs only.
Key option keys:
| Key | Label | Default |
|---|---|---|
fn_img | Input images STAR file: | "" (required) |
fn_ref | Reference map: | "" (required) |
fn_mask | Reference mask (optional): | "" |
fn_cont | Continue from here: | "" (continue only) |
ref_correct_greyscale | Ref. map is on absolute greyscale? | False |
ini_high | Initial low-pass filter (A): | 60 |
sym_name | Symmetry: | "C1" (required) |
do_ctf_correction | Do CTF-correction? | True |
particle_diameter | Mask diameter (A): | 200 (required) |
do_zero_mask | Mask individual particles with zeros? | True |
do_solvent_fsc | Use solvent-flattened FSCs? | False |
Continuation: Sets fn_cont via find_current_opt_name() to the latest *_optimiser.star in the job directory. For relion.refine3d, continuation sets fn_cont (not in_optimiser) to the current optimiser file.
relion.refine3d.helical adds the full 19-key helical option set. Its helical-specific options use the labels Initial helical rise (A): and Initial helical twist (deg):, both defaulting to 0.0.
Multi-body refinement (relion.multibody.refine)
Category: Multi-body Refinement
Output dir: MultiBody/
Program: relion_refine
can_continue: True
Key option keys:
| Key | Label | Default |
|---|---|---|
fn_in | Consensus refinement optimiser.star: | "" (required) |
fn_bodies | Body STAR file: | "" (required) |
fn_cont | Continue from here: | "" (continue only) |
do_subtracted_bodies | Reconstruct subtracted bodies? | True |
do_blush | Use Blush regularisation? | False |
sampling | Initial angular sampling: | index 4 |
offset_range | Initial offset range (pix): | 3 |
offset_step | Initial offset step (pix): | 0.75 |
Outputs: Half-maps per body — run_half1_body<NNN>_unfil.mrc — registered as NODE_DENSITYMAP. The final optimiser STAR file is added as a post-run output node.
Continuation: For continuation, fn_cont must point to a valid *_optimiser.star file. Unlike the classification, initial-model and refinement jobs, this job does not override continuation_joboption_updates(), so get_continuation_job() does not populate fn_cont; set it yourself.
Flexibility analysis (relion.multibody.flexanalysis)
Category: Multi-body Refinement
Output dir: MultiBody/
Program: relion_flex_analyse
can_continue: False
This job analyses the principal motions of a completed multi-body refinement. It cannot be continued.
Key option keys:
| Key | Label | Default |
|---|---|---|
input_model | Input model file | "" (required) |
fn_bodies | Body STAR file: | "" (required) |
nr_movies | Number of eigenvector movies: | 3 |
do_select | Select particles based on eigenvalues? | False |
select_eigenval | Select on eigenvalue: | 1 |
eigenval_min | Minimum eigenvalue: | -999 |
eigenval_max | Maximum eigenvalue: | 999 |
CTF refinement (relion.ctfrefine)
Category: CTF Refinement
Output dir: CtfRefine/
Program: relion_ctf_refine
can_continue: True
Key option keys:
| Key | Label | Default |
|---|---|---|
fn_data | Particles (from Refine3D): | "" (required) |
fn_post | Postprocess STAR file: | "" (required) |
minres | Minimum resolution for fits (A): | 30 |
do_ctf | Perform CTF parameter fitting? | True |
do_defocus | Fit defocus? | "No" |
do_astig | Fit astigmatism? | "No" |
do_bfactor | Fit B-factor? | "No" |
do_phase | Fit phase-shift? | "No" |
do_tilt | Estimate beamtilt? | False |
do_trefoil | Also estimate trefoil? | False |
do_4thorder | Estimate 4th order aberrations? | False |
do_aniso_mag | Estimate (anisotropic) magnification? | False |
The do_defocus and do_astig options accept 'No', 'Per-micrograph', or 'Per-particle' (capitalised).
Output: particles_ctf_refine.star (NODE_PARTICLEGROUPMETADATA), logfile.pdf (NODE_LOGFILE).
Bayesian Polishing — polishing (relion.polish)
Category: Particle Polishing
Output dir: Polish/
Program: relion_motion_refine
can_continue: True
Key option keys:
| Key | Label | Default |
|---|---|---|
fn_mic | Micrographs (from MotionCorr): | "" (required) |
fn_data | Particles (from Refine3D or CtfRefine): | "" (required) |
fn_post | Postprocess STAR file: | "" (required) |
first_frame | First movie frame: | 1 |
last_frame | Last movie frame: | None |
extract_size | Extraction size (pix in unbinned movie): | None |
rescale | Re-scaled size (pixels): | None |
opt_params | Optimised parameter file: | "" |
do_own_params | OR use your own parameters? | False |
sigma_vel | Sigma for velocity (A/dose): | 0.2 |
sigma_div | Sigma for divergence (A): | 5000 |
sigma_acc | Sigma for acceleration (A/dose): | 2 |
minres | Minimum resolution for B-factor fit (A): | 20 |
maxres | Maximum resolution for B-factor fit (A): | None |
Outputs: shiny.star (NODE_PARTICLEGROUPMETADATA), logfile.pdf (NODE_LOGFILE).
Note: The training job (relion.polish.train) outputs opt_params_all_groups.txt (not opt_params.txt).
Particle subtraction (relion.subtract)
Category: Particle Subtraction
Output dir: Subtract/
Program: relion_particle_subtract
can_continue: False
This job requires at least 2 MPI processes (nr_mpi minimum is 2).
Key option keys:
| Key | Label | Default |
|---|---|---|
fn_opt | Input optimiser.star: | "" |
fn_mask | Mask of the signal to keep: | "" (required) |
fn_data | Input particle STAR file: | "" |
do_data | Use different particles? | False |
do_center_mask | Do center subtracted images on mask? | True |
do_center_xyz | Do center on my coordinates? | False |
center_x | Center coordinate (pix) - X: | 0 |
center_y | Center coordinate (pix) - Y: | 0 |
center_z | Center coordinate (pix) - Z: | 0 |
new_box | New box size: | None |
Output: particles_subtracted.star (NODE_PARTICLEGROUPMETADATA).
Revert subtraction (relion.subtract.revert)
Category: Particle Subtraction
Output dir: Subtract/
Program: relion_particle_subtract
can_continue: False
| Key | Label |
|---|---|
fn_fliplabel | revert this particle STAR file: |
Output: original.star (NODE_PARTICLEGROUPMETADATA).
DynaMight continuous heterogeneity (dynamight)
Category: Continuous Heterogeneity
Output dir: DynaMight/
Program: DynaMight executable (resolved via PIPELINER_DYNAMIGHT_EXECUTABLE or RELION_DYNAMIGHT_EXECUTABLE; defaults to relion_python_dynamight if on PATH, else dynamight)
can_continue: False
DynaMight cannot be continued via the pipeliner's continue_job mechanism. To extend training, run a new dynamight job using the checkpoint from a previous job.
Key option keys:
| Key | Label | Default |
|---|---|---|
do_est_motion | Estimate heterogeneous motions? | False |
fn_checkpoint | OR: Use motion estimation from a previous DynaMight job | "" |
fn_star | Input images STAR file: | "" |
fn_map | Consensus map: | "" |
nr_gaussians | Number of Gaussians: | 10000 |
initial_threshold | Initial map threshold (optional): | None |
reg_factor | Regularization factor: | 1 |
do_inverse | Do inverse-deformation estimation? | False |
nr_epochs | Number of epochs to perform: | 200 |
do_reconstruct | Do deformed backprojection? | False |
backproject_batchsize | Backprojection batchsize: | 10 |
do_store_deform | Store deformations in RAM? | False |
gpu_id | Which (single) GPU to use: | "0" |
do_preload | Preload images in RAM? | False |
Symmetry expansion (relion.image_analysis.symmetry_expansion)
Category: (Image Analysis)
Output dir: SymmetryExpansion/
Program: relion_particle_symmetry_expand
can_continue: False
| Key | Label | Default |
|---|---|---|
input_particles | Input particles file: | "" (required) |
symmetry | Symmetry: | "C2" (required, must be C2 or higher) |
do_helix | Do helical symmetry expansion? | False |
twist | Helical twist (degrees): | 0 |
rise | Helical Rise (Å): | 0 |
asu | Number of asymmetric units to expand: | 1 |
Output: expanded.star (NODE_PARTICLEGROUPMETADATA).
Continuation behaviour summary
For all optimiser-based jobs (relion.class2d.*, relion.class3d.*, relion.initialmodel, relion.refine3d.*, relion.multibody.refine), the fn_cont option must point to a valid *_optimiser.star file before a continuation is launched. The safest path is:
- Call
PipelinerProject.get_continuation_job(job_name)— this auto-populatesfn_contviacontinuation_joboption_updates()(except forrelion.multibody.refine, where you must setfn_conton the returned job yourself). - Pass the returned job to
PipelinerProject.run_job().PipelinerProject.schedule_job()accepts only a dict or a job file and refuses continuation jobs.
If you call PipelinerProject.continue_job(job_name) directly, you must manually set fn_cont in continue_job.star first; continue_job() does not check can_continue and does not auto-populate fn_cont.
Jobs with can_continue=False (relion.subtract, relion.subtract.revert, relion.multibody.flexanalysis, dynamight, relion.image_analysis.symmetry_expansion, all relion.select.*) must be rerun as new jobs if inputs or parameters change.
Example 1 — Run a 2D classification job from a parameters dict
This example schedules and runs an EM-algorithm 2D classification from the Python API. Job options are set via the .value property on each JobOption in job.joboptions.
import os
os.chdir("/path/to/my/project")
from pipeliner.api.manage_project import PipelinerProject
proj = PipelinerProject()
params = {
"_rlnJobTypeLabel": "relion.class2d.em",
"fn_img": "Extract/job003/particles.star",
"nr_classes": "50",
"tau_fudge": "2",
"particle_diameter": "180",
"do_ctf_correction": "Yes",
"nr_mpi": "4",
"nr_threads": "6",
}
job = proj.run_job(params, run_in_foreground=True)
print(job.output_dir) # e.g. Class2D/job004/
Example 2 — Continue a 3D classification job with modified regularisation
After a relion.class3d job completes, you can continue it from its last iteration with an updated tau_fudge. continue_job() reads continue_job.star in the job directory (written when the job was scheduled) and does not fill in fn_cont for you: for optimiser-based jobs it raises ValueError unless fn_cont names an _optimiser.star file, and also unless nr_iter is larger than the iteration you continue from. Set both with edit_jobstar() before calling continue_job().
import os
os.chdir("/path/to/my/project")
from pipeliner.api.manage_project import PipelinerProject
from pipeliner.api.api_utils import edit_jobstar
proj = PipelinerProject()
# Suppose Class3D/job005/ has Succeeded after 25 iterations
job_name = "Class3D/job005/"
template = "Class3D/job005/continue_job.star"
# Point fn_cont at the last optimiser file, raise nr_iter above 25,
# and change tau_fudge; write the edited file back in place.
edit_jobstar(
template,
{
"fn_cont": "Class3D/job005/run_it025_optimiser.star",
"nr_iter": "35",
"tau_fudge": "6",
},
template,
)
cont_job = proj.continue_job(job_name, run_in_foreground=True)
print(cont_job.output_dir)
Example 3 — Generate and run an initial model job from a run.job file
Use pipeliner --default_runjob to generate a template, edit it, then submit it.
# Generate the template run.job file
pipeliner --default_runjob relion.initialmodel
# Produces: relion_initialmodel_run.job
# Edit the file — labels must match exactly as printed by --default_runjob
# Example: set the input STAR file and number of mini-batches
sed -i.bak 's|Input images STAR file: == .*|Input images STAR file: == Select/job004/particles.star|' relion_initialmodel_run.job
sed -i.bak 's|Number of VDAM mini-batches: == .*|Number of VDAM mini-batches: == 300|' relion_initialmodel_run.job
# Run the job (creates InitialModel/job006/)
pipeliner --run_job relion_initialmodel_run.job
Example 4 — Run 3D auto-refinement and wait for completion before continuing
When building an automated pipeline, use run_in_foreground=True or wait_for_job_to_finish() to sequence dependent jobs.
import os
os.chdir("/path/to/my/project")
from pipeliner.api.manage_project import PipelinerProject
proj = PipelinerProject()
refine_params = {
"_rlnJobTypeLabel": "relion.refine3d",
"fn_img": "Select/job005/particles.star",
"fn_ref": "InitialModel/job006/run_it200_class001.mrc",
"sym_name": "C1",
"particle_diameter": "180",
"ini_high": "60",
"nr_mpi": "5",
"nr_threads": "8",
}
# Launch without blocking
refine_job = proj.run_job(refine_params)
# Block until the job finishes (or times out after 24 hours by default)
final_status = proj.wait_for_job_to_finish(
refine_job, error_on_fail=True
)
print(final_status) # 'Succeeded' or 'Aborted'; with error_on_fail=True a failed job raises RuntimeError
Example 5 — Bayesian polishing using the Python API
import os
os.chdir("/path/to/my/project")
from pipeliner.api.manage_project import PipelinerProject
proj = PipelinerProject()
polish_params = {
"_rlnJobTypeLabel": "relion.polish",
"fn_mic": "MotionCorr/job002/corrected_micrographs.star",
"fn_data": "CtfRefine/job009/particles_ctf_refine.star",
"fn_post": "PostProcess/job010/postprocess.star",
"first_frame": "1",
"do_own_params": "Yes",
"sigma_vel": "0.2",
"sigma_div": "5000",
"sigma_acc": "2",
"minres": "20",
"nr_mpi": "4",
"nr_threads": "6",
}
polish_job = proj.run_job(polish_params, run_in_foreground=True)
print(polish_job.output_dir) # e.g. Polish/job011/
Example 6 — Inspect job availability before scheduling
Before scheduling a job that requires RELION, check that the executables are available.
from pipeliner.job_factory import get_job_types
jobs = get_job_types(search_term="relion.refine3d")
for job in jobs:
print(job.PROCESS_NAME, job.jobinfo.is_available)
if not job.jobinfo.is_available:
print(" Reason:", job.jobinfo.unavailable_message)